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

Frequently Asked Questions

What is molar mass?

The mass of one mole of a substance in grams, numerically equal to the molecular weight in atomic mass units.

Where do I find atomic masses?

On the periodic table. Common ones: H=1.008, C=12.011, N=14.007, O=15.999, Na=22.990, Cl=35.453.

What if my compound has more than 3 elements?

Set unused element counts to zero and calculate remaining elements separately, then add.

Learn More

Guide

How to Balance Chemical Equations

Step-by-step guide to balancing chemical equations. Learn the law of conservation of mass, inspection method, tips for complex equations, and common mistakes.

Ready to run the numbers?

Open Molar Mass Calculator