Guide
Molar mass from a chemical formula, with percent composition and moles
The molar mass is the bridge between the mass you weigh on a balance and the number of particles in the flask. Every stoichiometry, concentration or yield calculation starts with it. This calculator reads a chemical formula, including brackets and hydrates, sums the atomic masses and gives the molar mass, the percent composition by element and, if you enter a sample mass, the moles and the number of molecules and atoms it holds.
How a formula is read
An element symbol is one capital letter optionally followed by a lowercase letter, then an optional count. A bracketed group can be followed by a multiplier that applies to every atom in it, and groups can be nested: Al2(SO4)3 has 2 Al, 3 S and 12 O, and K4[Fe(CN)6] has 6 C. A hydrate is written with a dot and a coefficient: CuSO4·5H2O adds five waters. Unicode subscripts such as H₂O are converted, and anything after a caret, such as a charge, is ignored.
Capital letters matter
Co is cobalt and CO is carbon monoxide, so the case of every letter is part of the formula. If a symbol does not exist, for example Xx or a lowercase start such as h2o, the tool names the problem: “Xx” is not an element symbol, or Unexpected h in the formula. Unbalanced brackets are reported as well, with the bracket named. A coefficient at the very start, such as 2H2O, is rejected because it belongs to an equation, not to a formula.
Entering formulas
Type one formula per line, up to twelve, and an optional sample mass in grams. The page opens on three formulas and shows the molar mass of the first, its Hill formula (carbon first, then hydrogen, then the rest alphabetically: CaH2O2), the number of atoms per formula unit, and a table for each formula with the element, atom count, atomic mass, mass contribution and mass percent. Sample chips load examples such as water at 36 g and aluminium sulfate with caffeine.
Worked examples
Ca(OH)2 is 40.078 + 2 × 15.999 + 2 × 1.008 = 74.092 g/mol, with calcium 54.0922%, oxygen 43.1868% and hydrogen 2.72094%. Glucose, C6H12O6, is 180.156 g/mol: carbon 40.002%, hydrogen 6.71418% and oxygen 53.2838%. CuSO4·5H2O is 249.677 g/mol, of which copper is 25.4513%, sulfur 12.8406% and oxygen 57.6709%. Table salt NaCl is 58.44 g/mol, 39.3395% sodium and 60.6605% chlorine. Caffeine, C8H10N4O2, is 194.194 g/mol.
From grams to moles
Entering a mass gives moles = mass ÷ molar mass, shown also in millimoles, then the number of formula units (moles times Avogadro’s constant, 6.02214076 × 10²³) and the total atoms. For 36 g of water, 36 ÷ 18.015 = 1.9983347 mol, which is 1.20343 × 10²⁴ molecules and 3.61028 × 10²⁴ atoms. Percent composition answers questions such as how much hydrogen a compound contains: 11.1907% of water’s mass.
Which atomic masses
The values are the IUPAC abridged standard atomic weights, four or five significant figures, such as 1.008 for hydrogen, 12.011 for carbon, 15.999 for oxygen, 22.990 for sodium and 35.45 for chlorine. They suit most textbook and lab work and may differ in the last digit from a table with more decimals. For an element with no stable isotope the tool uses the mass number of its longest-lived isotope and warns you.
Limits
Molar mass here is for the natural isotopic mixture, so it is not the monoisotopic mass used in mass spectrometry. Polymers, mixtures and formulas with variable composition need a molar mass from the supplier. The tool does not predict a structure or check that a formula is chemically sensible, and ions are treated by their atoms only. For stoichiometry with several substances, balance the equation first.
Related tools
- Molarity Calculator turns the molar mass into solution concentrations and dilutions.
- Chemical Equation Balancer gives the mole ratios of a reaction.
- Periodic Table lists the atomic masses used here and the rest of each element’s data.
- Ideal Gas Law Calculator uses the molar mass to find a gas’s density.
Checked against the current version of the Molar Mass Calculator on .

