Molecular Formula Calculator

Turn an empirical formula and a molar mass into the full molecular formula.

Chemistry and LabUpdated 2026-11-192 min read
Molecular Formula Calculator
Element symbols start uppercase, for example CH2O or BH3. Optional subscripts follow each symbol.
Experimentally determined molar mass in grams per mole.
Molecular formula
...
Whole number multiplier...
Empirical formula mass...
Molar mass used...
Final atom counts...

What it does

An empirical formula gives the simplest whole number ratio of atoms in a compound. A molecular formula gives the actual counts. To move from one to the other you need the molar mass, which is usually measured by mass spectrometry.

This tool reads an empirical formula such as CH2O, computes its formula mass from a built in atomic weight table, divides the entered molar mass by that value, and rounds the quotient to a whole number. It then multiplies every subscript by that integer.

The page opens with CH2O and a molar mass of 180.16 grams per mole. The empirical formula mass is about 30.026 grams per mole, the ratio is very close to six, and the molecular formula is C6H12O6.

A ratio that is not close to a whole number means the two inputs do not describe the same compound. The tool reports that situation as an error rather than silently rounding a poor measurement.

The built in table covers common elements and reports the atomic weights used through the empirical mass result. Formulas must use standard capitalization so that CO and Co are not confused.

How to use

  1. Type the empirical formula using correct element capitalization.
  2. Include a subscript only when the count is greater than one.
  3. Enter the measured molar mass in grams per mole.
  4. Read the molecular formula as the main result.
  5. Check the multiplier and empirical mass to see the arithmetic.
  6. Use the atom counts row to confirm the final subscripts.

Formula

n = molar mass / empirical formula mass; molecular formula = n times every subscript in the empirical formula
n
A positive whole number multiplier, rounded from the mass ratio.
empirical formula mass
Sum of atomic weights multiplied by their subscripts.
molar mass
The experimentally measured mass of one mole of the compound.

Element symbols are parsed with an uppercase letter and optional lowercase letter, followed by an optional integer subscript. Atomic weights are the standard values used in introductory chemistry. A ratio within 0.15 of an integer is accepted, which allows for ordinary measurement error while still rejecting inconsistent inputs.

Worked example

Example: glucose from CH2O

The page opens with empirical formula CH2O and molar mass 180.16 g/mol.

  1. Read the subscripts as one carbon, two hydrogen and one oxygen.
  2. Carbon contributes 12.011, hydrogen contributes 2 times 1.008, and oxygen contributes 15.999.
  3. The empirical formula mass is 12.011 plus 2.016 plus 15.999, which is 30.026 g/mol.
  4. Divide 180.16 by 30.026 to get about 6.0005, which rounds to 6.
  5. Multiply every subscript by 6 to get C6H12O6.
  6. The tool reports multiplier 6, empirical mass 30.026 g/mol and molecular formula C6H12O6.

Reference table

Empirical and molecular formulas for familiar compounds
Empirical formulaMolar mass (g/mol)MultiplierMolecular formula
CH2O180.166C6H12O6
CH2O60.052C2H4O2
BH327.72B2H6
CH416.041CH4

Limits

  • Supports the elements in the built in weight table only.
  • Subscripts must be whole numbers from 1 to 1000.
  • The measured molar mass must be within 0.15 of a whole number multiple of the empirical mass.
  • The tool does not determine an empirical formula from percent composition.

Common mistakes

  • Writing CO when the compound contains cobalt, which is Co.
  • Forgetting that the same multiplier applies to every subscript.
  • Using percent composition as the molar mass input.
  • Accepting a ratio of 1.5 as a valid multiplier.
  • Entering a formula with a leading lowercase letter.

Try it yourself

Quick checks. Answers sit tucked under each question.

CH2O with molar mass 60.05 g/mol. Molecular formula?

C2H4O2. The multiplier is 2.

BH3 with molar mass 27.7 g/mol. Molecular formula?

B2H6. The empirical mass is 13.835 g/mol and the multiplier is 2.

CH4 with molar mass 16.04 g/mol. Molecular formula?

CH4. The multiplier is 1, so empirical and molecular formulas match.

Questions

What is the difference between empirical and molecular formulas?

The empirical formula gives the simplest ratio, while the molecular formula gives the actual atom counts.

What extra information do I need?

You need the molar mass of the compound, often measured by mass spectrometry.

Why is the multiplier a whole number?

Atoms come in whole numbers, so a valid molecular formula can only be an integer multiple of the empirical formula.

Can two compounds share an empirical formula?

Yes. Glucose and acetic acid both have the empirical formula CH2O but different molar masses.

What if the ratio is not close to an integer?

The inputs are inconsistent or the measurement is poor, and the tool reports an error.

Does the tool compute percent composition?

No. It converts an already known empirical formula into a molecular formula.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.