How molar mass is calculated
The molar mass of a compound is the sum of the atomic weights of all the atoms in its formula. For glucose, C6H12O6: 6 × 12.011 + 12 × 1.008 + 6 × 15.999 = 180.156 g/mol. The calculator reads the formula, counts every atom, looks up each atomic weight and adds them, then shows what share of the mass each element contributes.
Formula syntax the calculator understands
- Simple formulas: NaCl, H2SO4, C8H10N4O2.
- Groups in parentheses or brackets: Ca(OH)2, Al2(SO4)3, K4[Fe(CN)6].
- Hydrates: CuSO4·5H2O, MgSO4*7H2O or Na2CO3.10H2O.
- Subscript digits pasted from a document, such as H₂O, are converted automatically.
Worked example: copper(II) sulfate pentahydrate
| Element | Atoms | Atomic weight | Subtotal |
|---|---|---|---|
| Cu | 1 | 63.546 | 63.546 |
| S | 1 | 32.06 | 32.06 |
| O | 9 | 15.999 | 143.991 |
| H | 10 | 1.008 | 10.08 |
| Total | 249.68 g/mol | ||
Mass percent composition
Mass percent tells you how much of a sample's mass comes from each element: the element's subtotal divided by the molar mass, times 100. Water is 11.19% hydrogen and 88.81% oxygen by mass. Comparing a measured composition with these values is a quick way to check an unknown compound in the lab.
From grams to moles and back
moles = grams ÷ molar mass and grams = moles × molar mass. To make 250 mL of a 0.5 M sodium chloride solution you need 0.125 mol, which is 0.125 × 58.44 = 7.31 g of NaCl. Setting up these conversions is a direct proportion, the same idea behind the proportion calculator.
Accuracy note
Standard atomic weights reflect natural isotope mixtures and are published by IUPAC. Some elements, such as hydrogen, carbon and sulfur, vary slightly with their source, so results are shown to two decimal places, which is more than enough for classroom and most lab work. For high-precision mass spectrometry use exact isotopic masses instead.
Frequently asked questions
What is the difference between molecular weight and molar mass?
Molecular weight (relative molecular mass) is dimensionless, while molar mass has units of grams per mole. For practical chemistry they have the same number: water is 18.015 and 18.015 g/mol.
How do I enter a hydrate?
Use a dot, an asterisk or a middle dot between the parts, with the coefficient in front of the water: CuSO4·5H2O, CuSO4*5H2O or CuSO4.5H2O all work.
Are element symbols case-sensitive?
Yes. Co is cobalt but CO is carbon monoxide. Start every symbol with a capital letter and write the second letter in lowercase.
Which atomic weights does the calculator use?
IUPAC standard atomic weights, rounded to about five significant figures. Radioactive elements without stable isotopes use the mass number of their longest-lived isotope.
How do I convert grams to moles?
Divide the mass in grams by the molar mass. 36 g of water is 36 ÷ 18.015 = 2.0 moles.
Sources and official references
- Atomic Weights and Isotopic Compositions – NIST Physical Measurement Laboratory
- Standard atomic weights – IUPAC Commission on Isotopic Abundances and Atomic Weights
Last reviewed October 10, 2026. Results are estimates for planning; see our disclaimer.