Empirical and molecular formula calculator

Enter each element with its mass percent or its mass in grams, such as C 40, H 6.71, O 53.29. The calculator converts to moles, finds the smallest whole-number ratio and writes the empirical formula. Add the molar mass to get the molecular formula.

Element symbol and amount, such as C 40, H 6.71, O 53.29. Separate the pairs with commas, spaces or semicolons.
Fill in to get the molecular formula.
Empirical formulaCH₂O
Molecular formulaC₆H₁₂O₆
Empirical formula mass
30.026 g/mol
Multiplier n
180.16 ÷ 30.026 ≈ 6
Molecular formula mass
180.156 g/mol
C
40 % ÷ 12.011 = 3.3303 mol → 1 → 1
H
6.71 % ÷ 1.008 = 6.6567 mol → 1.999 → 2
O
53.29 % ÷ 15.999 = 3.3308 mol → 1 → 1

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Enter each element symbol followed by its amount, for example C 40, H 6.71, O 53.29.
  2. Choose whether the amounts are mass percent or grams.
  3. Optionally enter the molar mass to get the molecular formula.
  4. Read the formula and the step for each element: amount ÷ atomic weight = moles → ratio → whole number.

How it works

  1. Moles of each element = amount ÷ atomic weight (percentages are treated as grams of a 100 g sample).
  2. Each number of moles is divided by the smallest one.
  3. If the ratios are not whole numbers, they are multiplied by the smallest number from 1 to 12 that brings every ratio within 0.1 of a whole number.
  4. The formula is written in Hill order: C first, then H, then the other elements alphabetically (alphabetically throughout if there is no carbon).
  5. Molecular formula: n = molar mass ÷ empirical formula mass, rounded.

Atomic weights are the same as in the molar mass calculator.

Worked example

A compound is 40.0% C, 6.71% H and 53.29% O, with a molar mass of 180.16 g/mol:

  • C: 40 ÷ 12.011 = 3.3303 mol; H: 6.71 ÷ 1.008 = 6.6567 mol; O: 53.29 ÷ 15.999 = 3.3308 mol.
  • Divided by 3.3303: 1 : 1.999 : 1 → CH₂O, 30.026 g/mol.
  • 180.16 ÷ 30.026 ≈ 6, so the molecular formula is C₆H₁₂O₆ (glucose).

Common mistakes

  • Rounding too early. Keep three or four decimals in the mole ratios; 1.49 rounded to 1 gives the wrong formula.
  • Missing oxygen. Analyses often report only C, H and N; oxygen is the rest up to 100%.
  • Upper and lower case. Co is cobalt, CO is carbon and oxygen.

Frequently asked questions

What is an empirical formula?

The simplest whole-number ratio of atoms in a compound. Glucose, C₆H₁₂O₆, has the empirical formula CH₂O, because 6 : 12 : 6 reduces to 1 : 2 : 1.

How do you find the empirical formula from percentages?

Take 100 g, so each percentage becomes grams. Divide each by its atomic weight to get moles, divide all by the smallest number of moles, and multiply by 2, 3 or 4 if needed to reach whole numbers.

How do I get the molecular formula?

Divide the molar mass by the empirical formula mass and round to a whole number n. Multiply every subscript by n. For glucose, 180.16 ÷ 30.026 ≈ 6, so CH₂O becomes C₆H₁₂O₆.

What if a ratio comes out as 1.5 or 1.33?

Multiply all ratios by the number that makes them whole: 1.5 by 2, 1.33 by 3, 1.25 by 4. The calculator tries multipliers from 1 to 12 and accepts values within 0.1 of a whole number.

More in Math

All tools in this category: Math ·Updated November 4, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.