Empirical formula calculator
Enter the composition, get the formula.
How do I find an empirical formula?
Turn each percent (treated as grams in 100 g) into moles by dividing by the atomic weight, divide all by the smallest, and round to whole numbers. 40.0% C, 6.7% H and 53.3% O give 1 : 2 : 1 — CH2O.
How do I get the molecular formula?
Divide the molar mass by the empirical formula mass and multiply the subscripts: glucose, 180.16 g/mol ÷ 30.03 = 6, so C6H12O6.
What if the ratios are not whole numbers?
Multiply them all by a small number until they are: a ratio of 1 : 1.5 becomes 2 : 3. The calculator tries multipliers up to 10.
Can I enter grams instead of percents?
Yes — masses from an experiment work the same way, since only the ratios matter. 69.94 g Fe and 30.06 g O give Fe2O3.
Which atomic weights are used?
The 2024 standard atomic weights from IUPAC, the same as in the molar mass calculator.
What if one element is missing from the analysis?
Oxygen is often not measured directly. If the percents of the other elements add up to less than 100, the remainder is the mass of the missing element, which you can enter as its own line.
Why can several compounds share one empirical formula?
The empirical formula gives only the simplest whole-number ratio. Formaldehyde (CH₂O), acetic acid (C₂H₄O₂) and glucose (C₆H₁₂O₆) all reduce to CH₂O, which is why a molar mass is needed to tell them apart (OpenStax Chemistry 2e, section 3.2).
How close to a whole number does a ratio have to be?
The textbook treats values such as 4.998 and 6.994 as 5 and 7, within a few thousandths. This calculator accepts a ratio that lands within 0.1 of a whole number, trying multipliers from 1 to 10. A value like 2.5 or 1.33 is never rounded; it is multiplied by 2 or 3 first, and if nothing small works the calculator says so, which usually means a typing error or an unmeasured element.
The method, step by step
Percent composition can be read directly as grams in a 100 g sample (OpenStax Chemistry 2e, section 3.2). Divide each element’s mass by its atomic weight to get moles, divide all the mole values by the smallest one, and look for whole numbers. If a ratio is not close to a whole number, multiply all of them by the same small integer, such as 2 for a .5, to reach the smallest whole-number set. The subscripts of the empirical formula are those numbers. To get the molecular formula, divide the molar mass of the compound by the formula mass of the empirical formula; the result n is the factor that multiplies every subscript.
Worked examples
Nicotine (OpenStax Example 3.13) is 74.02% carbon, 8.710% hydrogen and 17.27% nitrogen, and 40.57 g of it holds 0.2500 mol. The mole ratios, with nitrogen as 1, come out as 5.00 C, 7.01 H and 1 N, so the empirical formula is C₅H₇N with a formula mass of 81.12. The molar mass is 40.57 ÷ 0.2500 = 162.3 g/mol, which is 2 times the empirical mass, so the molecular formula is C₁₀H₁₄N₂. A fractional case from the same section: 0.130 g of nitrogen and 0.370 g of oxygen give a ratio of 1 : 2.49; doubling gives N₂O₅. Hematite, 34.97 g of iron and 15.03 g of oxygen, gives 1 : 1.50, hence Fe₂O₃.
Common mistakes
The classic error is rounding a ratio such as 1.5 or 1.33 to the nearest whole number instead of multiplying through; that produces a wrong formula, for example FeO instead of Fe₂O₃. A second is dividing by the atomic number instead of the atomic weight, or using percentages that do not add up to 100, which silently drops an element. A third is stopping at the empirical formula when the question asks for the molecular one, or applying the multiplier n to only some of the subscripts. Finally, round the moles as late as possible, because rounding early can push a ratio away from the whole number it should reach.
Sources: OpenStax Chemistry 2e, section 3.2 “Determining Empirical and Molecular Formulas” (method, Examples 3.11 and 3.13); atomic weights from IUPAC CIAAW. Related: grams to moles calculator, stoichiometry calculator, percent yield calculator and average atomic mass calculator.