Molar Mass Calculator

Type a chemical formula and get the molar mass in g/mol, with the contribution of each element — using IUPAC 2021 atomic weights.

How to use

  1. Type a chemical formula — H2O, NaCl, Ca(OH)2, C6H12O6 or any valid formula with element symbols and subscripts.
  2. The molar mass appears as you type, with the contribution of each element shown below.
  3. Parentheses and subscripts are supported: Ca(OH)2 correctly counts two OH groups.

About this tool

The molar mass of a substance is the mass of one mole of it, in grams per mole (g/mol). It is the sum of the atomic weights of every atom in the formula: water (H₂O) has two hydrogens at 1.008 and one oxygen at 15.999, so its molar mass is 18.015 g/mol. This calculator parses any valid chemical formula, looks up each element in the IUPAC 2021 standard atomic weight table, and adds them up.

The parser handles subscripts (H2, O3), parentheses with subscripts (Ca(OH)2, Mg3(PO4)2), and nested parentheses. Element symbols must start with an uppercase letter optionally followed by lowercase letters — the parser knows that Co is cobalt and CO is carbon plus oxygen. If a symbol is not in the periodic table, the parser says so instead of guessing.

The atomic weights come from the IUPAC Commission on Isotopic Abundances and Atomic Weights, 2021 values. For elements with a range of atomic weights (like hydrogen, 1.00784–1.00811), the conventional value is used (1.008). For elements with no stable isotope, the mass number of the most stable isotope is used. Everything runs in your browser.

The formula

Molar mass = Σ (atomic weight of element × number of atoms of that element). Example: C6H12O6 = 6 × 12.011 + 12 × 1.008 + 6 × 15.999 = 180.156 g/mol.

Frequently asked questions

What is a mole?

A mole is 6.022 × 10²³ entities — the Avogadro constant. One mole of water molecules weighs 18.015 grams, one mole of sodium chloride weighs 58.44 grams, and so on. The molar mass tells you how many grams that is for any substance.

Why are some atomic weights not whole numbers?

Because most elements exist as a mix of isotopes in nature, and the atomic weight is a weighted average. Chlorine, for example, is about 75% ³⁵Cl and 25% ³⁷Cl, so its atomic weight is 35.45, not 35 or 37.

Can I enter ionic formulas?

Type the empirical formula without charges — NaCl, CaCO3, Fe2O3. The molar mass is the same whether you write the formula as an ionic compound or a molecular one.

What if I get "Unknown element"?

Check the capitalisation. Element symbols start with an uppercase letter: Co is cobalt, CO is carbon and oxygen. If the symbol is correct and still not recognised, it may be a synthetic element not in the table.

Does my formula leave my browser?

No. The periodic table is embedded in the page. The parsing and calculation run locally, and nothing is uploaded or stored.

Related tools

Long links? Shorten them for free

Vai.la turns any URL into a short link with click statistics, QR Code and your own biolink.

Vai.la is not responsible for how the tools are used or for decisions made based on their results.