Molar Mass Calculator

Enter a chemical formula to find its molar mass in g/mol and check each element's atom count and mass contribution.

Advanced options
Molar massMass of one mole of the entered formula. A course table may round atomic weights differently.
Element mass breakdownCalculated element detailsCheck the atom counts to confirm that groups and hydrate coefficients were applied as expected.
ElementAtom countAtomic weight (g/mol)Contribution (g/mol)Mass percent
Atoms in one formula unitThis is the atom count in one formula unit, not the number of atoms in one mole.
Different elements in the formulaRepeated appearances of the same element are combined.
Atomic weights used
Did we solve your problem today?


How to use our Molar Mass Calculator

  1. Type the chemical formula exactly as written, such as H2O, Ca(OH)2, or CuSO4.5H2O.
  2. Check uppercase and lowercase letters before calculating. CO means carbon monoxide, while Co means cobalt.
  3. Open Advanced options only if your teacher or lab instructions require a different number of displayed decimal places.
  4. Click Calculate, then compare the element counts in the breakdown with your formula, especially after parentheses, brackets, or a hydrate separator.
Example inputs for Molar Mass Calculator
Example inputs for Molar Mass Calculator

Definitions

Molar mass: The mass of one mole of a substance, reported in grams per mole (g/mol).

Atomic weight: A reference value for the mass of an element's atoms. This calculator uses embedded NIST standard atomic-weight values for supported elements. [1]

Subscript: A whole number after an element or group that gives its count. In H2O, the 2 means two hydrogen atoms.

Formula unit: One complete written chemical formula, such as one Ca(OH)2 unit.

Hydrate segment: A formula part after a period or asterisk. In CuSO4.5H2O, the 5 multiplies the entire H2O segment.

Mass percent: An element's mass contribution divided by the total molar mass, multiplied by 100.


Ca(OH)2 mass contributionsElement contributions to the worked-example molar mass. Each bar is the element's total mass contribution in one mole of Ca(OH)2.Ca(OH)2 mass contributionsElement contributions to the worked-example molar massCalcium40.08 g/molOxygen (x2)32 g/molHydrogen (x2)2.02 g/molElement
Ca(OH)2 mass contributions
Each bar is the element's total mass contribution in one mole of Ca(OH)2.

Common mistakes and quick fixes

Mistake: Typing co for carbon monoxide.
Fix: Check Chemical formula and then recalculate. Use CO. Element symbols are case-sensitive: Co is cobalt, while CO contains carbon and oxygen.

Mistake: Counting only one O and one H in Ca(OH)2.
Fix: Check Chemical formula and then recalculate. The 2 after the parenthesis multiplies both elements. Check the breakdown for 2 oxygen atoms and 2 hydrogen atoms.

Mistake: Leaving out the 5 in CuSO4.5H2O.
Fix: Check Chemical formula and then recalculate. Include the hydrate coefficient. It multiplies the complete H2O segment, so five water groups are counted.

Mistake: Entering a compound name such as sodium chloride.
Fix: Check Chemical formula and then recalculate. Enter its formula, NaCl. The calculator needs element symbols and atom counts.

Mistake: Reading atoms in one formula unit as atoms in one mole.
Fix: Treat it as the atoms in one written formula unit. Molar mass is the mass of one mole, reported in g/mol.

Mistake: Getting a last-digit mismatch with a worksheet.
Fix: Check Chemical formula and then recalculate. Follow the worksheet's rounding instruction and use its atomic-weight table if your course requires one.


Limitations & Key Assumptions / Boundary Conditions

  • Enter a chemical formula, not a compound name. The calculator does not determine formulas from names.
  • Accepted notation uses case-sensitive element symbols, positive whole-number subscripts, nested parentheses or brackets, and hydrate parts separated by a period or asterisk.
  • Charges, isotope notation, organic shorthand, decimal subscripts, overall leading coefficients, and unsupported elements are rejected.
  • The calculation uses embedded NIST standard atomic weights for supported elements. A course table that uses different rounding can change the last displayed digit.
  • The answer describes the composition written in the formula. It does not account for sample purity, moisture omitted from the formula, or mixtures.

Methodology

Calculation method

The calculator reads the complete chemical formula, expands parenthesized and bracketed groups, and combines repeated element symbols. A number after a group multiplies every atom inside it. A hydrate coefficient multiplies the complete segment after a period or asterisk.

parsed_element_counts = parse_formula(chemical_formula, formula_grammar)

For each element, the calculator multiplies its expanded atom count by its embedded NIST standard atomic weight. It adds the contributions without rounding intermediate values. [1]

element_contribution_g_mol = atom_count * atomic_weight_g_mol

molar_mass_g_mol = sum(element_contribution_g_mol)

Each mass-percent value is that element's contribution divided by the unrounded total molar mass.

mass_percent = 100 * element_contribution_g_mol / molar_mass_g_mol

Worked example

For Ca(OH)2, the expanded formula has 1 calcium atom, 2 oxygen atoms, and 2 hydrogen atoms.

40.078 + 2 * 15.999 + 2 * 1.008 = 74.092 g/mol

This formula unit contains 5 total atoms and 3 different elements.


Sources