Molar Mass Calculator Formula

Understand the math behind the molar mass calculator. Each variable explained with a worked example.

Formulas Used

Molar Mass

molar_mass = mass_elem_a * count_a + mass_elem_b * count_b + mass_elem_c * count_c

Variables

VariableDescriptionDefault
mass_elem_aAtomic Mass of Element A(g/mol)12.011
count_aNumber of A Atoms6
mass_elem_bAtomic Mass of Element B(g/mol)1.008
count_bNumber of B Atoms12
mass_elem_cAtomic Mass of Element C(g/mol)15.999
count_cNumber of C Atoms6

How It Works

How to Calculate Molar Mass

Formula

Mw = sum of (atomic mass × count) for each element

Look up atomic masses on the periodic table and multiply by the subscript in the formula.

Worked Example

Glucose C6H12O6: C=12.011, H=1.008, O=15.999.

mass_elem_a = 12.011count_a = 6mass_elem_b = 1.008count_b = 12mass_elem_c = 15.999count_c = 6
  1. 01C: 12.011 × 6 = 72.066
  2. 02H: 1.008 × 12 = 12.096
  3. 03O: 15.999 × 6 = 95.994
  4. 04Mw = 72.066 + 12.096 + 95.994 = 180.156 g/mol

Ready to run the numbers?

Open Molar Mass Calculator