Skip to content
Tool · Chemistry

Molar mass calculator

Type a chemical formula. You get the molar mass in g/mol, each element’s share of the mass, the working line by line, and how many moles are in the grams on the balance.

Type any formula in the panel
case matters: Co, CO

Brackets ( ) [ ] work. Write hydrates with · , * or a dot: CuSO4*5H2O.

Molar mass18.015 g/mol
Amount0.5551 mol
Particles3.34 × 10²³molecules or formula units
Working

Atomic weights: IUPAC CIAAW abridged standard atomic weights (2024).

Add up the atoms

Count each element in the formula, multiply by its standard atomic weight and add the products. A number after a bracket multiplies everything inside it.

M = Σ ni × Ar,i g/mol

Grams to moles

Divide the mass you weighed by the molar mass. Multiply by the molar mass to go back from moles to grams.

n = m ÷ M

Mass percent

Each element's share of the mass is its contribution divided by the whole. Water is two thirds hydrogen by atom count but only 11.19% hydrogen by mass.

% = niAr,i ÷ M × 100

How do you find the molar mass of a compound?

Count the atoms of each element in the formula, multiply each count by that element's standard atomic weight, and add the results. The total is the mass of one mole in grams. Water, H2O, is 2 × 1.0080 + 15.999 = 18.015 g/mol. Table salt, NaCl, is 58.44 g/mol, glucose, C6H12O6, is 180.16 g/mol and calcium carbonate, CaCO3, is 100.09 g/mol.

The calculator does the counting for you, including brackets like Ca(OH)2, nested brackets like K4[Fe(CN)6] and hydrates like CuSO4·5H2O, which you can also type as CuSO4*5H2O. It uses the IUPAC abridged standard atomic weights, shows every step of the sum, and converts the grams you weigh into moles and molecules. For the method written out by hand, with four worked examples, read how to calculate molar mass step by step.

Key results from the calculator

  • Water is 88.8% oxygen by mass, even though two of its three atoms are hydrogen. Hydrogen is so light that it makes up only 11.2% of the mass.
  • 10 g of water is 0.5551 mol, about 3.34 × 10²³ molecules.
  • Water of crystallisation counts. CuSO4·5H2O is 249.68 g/mol, while anhydrous CuSO4 is 159.60 g/mol. Weigh out the blue crystals using the anhydrous value and you are short by 36%.
  • Capital letters matter. Co is cobalt (58.933 g/mol); CO is carbon monoxide (28.010 g/mol). The calculator refuses lower-case input and suggests the formula you most likely meant.

Six compounds people look up most

Each section gives the numbers the calculator shows for that compound and has a button that loads it, with a typical sample mass on the balance.

Molar mass of water, H2O

18.015 g/mol

Two hydrogens at 1.0080 and one oxygen at 15.999 give 18.015 g/mol. Most textbooks round this to 18.02 or simply 18 g/mol, and for school problems 18 is fine.

With 10 g on the balance you have 0.5551 mol. A mole of water is 18.02 g, which is about 18 mL, a little more than a tablespoon, and it holds 6.022 × 10²³ molecules.

Molar mass 18.015 g/mol Oxygen by mass 88.8% 10 g is 0.5551 mol

Molar mass of sodium chloride, NaCl

58.44 g/mol

Sodium 22.990 plus chlorine 35.45 gives 58.44 g/mol. Chlorine's atomic weight is quoted only to 35.45 because its two isotopes vary slightly in natural samples, which is why NaCl has two decimals, not three.

Salt is 39.3% sodium by mass. That is the number behind food labels: 1 g of salt carries about 0.39 g of sodium. NaCl is ionic, so the calculator's particle count means formula units, not molecules.

Molar mass 58.44 g/mol Sodium by mass 39.3% 10 g is 0.1711 mol

Molar mass of glucose, C6H12O6

180.16 g/mol

Six carbons (72.066), twelve hydrogens (12.096) and six oxygens (95.994) add to 180.16 g/mol.

Glucose is 40.0% carbon and 53.3% oxygen by mass. Notice that hydrogen has the most atoms (12 of 24) and the smallest share (6.7%).

Molar mass 180.16 g/mol Carbon by mass 40.0% 5 g is 0.02775 mol

Molar mass of calcium carbonate, CaCO3

100.09 g/mol

Calcium 40.078, carbon 12.011 and three oxygens make 100.086 g/mol, which rounds to 100.09. Chemistry teachers love it because 100 g is almost exactly one mole.

It is 40.0% calcium by mass, the figure behind calcium supplements: a 1,250 mg tablet of calcium carbonate supplies about 500 mg of calcium.

Molar mass 100.09 g/mol Calcium by mass 40.0% 25 g is 0.2498 mol

A hydrate: copper(II) sulfate pentahydrate, CuSO4·5H2O

249.68 g/mol

The dot means five water molecules are locked into every formula unit of the crystal, and they count. CuSO4 is 159.60 g/mol; add 5 × 18.015 and you get 249.68 g/mol.

Type it with a middle dot, an asterisk (CuSO4*5H2O) or a full stop (CuSO4.5H2O). The water is 36.1% of the crystal's mass, which is what you lose when you heat blue crystals to the white anhydrous powder.

Pentahydrate 249.68 g/mol Anhydrous 159.60 g/mol Water share 36.1%

Molar mass of caffeine, C8H10N4O2

194.19 g/mol

Eight carbons, ten hydrogens, four nitrogens and two oxygens give 194.19 g/mol. The 0.2 g on the balance, about the caffeine in two cups of brewed coffee, is 0.00103 mol.

That is still about 6.2 × 10²⁰ molecules. Small masses in milligrams still hold astronomically many molecules, which is why chemists count in moles.

Molar mass 194.19 g/mol Nitrogen by mass 28.9% 200 mg is 0.00103 mol

Molar masses of common compounds

CompoundFormulaMolar mass (g/mol)Largest share by mass
WaterH2O18.015O 88.8%
Carbon dioxideCO244.009O 72.7%
Oxygen gasO231.998O 100.0%
Nitrogen gasN228.014N 100.0%
MethaneCH416.043C 74.9%
AmmoniaNH317.031N 82.2%
EthanolC2H5OH46.069C 52.1%
Hydrochloric acidHCl36.46Cl 97.2%
Sulfuric acidH2SO498.07O 65.3%
Sodium hydroxideNaOH39.997Na 57.5%
Sodium chlorideNaCl58.44Cl 60.7%
Calcium carbonateCaCO3100.086O 48.0%
Calcium hydroxideCa(OH)274.092Ca 54.1%
Potassium permanganateKMnO4158.032O 40.5%
GlucoseC6H12O6180.16O 53.3%
SucroseC12H22O11342.30O 51.4%
Copper(II) sulfate pentahydrateCuSO4·5H2O249.68O 57.7%

Molar masses from the IUPAC CIAAW abridged standard atomic weights (2024), rounded to the decimal place the atomic weight uncertainties support. Values in textbooks may differ in the last digit because they use older tables or round each atomic weight first.

How the calculator works

The formula is read left to right. A capital letter starts an element symbol, an optional small letter finishes it, and the number after it is the count (no number means 1). A number after a closing bracket multiplies everything inside the bracket, and brackets can be nested: in K4[Fe(CN)6] the 6 applies to both C and N.

A middle dot, an asterisk or a full stop followed by a number starts a new part, as in a hydrate. The leading number of that part multiplies all of it: CuSO4·5H2O adds 10 H and 5 O. A charge at the end, such as SO4^2- or NH4+, is ignored, because the mass of the missing or extra electrons is about 0.00055 g/mol each, far below the precision of the atomic weights.

Each element count is multiplied by its standard atomic weight from the IUPAC Commission on Isotopic Abundances and Atomic Weights (CIAAW) abridged table, and the products are summed. Mass percent is each product divided by the total. The answer is rounded to the decimal place the atomic weight uncertainties allow, which is why water shows 18.015 but salt shows 58.44.

For the conversion, moles are grams divided by molar mass, and the number of particles is moles times the Avogadro constant, 6.02214076 × 10²³ per mole, which is exact by definition since 2019.

What the model leaves out

  • Isotope labels. Deuterium (D) and specific isotopes such as ¹³C are not accepted. The calculator uses natural isotopic mixtures, which is what standard atomic weights describe.
  • Radioactive elements. Technetium, promethium and every element from polonium up apart from thorium, protactinium and uranium have no standard atomic weight. The calculator uses the mass number of the most stable isotope instead, shown in square brackets and marked with an asterisk.
  • Natural variation. Lithium, boron, sulfur, chlorine and a few others vary between sources, so IUPAC quotes them with fewer digits. A sample of lithium from a battery supplier can differ from the 6.94 average in the second decimal.
  • Structure. The calculator counts atoms, so isomers such as ethanol and dimethyl ether (both C2H6O) have the same molar mass. Condensed formulas like CH3COOH work because the counts simply add up.

Common misconceptions

"Molar mass and molecular weight are different numbers." They are the same number. Molecular weight (relative molecular mass) has no unit; molar mass is the same value in g/mol.

"The element with the most atoms has the biggest share." Mass share depends on atomic weight. Hydrogen has two of water’s three atoms but only 11.19% of its mass.

"CO and Co are the same thing typed differently." Capitals change the chemistry. CO is carbon monoxide, 28.010 g/mol; Co is cobalt, 58.933 g/mol.

Frequently asked questions

What is the molar mass of water?

18.015 g/mol, from 2 × 1.0080 for hydrogen plus 15.999 for oxygen. Most textbooks round it to 18.02 g/mol, and 18 g/mol is fine for quick estimates.

How do I calculate molar mass from a chemical formula?

Count the atoms of each element, multiply each count by the atomic weight from the periodic table, and add the products. A number after a bracket multiplies everything inside it. The total is in grams per mole.

How do I include water of crystallisation in a hydrate?

Add the water molecules as a separate part: CuSO4·5H2O is CuSO4 plus 5 × H2O, which is 159.60 + 5 × 18.015 = 249.68 g/mol. In the calculator you can type the dot as *, · or a full stop.

How do I convert grams to moles?

Divide the mass in grams by the molar mass in g/mol. 10 g of water is 10 ÷ 18.015 = 0.5551 mol. To go from moles to grams, multiply by the molar mass instead.

Which atomic weights does this molar mass calculator use?

The IUPAC CIAAW abridged standard atomic weights (2024 table), quoted to five significant figures where natural variation allows. For radioactive elements with no standard atomic weight, it uses the mass number of the most stable isotope.

Keep learning

More simulations

More chemistry and lab tools

See all science tools