Molecular Weight Calculator Formula

Understand the math behind the molecular weight calculator. Each variable explained with a worked example.

Formulas Used

Molecular Weight

mw = c_atoms * 12.011 + h_atoms * 1.008 + o_atoms * 15.999 + n_atoms * 14.007 + s_atoms * 32.065

Variables

VariableDescriptionDefault
c_atomsNumber of Carbon Atoms6
h_atomsNumber of Hydrogen Atoms12
o_atomsNumber of Oxygen Atoms6
n_atomsNumber of Nitrogen Atoms0
s_atomsNumber of Sulfur Atoms0

How It Works

Molecular Weight Calculation

The molecular weight (molar mass) of a compound is the sum of the atomic weights of all atoms in its molecular formula.

Formula

MW = sum(n_i × AW_i)

where n_i is the number of atoms of element i and AW_i is the standard atomic weight. Standard atomic weights: C = 12.011, H = 1.008, O = 15.999, N = 14.007, S = 32.065 g/mol.

Worked Example

Calculate the molecular weight of glucose (C6H12O6).

c_atoms = 6h_atoms = 12o_atoms = 6n_atoms = 0s_atoms = 0
  1. 01C contribution: 6 × 12.011 = 72.066
  2. 02H contribution: 12 × 1.008 = 12.096
  3. 03O contribution: 6 × 15.999 = 95.994
  4. 04MW = 72.066 + 12.096 + 95.994 = 180.156 g/mol

Ready to run the numbers?

Open Molecular Weight Calculator