Empirical Formula Calculator
Find the empirical formula from percent composition or element masses, and the molecular formula from a molar mass, with a fit check on every subscript.
Empirical Formula Calculator
Background.
An elemental analyser hands back percentages, not a formula. Suppose a white powder comes back as 40.00% carbon, 6.71% hydrogen and 53.29% oxygen. Converting those masses to moles shows the atoms sit in a ratio of one carbon to two hydrogens to one oxygen, so the empirical formula is CH₂O. That is as far as composition alone can go: formaldehyde, acetic acid, lactic acid, ribose and glucose all have that ratio, because each is a whole-number multiple of the same CH₂O unit. One more measurement, the molar mass, settles the multiple. 180.16 g/mol divided by the 30.026 g/mol of one CH₂O unit is 6, so the powder is C₆H₁₂O₆, a six-carbon sugar such as glucose.
The arithmetic is short, and the step that goes wrong is the last one. Real data never land exactly on whole numbers, so someone has to decide whether a ratio of 1.4998 means three-halves or a sloppy 1, and whether 2.25 means nine-quarters. Rounding too early throws the answer away: iron and oxygen in a 1 : 1.5 ratio is Fe₂O₃, and rounding the 1.5 up to 2 turns hematite into FeO₂. The search here tries whole-number multipliers from 1 upward, accepts the first that brings every subscript within a stated tolerance of a whole number, and then reports how far the worst subscript actually sat, so a shaky fit is visible rather than hidden.
Formulas are printed in Hill order, the indexing convention of Chemical Abstracts and IUPAC formula indexes, which is why ammonium nitrate appears as H₄N₂O₃ rather than the NH₄NO₃ you would draw. Atomic weights come from the current CIAAW abridged table.
What is empirical formula calculator?
IUPAC defines an empirical formula as the simplest formula that expresses a compound's composition: the element symbols with subscripts reduced to the smallest whole-number ratio. A molecular formula counts the atoms in one actual molecule and is always the empirical formula multiplied by a whole number n of 1 or more, so C₆H₁₂O₆, C₅H₁₀O₅ and C₃H₆O₃ all reduce to CH₂O. For ionic and network solids such as sodium chloride, iron(III) oxide or silica there are no discrete molecules, and the empirical formula is the formula. The empirical formula mass is the sum of the atomic weights in one empirical unit, 30.026 g/mol for CH₂O, and comparing it with a measured molar mass is how n is found. Neither formula says which atom is bonded to which; that takes spectroscopy or crystallography. Run the calculation the other way, from a formula to the percentage of each element, and you have percent composition; chemists who make a new compound compare the analyser's figures with that prediction as a check on purity.
How to use this calculator.
- Set Data entered as. Choose mass percentages for a percent composition, or element masses for grams measured in one sample, such as 34.97 g of iron that combined with 15.03 g of oxygen. Percentages must total 100 within 2 points; masses are not checked.
- Type the composition as symbol, then a space, colon or equals sign, then the value: C 40.00, H 6.71, O 53.29. Separate entries with commas, semicolons or new lines. C40 with no separator, a lower-case c, or a written-out name like carbon will not be read, and symbols are case-sensitive, so Co is cobalt.
- If your percentages fall short of 100, an element is missing, most often oxygen, which combustion analysis does not measure directly. Add it by difference; the error message quotes the exact figure.
- Enter the molar mass if you know it, typically from mass spectrometry, to get the molecular formula. Leave it at 0 to stop at the empirical formula, and always leave it at 0 for an ionic solid.
- Leave Largest multiplier to try at 12 unless the fit is poor; the search can go as high as 24.
- Read the formula, then the worst subscript deviation beside it before you trust it.
The formula.
Four steps take a composition to a formula. First, on a percent basis, imagine a 100 g sample, so 40.00% carbon is simply 40.00 g; on a mass basis the grams are used as entered. Second, convert each mass to moles: nᵢ = mᵢ ÷ Aᵢ, where Aᵢ is the standard atomic weight (C 12.011, H 1.008, O 15.999, N 14.007, Fe 55.845 g/mol). Third, divide every amount by the smallest, rᵢ = nᵢ ÷ min(n), which sets the least abundant element to exactly 1. Fourth, find the smallest whole number k for which every rᵢ × k is close enough to a whole number, and round those products to get the subscripts.
Close enough means |rᵢk − round(rᵢk)| ≤ max(0.05, 0.015 × round(rᵢk)): within 0.05 for ordinary subscripts, with a 1.5% allowance for big ones, because a small analytical error moves a large subscript further. In cholesterol, C₂₇H₄₆O, an oxygen figure 0.04 points low pushes hydrogen to 46.42; that is outside 0.05 but inside the 0.69 allowed at 46, so the formula still comes out right. The tolerance is a judgement, not a constant of nature. It is tight enough that a ratio of 1.5002 can never pass as a whole number at k = 1, and loose enough for real combustion data. If no k up to your ceiling passes, the best-fitting k is used anyway and the deviation output shows how poor the fit was.
For the molecular formula, n = M ÷ empirical formula mass, rounded half-up, and every subscript is multiplied by n. A molar mass below half the empirical formula mass is refused, since no molecule can be lighter than its own empirical unit. Elements without an IUPAC standard atomic weight (technetium, promethium, polonium through actinium, and everything beyond uranium) are not accepted, because there is no single value to divide by.
A worked example.
The glucose analysis is 40.00% C, 6.71% H and 53.29% O, with a measured molar mass of 180.16 g/mol. On a 100 g basis the moles are 40.00 ÷ 12.011 = 3.3303 for carbon, 6.71 ÷ 1.008 = 6.6567 for hydrogen and 53.29 ÷ 15.999 = 3.3308 for oxygen. Carbon is the smallest, so dividing through gives C 1, H 1.9989, O 1.0002. At k = 1 hydrogen is 0.0011 from 2 and oxygen 0.0002 from 1, both well inside 0.05, so the empirical formula is CH₂O and the worst subscript deviation reads 0.0011. One CH₂O unit weighs 12.011 + 2 × 1.008 + 15.999 = 30.026 g/mol, and 180.16 ÷ 30.026 = 6.0001, which rounds to n = 6: the molecular formula is C₆H₁₂O₆. Iron oxide shows why the multiplier search exists. Entered as masses, 34.97 g Fe and 15.03 g O are 0.6262 and 0.9394 mol, a ratio of 1 : 1.5002. At k = 1 the oxygen sits half a unit from any whole number, so k = 1 fails; at k = 2 the ratio becomes 2 : 3.0004, and the answer is Fe₂O₃ with a deviation of 0.0004.
Frequently asked questions.
My mole ratio came out as 1 : 1.5. Should I round it to 1 : 2?
Why won't my percentages add up to 100?
How should I read the worst subscript deviation?
Why does aspirin's formula need the multiplier ceiling above 3?
How does the molar mass turn the empirical formula into the molecular one?
Can two different compounds have the same formula?
Why is ammonium nitrate printed as H4N2O3 instead of NH4NO3?
Does the method work for ionic compounds and hydrates?
Which atomic weights are used, and why might a textbook answer differ slightly?
I have masses of carbon dioxide and water from combustion, not percentages. What do I enter?
References& sources.
- [1]Flowers, P., Theopold, K., Langley, R. & Robinson, W. R. (2019). Chemistry 2e, Section 3.2 'Determining Empirical and Molecular Formulas'. OpenStax, Rice University. Peer-reviewed, CC BY 4.0. PRIMARY SOURCE: the four-step derivation used here (100 g basis → moles → divide by the smallest → multiply to whole numbers) and Examples 3.11 (34.97 g Fe + 15.03 g O → Fe2O3), 3.12 (27.29 % C, 72.71 % O → CO2) and 3.13 (nicotine, 74.02 % C, 8.710 % H, 17.27 % N with M = 162.3 → C5H7N then C10H14N2), all of which this calculator reproduces. Retrieved 2026-07-29. Open access.
- [2]Hill, E. A. (1900). 'On a system of indexing chemical literature; adopted by the Classification Division of the U.S. Patent Office'. Journal of the American Chemical Society 22(8), 478–494, doi:10.1021/ja02046a005. The origin of the ordering convention used for every formula this calculator prints — carbon first, hydrogen second, all remaining elements alphabetically, and (for carbon-free compounds) every element alphabetically. OpenStax does not state an ordering rule, so this source was needed to fix one; it agrees with the order implemented here and is the convention adopted by Chemical Abstracts and by IUPAC formula indexes. Retrieved 2026-07-29. Publisher page paywalled; the record and abstract are open, and the convention is independently corroborated by the IUPAC Red Book entry cited below.
- [3]IUPAC. Compendium of Chemical Terminology (the Gold Book), 'empirical formula' (E02063), sourced there to Nomenclature of Inorganic Chemistry (the Red Book), p. 45: an empirical formula is 'formed by juxtaposition of the atomic symbols with their appropriate subscripts to give the simplest possible formula expressing the composition of a compound'. This is the definition this page states. Retrieved 2026-07-29 via the legacy IUPAC host (the current goldbook.iupac.org returns HTTP 403 to automated retrieval). Open access.
- [4]Meija, J. et al. (2021). 'Atomic weights of the elements 2021 (IUPAC Technical Report)'. Pure and Applied Chemistry 93(5), 573–600, doi:10.1515/pac-2019-0603, as maintained in the CIAAW table 'Abridged Standard Atomic Weights 2024' (named revision: 2024, incorporating the Gd, Lu and Zr revisions on the Atomic Weights 2021 base). The named, versioned source of every atomic weight used to convert masses to moles here — C 12.011, H 1.0080, O 15.999, N 14.007, Fe 55.845. Retrieved 2026-07-29. Open access.
- [5]IUPAC (2005). Nomenclature of Inorganic Chemistry: IUPAC Recommendations 2005 ('the Red Book'), Chapter IR-4 'Formulae', RSC Publishing. The governing text behind the Gold Book's empirical-formula definition and the source of the rule that formulae in indexes are ordered by the Hill system. Retrieved 2026-07-29. Bibliographic reference: a print and PDF edition rather than a live web page.
- [6]NIST Chemistry WebBook, Standard Reference Database Number 69, National Institute of Standards and Technology. Searchable by formula, molecular weight and name; used to confirm the molar masses and molecular formulas quoted in this page's examples (glucose C6H12O6 180.16 g/mol; nicotine C10H14N2 162.23 g/mol; caffeine C8H10N4O2 194.19 g/mol; aspirin C9H8O4 180.16 g/mol). Retrieved 2026-07-29. Open access.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 6 cited below
- Method
- nᵢ = mᵢ ÷ Aᵢ → rᵢ = nᵢ ÷ min(n) → subscript = round(rᵢ × k)
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled