Molecular Weight Calculator
Type a chemical formula to get its molar mass in g/mol, the elemental composition by mass, the Hill formula and, if you like, the moles in a sample.
How to use the Molecular Weight Calculator
- Enter Chemical formula (Case-sensitive. Brackets ( ) [ ] { } can be nested. Write hydrates with · or * (CuSO4*5H2O)).
- Add any optional details you have; leave the rest blank.
- Read your answer in the results panel. It updates as you type, and the breakdown, step-by-step working and any charts or tables appear below it.
- Use Share link to save or send the exact calculation, or Copy to paste the results elsewhere.
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. It is measured in grams per mole (g/mol), and it has the same number as the molecular mass in daltons (u).
M = Σ (number of atoms × atomic weight)
The calculator reads the formula, counts every atom, and multiplies by the IUPAC standard atomic weights built into the page.
Writing formulas
- Element symbols are case-sensitive:
Cois cobalt, butCOis carbon monoxide. - A number after a symbol is the atom count:
H2O. - Brackets group atoms, and a number after the closing bracket multiplies the group:
Ca(OH)2. You can nest (), [] and {}:K4[Fe(CN)6]. - Hydrates and adducts use a dot, middle dot or asterisk, with an optional count:
CuSO4·5H2OorCuSO4*5H2O.
Worked example
Copper(II) sulfate pentahydrate, CuSO₄·5H₂O, contains 1 Cu, 1 S, 9 O and 10 H:
- Cu: 1 × 63.546 = 63.546
- S: 1 × 32.06 = 32.060
- O: 9 × 15.999 = 143.991
- H: 10 × 1.008 = 10.080
Total: 249.677 g/mol. Copper makes up 63.546 ÷ 249.677 = 25.45% of the mass. Water of crystallisation accounts for 90.08 g/mol, or 36% of the crystal, which is why the anhydrous salt (159.6 g/mol) must not be swapped in for the hydrate when making up solutions.
Percent composition
The table under the result lists each element’s share of the total mass. This is useful for checking elemental analysis results, working out how much of a fertiliser is actually nitrogen, or finding empirical formulas. The Hill formula orders elements with carbon first, hydrogen second and the rest alphabetically, which is the standard way chemical databases index compounds.
About atomic weights
Standard atomic weights are averages over the natural mix of isotopes, so some, such as lithium and boron, vary slightly with the source of the sample. This calculator uses IUPAC conventional values, which are accurate enough for laboratory work. For elements with no stable isotopes, such as technetium or plutonium, the value shown is the mass number of the longest-lived isotope and is marked with an asterisk.
If you enter a sample mass, the calculator also converts it to moles (mass ÷ molar mass) and to the number of formula units, using Avogadro’s number 6.022 × 1023.
Frequently asked questions
What is the molar mass of water?
H2O is 2 × 1.008 + 15.999 = 18.015 g/mol.
How do I calculate the molar mass of a hydrate?
Add the molar mass of the salt to the number of water molecules times 18.015. CuSO4·5H2O is 159.602 + 5 × 18.015 = 249.677 g/mol. Type it with a dot or asterisk and the calculator does this for you.
Is molecular weight the same as molar mass?
In practice, yes. Molecular weight is the mass of one molecule in daltons and molar mass is the mass of one mole in grams per mole. The numbers are the same.
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 moles. Enter a sample mass in the calculator to do this automatically.