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

Frequently Asked Questions

What is the difference between molecular weight and formula weight?

Molecular weight applies to discrete molecules. Formula weight applies to ionic compounds like NaCl, which form lattices rather than molecules. The calculation method is the same.

Why are atomic weights not whole numbers?

Atomic weights reflect the natural isotopic distribution. Carbon is mostly C-12 but contains some C-13, giving an average atomic weight of 12.011. Only pure isotopes have near-integer masses.

How is molecular weight used in lab work?

To convert between moles and grams: grams = moles × MW. To prepare a 1 M solution, dissolve one MW worth of grams in enough solvent to make 1 liter.

Ready to run the numbers?

Open Molecular Weight Calculator