Molecular Weight Calculator

Parse a chemical formula and calculate molar mass, elemental composition and sample amount.

Your numbers

Live

Instant result. Updates while you type.

Your result

Updated now
—

Enter your numbers.

Molecular weight and molar mass calculator from a chemical formula

Molar mass is the sum of each atom's atomic weight times how many times it appears. Water, H2O, is 2 × 1.008 + 15.999 = 18.015 g/mol; glucose, C6H12O6, is 180.156 g/mol. Type any formula, including parentheses and hydrates such as CuSO4·5H2O, to get the molar mass, mass percent of each element and moles in a sample.

Editorial checkFormula tokenizer, nested groups, hydrate coefficients and elemental mass contributions tested against common compounds; atomic weights checked against the IUPAC/CIAAW table, including the 2024 revision of gadolinium, lutetium and zirconium.Updated October 24, 2026Read the publication standard

Inputs used by this calculator

Molecular Weight Calculator uses the fields below. The starting values reproduce the page example; replace them with values from the same units and time period before using the result.

Field-by-field reference for Molecular Weight Calculator.
InputStarting exampleAccepted valueHow it is used
Chemical formulaC6H12O6Text in the format shownSupplies the chemical formula quantity used by the published equation or result breakdown.
Optional sample mass (g)180.1560 to 1000000000000Supplies the optional sample mass (g) quantity used by the published equation or result breakdown.
A formula is a weighted sum of its atomsEach element count multiplies its relative atomic mass; the contributions add to the compound molar mass.1Formula tokens2Element contributions3Molar mass
  1. Formula tokens
  2. Element contributions
  3. Molar mass
A formula is a weighted sum of its atomsEach element count multiplies its relative atomic mass; the contributions add to the compound molar mass.

Relative molecular mass and molar mass

Relative molecular mass is dimensionless. For a defined composition, the same numerical value expressed in g/mol gives its molar mass.

How the formula is parsed

Capital letters begin element symbols, lowercase letters complete them, whole numbers multiply the preceding element or parenthesized group, and a hydrate coefficient multiplies its dot-separated component.

Mass-sum formula

The engine multiplies each element count by its stored representative relative atomic mass and adds the contributions.

M=ΣNᵢAᵣ,ᵢ

Worked glucose example

C6H12O6 contains 6 carbon, 12 hydrogen and 6 oxygen atoms. Their contributions sum to approximately 180.156 g/mol.

From grams to amount

Dividing sample mass by molar mass gives moles. Multiplying moles by the exact Avogadro constant gives the number of specified formula entities.

Isotopes and material limits

Atomic weights can be intervals because natural isotopic composition varies. This general calculator uses representative values and does not model isotopic labels, mixtures, charges, polymers or non-stoichiometric solids.

Molar masses of common compounds

Computed by this calculator from standard atomic weights; published values can differ in the last decimal.
CompoundFormulaMolar mass
WaterH2O18.015 g/mol
Carbon dioxideCO244.009 g/mol
Oxygen gasO231.998 g/mol
Sodium chloride (table salt)NaCl58.440 g/mol
AmmoniaNH317.031 g/mol
MethaneCH416.043 g/mol
EthanolC2H5OH46.069 g/mol
Acetic acid (vinegar)CH3COOH60.052 g/mol
Sodium bicarbonate (baking soda)NaHCO384.006 g/mol
Calcium carbonateCaCO3100.086 g/mol
Sulfuric acidH2SO498.072 g/mol
GlucoseC6H12O6180.156 g/mol
AspirinC9H8O4180.159 g/mol
Sucrose (table sugar)C12H22O11342.297 g/mol
Copper(II) sulfate pentahydrateCuSO4·5H2O249.677 g/mol

Formula notation examples

Plain digits are accepted instead of typographic subscripts.
FormulaParsed composition
H2OH₂O
Ca(OH)2CaO₂H₂
Al2(SO4)3Al₂S₃O₁₂
CuSO4·5H2OCuS O₉ H₁₀

Frequently asked questions

Is molecular weight the same as molar mass?

They share a numerical value for a defined composition, but relative molecular mass is dimensionless and molar mass has units.

Can I use parentheses?

Yes, including nested groups within the supported length.

Can I enter hydrates?

Yes, separate components with a middle dot or period.

Are isotopically labeled formulas supported?

No.

Why can published values differ slightly?

Atomic-weight conventions and isotopic composition can differ. In 2024 IUPAC revised the standard atomic weights of gadolinium (157.249), lutetium (174.96669) and zirconium (91.222); this calculator uses the revised values.

What is the molar mass of water?

18.015 g/mol, from two hydrogen atoms (1.008 each) and one oxygen atom (15.999).

How are sample moles calculated?

Sample mass in grams divided by molar mass in g/mol.

What to keep in mind

Uses conventional representative relative atomic-mass values for natural terrestrial composition. Isotopic enrichment, uncertain radioactive-element mass numbers, charges, polymers and non-stoichiometric materials require a composition-specific method.

Results are rounded for display in US format, with money in dollars and cents; CSV exports keep full calculation precision. This is a calculation summary, not an official certificate.

Sources and references

Manage privacy choices