About the Molecular Formula Calculator
This molecular formula calculator finds the actual formula of a compound from its empirical (simplest-ratio) formula and its measured molar mass. It divides the molar mass by the empirical formula mass, rounds to the nearest whole number n, and multiplies every subscript by n — so CH2O with a molar mass of 180 g/mol becomes C6H12O6.
If you only have elemental analysis data, switch to percent composition: enter up to four elements with their mass percentages and the calculator first derives the empirical formula (assuming 100 g of sample, converting grams to moles and dividing by the smallest), then scales it to the molecular formula. This is the standard two-step method taught in general chemistry.
Atomic weights are IUPAC 2024 abridged standard values. The deviation figure tells you how far the measured molar mass is from an exact multiple of the empirical mass; a large deviation usually means a typo, a rounding problem in the percentages or a wrong empirical formula.
How to use the molecular formula calculator
- 1Choose whether you have an empirical formula or percent composition.
- 2Type the empirical formula, or enter each element with its mass percentage.
- 3Enter the measured molar mass in g/mol.
- 4Read the molecular formula and the multiplier n.
- 5Check the deviation — it should be within about 1% for a reliable answer.
Formula and method
The empirical formula gives only the simplest whole-number ratio of atoms. Its formula mass is the sum of the atomic weights in that ratio. Dividing the experimentally measured molar mass (from mass spectrometry, freezing-point depression or gas density) by the empirical mass gives a number that should be very close to an integer n; multiplying each subscript by n gives the molecular formula.
In percent-composition mode the calculator assumes a 100 g sample, so each percentage becomes grams. Grams ÷ atomic weight gives moles, and dividing every mole value by the smallest gives the atom ratio. If a ratio ends in about .5, .33 or .25, all ratios are multiplied by 2, 3 or 4 (up to 12) to reach whole numbers before scaling by n.
- n
- Whole-number multiplier
- M_measured
- Experimental molar mass of the compound (g/mol)
- M_empirical
- Formula mass of the empirical formula (g/mol)
Worked examples
CH2O with molar mass 180.16 g/mol
The empirical mass of CH2O is 12.011 + 2 × 1.008 + 15.999 = 30.026 g/mol. 180.16 ÷ 30.026 = 6.00, so n = 6 and the molecular formula is C6H12O6 (glucose).
Benzene: CH with molar mass 78.11 g/mol
CH has a formula mass of 13.019 g/mol. 78.11 ÷ 13.019 ≈ 6.00, so the molecular formula is C6H6, with a formula mass of 78.114 g/mol.
Percent composition: 85.63% C, 14.37% H, molar mass 56.11
In 100 g there are 85.63 ÷ 12.011 = 7.129 mol C and 14.37 ÷ 1.008 = 14.256 mol H, a 1 : 2.00 ratio, so the empirical formula is CH2 (14.027 g/mol). 56.11 ÷ 14.027 = 4.00, giving C4H8 (a butene).
Frequently asked questions
What is the difference between empirical and molecular formulas?+
The empirical formula is the simplest whole-number ratio of atoms (CH2O), while the molecular formula shows the actual number of atoms in one molecule (C6H12O6). The molecular formula is always a whole-number multiple of the empirical formula.
How do I find the molecular formula from the empirical formula?+
Calculate the empirical formula mass, divide the compound’s molar mass by it, round to the nearest whole number n, and multiply every subscript in the empirical formula by n.
What if the ratio is not a whole number?+
Small deviations (for example 5.98 or 6.03) come from rounded data and can be rounded. A ratio such as 2.5 means the empirical formula itself is wrong or not fully reduced to whole numbers — double it and recheck.
Can the molecular formula be the same as the empirical formula?+
Yes. When n = 1 they are identical, as for water (H2O), carbon dioxide (CO2) or methane (CH4). Ionic compounds are normally described only by their empirical (formula unit) ratio.
Where does the molar mass come from?+
It must be measured experimentally, typically by mass spectrometry, or from colligative properties such as freezing-point depression, or from the ideal gas law using gas density. Composition data alone cannot tell you n.