All calculators

Education

Molecular Weight Calculator

Type a chemical formula and the calculator parses every element, sums the atomic weights, and returns molar mass in g/mol with a per-element mass and percent-composition breakdown.

Element symbols are case-sensitive (Na, not NA). Subscripts are digits after the symbol. Parentheses with multipliers are supported. · e.g. H2O, CO2, NaCl, C6H12O6, Ca(OH)2

What this parser supports

  • Element symbols from H (hydrogen) through Pu (plutonium).
  • Numeric subscripts directly after a symbol, e.g. H2O.
  • Parentheses and square brackets with numeric multipliers, e.g. Ca(OH)2 or Mg3(PO4)2.
  • Nested groups, e.g. K3[Fe(CN)6].

Not supported: charge notation (e.g. NH4+), hydrate dots (CuSO4·5H2O), isotope labels, or organic shorthand (CH3 in Lewis structure form). Educational use only; do not rely on this for laboratory dosing or safety decisions.

Molar mass

Molecular weight of H2O

18.015 g/mol

3 atoms total

H × 22.016 g/mol · 11.19%
O × 115.999 g/mol · 88.81%

Molar mass equals the sum, over each element, of the atom count times the standard atomic weight. Values are the IUPAC 2021 conventional weights in g/mol. The percent column shows mass composition by element.

Was this helpful?

Examples

H2O (water)

18.015 g/mol

CO2 (carbon dioxide)

44.009 g/mol

NaCl (table salt)

58.44 g/mol

C6H12O6 (glucose)

180.156 g/mol

Ca(OH)2 (calcium hydroxide)

74.093 g/mol

K3[Fe(CN)6] (potassium ferricyanide)

329.244 g/mol

How it works

The parser walks the formula one symbol at a time, expanding any parenthesized group by its subscript and accumulating atom counts per element. Molar mass is then the sum, over every element, of count × atomic weight.

Molar mass · M = Σ n_i × A_i

n_i = atom count for element i, A_i = standard atomic weight (g/mol).

Percent composition for each element is mass(element) / mass(total) × 100, useful for converting between mass and moles and for stoichiometric ratios.

Related education calculators

Educational use only. The parser is built for homework and classroom problems. Do not use this output for laboratory dosing, drug formulation, chemical safety, or any decision where exact masses matter.

Frequently asked questions

Molar mass is the mass of one mole of a substance, expressed in grams per mole (g/mol). For a molecule, it equals the sum of the atomic weights of every atom in the formula. The terms 'molecular weight' and 'molar mass' are used interchangeably for ordinary molecules.

Count the atoms of each element in the formula, multiply each by the standard atomic weight of that element, and add the results. For example, H2O has 2 hydrogens (2 × 1.008 = 2.016) and 1 oxygen (1 × 15.999 = 15.999), so molar mass = 18.015 g/mol.

Standard atomic weights from the IUPAC 2021 conventional values, expressed in grams per mole. For some elements without a stable isotope (Tc, Pm, Po, At, Rn, Fr, Ra, Ac, Np, Pu), the calculator uses the mass number of the most stable common isotope.

Element symbols (case-sensitive: Na not NA), digit subscripts (H2O, CO2), nested parentheses with multipliers (Ca(OH)2, Mg3(PO4)2), and square brackets (K3[Fe(CN)6]). Spaces are ignored.

Charges (NH4+ or SO4^2-), hydrate dots (CuSO4·5H2O — instead enter the combined formula), isotope notation (^14C), and organic Lewis shorthand. Multi-letter symbols must start with a capital and be followed by lowercase: Ca, not CA or ca.

The numbers are based on the latest published atomic weights and are fine for stoichiometry homework, lab prep estimates, and routine analytical chemistry. For ultra-precise mass spectrometry or radiochemistry, use isotope-specific masses from a primary source.

Molar mass is mass per mole (g/mol). Molecular mass is the mass of a single molecule in atomic mass units (u or Da). Numerically the values match (one molecule of water is 18.015 u; one mole is 18.015 g), so most introductory chemistry courses use the terms interchangeably.