Empirical and Molecular Formula Calculator (from Percent Composition)

An elemental analysis gives the percentage by mass of each element in a compound. This calculator turns those percentages, or the masses found in a sample, into the empirical formula (the simplest whole-number ratio of atoms) and, if you know the molar mass, the molecular formula.

Inputs

g/mol

Results

Empirical formula
CH2O
Molecular formula
C6H12O6
Empirical formula mass
30.03
g/mol
Molecular formula multiplier
6
Total of the percentages entered
100

    RefCHM-STO-002
    Methodmoles = mass/atomic weight; divide by the smallest; multiply to whole numbers
    UnitsSI
    Date2026-11-24

    Working

    Calculated in SI base units; inputs are converted from the units you choose.

    1. Moles of each elementn = mass/atomic weightC: 40 / 12.01 = 3.33; H: 6.71 / 1.008 = 6.657; O: 53.29 / 16 = 3.331
    2. Divide by the smallestratio = n/n_minC 1, H 1.999, O 1
    3. Whole numbersmultiply by the smallest factor that gives whole numbers× 1: C 1, H 1.999, O 1 → CH2O
    4. Molecular formulamultiplier = M / empirical formula mass180.2 / 30.03 = 6 ≈ 6 → C6H12O6

    Mole ratios

    ElementMass (g per 100 g or as entered)MolesRatioRatio × 1Subscript
    C403.3303111
    H6.716.65671.9991.9992
    O53.293.3308111

    From percentages to a formula

    Treat the percentages as grams in a 100 g sample and divide each by the element’s atomic weight to get moles. Dividing by the smallest number of moles gives the atom ratio; ratios close to 1.5, 1.33 or 1.25 mean the whole set must be multiplied by 2, 3 or 4. The molecular formula is a whole-number multiple of the empirical formula, found by dividing the measured molar mass by the empirical formula mass. Glucose, C₆H₁₂O₆, and formaldehyde, CH₂O, share the same empirical formula.

    Assumptions and limits

    • Atomic weights from the CIAAW standard atomic weights.
    • Analytical percentages accurate to about ±0.3 %; poor data may give the wrong whole numbers.
    • Formulas are written in Hill order (C, H, then alphabetical).

    References

    • Prohaska, T. et al. (2022), Standard atomic weights of the elements 2021 (IUPAC Technical Report), Pure and Applied Chemistry 94, 573–600.
    • Atkins, P., Jones, L. and Laverman, L., Chemical Principles: The Quest for Insight, 7th ed., W. H. Freeman, 2016, Fundamentals section on determining chemical formulas.

    Questions

    What is the formula of a compound with 40.00 % C, 6.71 % H and 53.29 % O and molar mass 180.16 g/mol?
    The empirical formula is CH₂O (30.026 g/mol), and the molecular formula is C₆H₁₂O₆, glucose.
    An iron oxide is 72.36 % iron. What is its formula?
    With 27.64 % oxygen the mole ratio O/Fe is 1.333, which times 3 gives Fe₃O₄ (magnetite).

    This calculator is a design aid. Check results against the governing code or standard and have critical work verified by a qualified engineer. Read the disclaimer.