Molecular Weight Calculator (Molar Mass)

Calculate the molecular weight (molar mass) of any chemical formula, like H2O or Ca(OH)2, with a per-element mass breakdown and step-by-step working.

Loading calculator…

What is molecular weight?

Molecular weight (molar mass) is the total mass of one mole of a compound, found by summing the atomic mass of every atom named in its chemical formula:

MW=(atoms×atomic mass)MW = \sum (\text{atoms} \times \text{atomic mass})

Enter a formula above — element symbols, subscripts for atom counts, and grouping with () or [] — and the calculator parses it, looks up each element's IUPAC standard atomic mass, and reports the total in grams per mole (g/mol).

Accepted formula syntax

  • Element symbols are case-sensitive: Na (sodium) is valid, NA is not.
  • Subscripts after a symbol give its atom count; no digit means 1 atom (NaCl = 1 Na + 1 Cl).
  • Groups in () or [] followed by a number multiply every atom inside by that number: Ca(OH)2 means 1 Ca plus 2 of the OH group (2 O, 2 H).
  • Nesting is unlimited: Fe2(SO4)3 multiplies the sulfate group by 3 inside a formula that also carries an Fe subscript.
Tip: A group multiplier applies to every atom inside the parentheses, not just the last one. (NH4)2SO4 has 2 nitrogen and 8 hydrogen atoms from the NH4 group alone — doubling only the H would undercount nitrogen.

Worked example 1: water (H2O)

  1. Count atoms: 2 hydrogen, 1 oxygen.
  2. Look up masses: H = 1.008, O = 15.999.
  3. Multiply and add: 2 × 1.008 + 1 × 15.999 = 2.016 + 15.999 = 18.015 g/mol.

Worked example 2: table salt (NaCl)

  1. Count atoms: 1 sodium, 1 chlorine.
  2. Look up masses: Na = 22.990, Cl = 35.45.
  3. Multiply and add: 22.990 + 35.45 = 58.44 g/mol.

Worked example 3: calcium hydroxide (Ca(OH)2) — a nested group

  1. Calcium: 1 × 40.078 = 40.078.
  2. The OH group, multiplied by 2: (15.999 + 1.008) × 2 = 17.007 × 2 = 34.014.
  3. Add: 40.078 + 34.014 = 74.092 g/mol.

From molar mass to percent composition

Once you have the total molar mass, you can find what share of that mass comes from each element — its percent composition — by dividing that element's subtotal by the molar mass and multiplying by 100. For water: hydrogen's share is 2.016 ÷ 18.015 × 100 ≈ 11.19%, and oxygen's share is 15.999 ÷ 18.015 × 100 ≈ 88.81%. The two shares always add up to 100%, and the percentage calculator handles that final division-and-multiply step if you want it worked out separately.

Common mix-ups

  • Forgetting the group multiplier applies to every atom inside. In Fe2(SO4)3, the ×3 covers all 4 oxygens and the sulfur in each sulfate group — 3 S and 12 O total, not 3 O.
  • Mixing up case-sensitive symbols. Co (cobalt) and CO (carbon + oxygen) parse as completely different things; a lowercase-second-letter typo changes the whole formula.
  • Using atomic number instead of atomic mass. Oxygen's atomic number is 8, but its atomic mass is 15.999 — the calculator always uses mass, since that's what determines a mole's weight.

Where this shows up

Molar mass is the bridge between a lab-bench mass in grams and a chemically meaningful count of particles in moles — it's the same relationship the ideal gas law calculator uses when it converts between an amount of gas in moles and other measurable quantities. Very small atomic-scale masses or huge molar quantities (a mole is about 6.022 × 10²³ particles) are often easier to read and compare in scientific notation than written out in full.

Frequently asked questions

What is molecular weight?
Molecular weight (also called molar mass) is the mass of one mole of a substance, found by adding up the atomic mass of every atom in its chemical formula. It's expressed in grams per mole (g/mol).
How do you calculate molecular weight from a formula?
Count the atoms of each element in the formula, look up each element's atomic mass, multiply count by atomic mass for every element, then add the results. For water (H2O): 2 × 1.008 + 1 × 15.999 = 18.015 g/mol.
Why do atomic masses have decimals instead of whole numbers?
An element's atomic mass is a weighted average across its naturally occurring isotopes, which mix in fixed proportions on Earth. Carbon, for example, is mostly carbon-12 with a trace of carbon-13, averaging to 12.011 rather than a clean 12.
How do parentheses and brackets work in a formula?
A group in ( ) or [ ] followed by a number multiplies every atom inside the group by that number. In Ca(OH)2, the 2 applies to the whole OH group, giving 2 oxygen and 2 hydrogen atoms, not just 2 hydrogen.
What's the difference between molecular weight and molar mass?
For practical purposes they're the same number with the same units (g/mol) — "molecular weight" is the traditional chemistry term, while "molar mass" is the more precise SI-era name for the mass of one mole of a substance.
Does capitalization matter in element symbols?
Yes — element symbols are case-sensitive, and formulas are parsed strictly. Co is cobalt, but CO is carbon monoxide (carbon + oxygen); NA isn't a valid symbol at all, only Na (sodium) is.
Can this calculator handle compounds with nested groups, like Fe2(SO4)3?
Yes — groups can nest to any depth. Fe2(SO4)3 (iron(III) sulfate) parses as 2 iron atoms plus a sulfate group multiplied by 3, giving 3 sulfur and 12 oxygen atoms in total.

Related calculators