Empirical Formula Calculator
Turn percent composition or element masses into an empirical formula, and into the molecular formula when you know the molar mass. Shows every ratio step.
Empirical Formula Calculator
Background.
An empirical formula is the simplest whole-number ratio of atoms in a compound — CH₂O for glucose, not C₆H₁₂O₆. It is what elemental analysis actually measures, because burning or dissolving a sample tells you how much of each element is present but nothing about how many of those units are joined into one molecule. This calculator takes a percent composition or a set of element masses and returns the empirical formula, and if you also supply the molar mass, the molecular formula.
The derivation is four steps and each one is shown in the outputs so you can check the work. First, if the data are percentages, take a 100 gram basis — then 40.00 percent carbon simply means 40.00 grams of carbon, and no conversion is needed at all. Second, divide each mass by that element's standard atomic weight to get moles. Third, divide every mole figure by the smallest of them, which puts the ratios on a scale where the least abundant element is 1. Fourth, multiply through by the smallest whole number that turns every ratio into a whole number. Those whole numbers are the subscripts.
WHY THE LAST STEP NEEDS A TOLERANCE, and what this page does about it. Real analytical data never give exactly 1.500 or exactly 2.000. The classic worked example — 34.97 g of iron with 15.03 g of oxygen — gives an oxygen-to-iron ratio of 1.5002, and the whole calculation turns on that being read as 3/2 rather than rounded to 2. This calculator accepts a candidate multiplier when every scaled ratio sits within 0.05 of a whole number, with a 1.5 percent relative allowance on top for large subscripts where analytical error accumulates. That tolerance is a declared judgement, not a physical constant, and it is stated here rather than hidden: it rejects 1.5002 at a multiplier of 1 (correctly giving Fe₂O₃) while accepting the genuine scatter in combustion data. The 'worst subscript deviation' output tells you how far the least whole-number-like ratio actually sat, so a poor fit is visible instead of silent. Anything above about 0.05 there means the formula on screen should be treated as a suggestion.
UNITS AND CONVENTIONS. Masses go in as grams and percentages as percentage points; the molar mass is in g/mol; the empirical formula mass comes back in g/mol; the multiplier, element count and deviation are dimensionless. There is no temperature or pressure basis: a composition is a ratio of amounts and is independent of both. Atomic weights come from the CIAAW Abridged Standard Atomic Weights 2024 table — the IUPAC Atomic Weights 2021 recommendation with the 2024 revisions to gadolinium, lutetium and zirconium. Elements with no IUPAC standard atomic weight (technetium, promethium, polonium, astatine, radon, francium, radium, actinium and everything heavier than uranium) are refused with an explicit error rather than given an invented value.
OUTPUT FORMAT. Formulas are written in the Hill system: carbon first, hydrogen second, then every other element in alphabetical order; carbon-free compounds are alphabetical throughout, with hydrogen taking its alphabetical place. That is why ammonium nitrate comes out as H₄N₂O₃ rather than the NH₄NO₃ you would write structurally. The Hill order dates to a 1900 indexing scheme adopted by the US Patent Office and is now the convention used by Chemical Abstracts and by IUPAC for formula indexes. An empirical formula carries no structural information at all — it cannot tell you which atom is bonded to which, and CH₂O is equally the empirical formula of formaldehyde, acetic acid, lactic acid, ribose and glucose.
THE PERCENT-SUM CHECK, and the most common reason it fires. On a percent basis the entries must total 100 ± 2 percentage points. If yours come to, say, 46.7, the usual cause is a missing element — most often oxygen, which combustion analysis does not measure directly and which is normally found by difference as 100 minus everything else. The error message tells you the exact number to add. If your figures really are grams rather than percentages, switch the basis to element masses, where no sum constraint applies. That check is the only behavioural difference between the two modes; the arithmetic is identical, because a percent composition is nothing more than a 100 gram sample.
ON ROUNDING. Moles and ratios are carried at full arbitrary precision throughout. Rounding to whole-number subscripts happens once, at the final step, after multiplying by the chosen multiplier — never on the intermediate ratios, which is a real source of wrong answers when the arithmetic is done by hand with a four-figure calculator.
What is empirical formula calculator?
IUPAC defines an empirical formula as one 'formed by juxtaposition of the atomic symbols with their appropriate subscripts to give the simplest possible formula expressing the composition of a compound' (Gold Book, sourced to the Red Book, p. 45). The key word is SIMPLEST: the subscripts are reduced to their lowest whole-number ratio, so C₆H₁₂O₆, C₅H₁₀O₅, C₃H₆O₃ and CH₂O all share the empirical formula CH₂O. A MOLECULAR formula, by contrast, gives the actual number of atoms in one molecule, and is always the empirical formula multiplied by some whole number n ≥ 1. Recovering n requires one extra piece of information that composition alone can never supply: the molar mass. Divide the true molar mass by the empirical formula mass and round to the nearest whole number. For glucose, 180.16 ÷ 30.026 = 6.0001, so n = 6 and the molecular formula is C₆H₁₂O₆. Neither formula says anything about structure. CH₂O is the empirical formula of formaldehyde (which is CH₂O molecularly), acetic acid (C₂H₄O₂), lactic acid (C₃H₆O₃), ribose (C₅H₁₀O₅) and glucose (C₆H₁₂O₆) alike — five different substances with completely different chemistry and, in three cases, the same molecular formula as each other's isomers. Elemental analysis is a composition measurement, and composition is a coarse fingerprint: it narrows the field but does not identify a compound. Determining which of the candidates you actually have needs mass spectrometry for the molar mass and spectroscopy or crystallography for the connectivity.
How to use this calculator.
- Choose whether your numbers are mass percentages or element masses in grams. The maths is the same; only the 100% total check differs.
- Type the composition as symbol-then-value pairs: 'C 40.00, H 6.71, O 53.29'. Commas, semicolons and new lines all work as separators, and a colon, equals sign or % sign after the symbol is fine.
- Check that symbols are capitalised correctly. Co is cobalt, Cu is copper, and 'carbon' spelled out will be rejected.
- If you are working from combustion data and the percentages do not reach 100, the missing part is usually oxygen. Add it as 100 minus the sum of everything else — the error message gives you the exact figure.
- Enter the molar mass if you know it, to get the molecular formula as well. Leave it at 0 to stop at the empirical formula.
- Read the empirical formula at the top, then check the 'worst subscript deviation' below. Near zero means the data cleanly support that formula; above about 0.05 means treat it as a guess.
- If the formula looks wrong, check the multiplier: raising 'largest multiplier to try' lets the search reach ratios like 9:8:4 that need a multiplier of 4 or more.
- Remember what you have. An empirical formula is a ratio, not an identification — CH2O fits formaldehyde, acetic acid, lactic acid, ribose and glucose equally well.
The formula.
STEP 1 — get to grams. On a percent basis, assume a 100 g sample; then a mass percentage and a mass in grams are numerically identical and no conversion is needed. This is why the two input modes differ only in whether the total is checked.
STEP 2 — grams to moles. nᵢ = mᵢ / Aᵢ, where Aᵢ is the standard atomic weight from the CIAAW Abridged Standard Atomic Weights 2024 table. Dimensionally g ÷ (g/mol) = mol.
STEP 3 — normalise. rᵢ = nᵢ / min(n). Dividing by the smallest amount makes the least abundant element exactly 1 and every other ratio at least 1. The ratios are dimensionless.
STEP 4 — clear to whole numbers. Find the smallest whole k from 1 up to your ceiling such that every rᵢ × k is close enough to a whole number. 'Close enough' is defined here as |rᵢ×k − round(rᵢ×k)| ≤ max(0.05, 0.015 × round(rᵢ×k)) — an absolute floor of 0.05 with a 1.5 percent relative allowance for large subscripts, where the accumulated analytical error is proportionally larger. This is a declared judgement parameter, not a physical constant. It is tight enough to reject the trap case (a ratio of 1.5002 must not be rounded to 2 at k = 1) and loose enough to accept honest combustion data. If no k in range qualifies, the best-fitting k is used and the 'worst subscript deviation' output makes the poor fit obvious.
STEP 5 — the molecular formula, if a molar mass M is supplied. n = round(M / empirical formula mass), and every subscript is multiplied by n. If M is less than half the empirical formula mass the input is refused, because a molecule can never be lighter than its own empirical unit. The rounding here is half-up, so a raw ratio of exactly 1.5 becomes 2.
ROUNDING STAGE. Moles and ratios are carried at arbitrary decimal precision. Rounding to whole-number subscripts happens ONCE, at step 4, after multiplying by k — never on the intermediate ratios. Doing it earlier is a genuine source of wrong answers when the calculation is done by hand: rounding 1.5002 to 1.50 is harmless, but rounding it to 2 before looking for a multiplier destroys the answer. Every numeric output is rounded once more at the return boundary, to ten decimal places.
HILL ORDERING. The output formula follows the Hill system: carbon first, hydrogen second, then all remaining elements alphabetically; for carbon-free compounds, every element alphabetically, hydrogen included. Ammonium nitrate therefore appears as H₄N₂O₃, not NH₄NO₃, because Hill ordering is an indexing convention and carries no structural meaning. The convention comes from Edwin Hill's 1900 indexing scheme for the US Patent Office and is now standard in Chemical Abstracts and IUPAC formula indexes.
INVALID DOMAIN. An empty composition, an unreadable entry, an unknown or duplicated element symbol, a zero or negative value, a negative molar mass, a multiplier ceiling outside 1–24, a percent total outside 100 ± 2, and a molar mass below half the empirical formula mass each raise a field error naming the specific problem. Elements with no IUPAC standard atomic weight are refused rather than guessed.
A worked example.
Worked example — glucose from elemental analysis. A sample analyses as 40.00 % carbon, 6.71 % hydrogen and 53.29 % oxygen, and mass spectrometry gives a molar mass of 180.16 g/mol. STEP 1: the percentages total 100.00, so take a 100 g basis — 40.00 g C, 6.71 g H, 53.29 g O. STEP 2: divide by the CIAAW 2024 atomic weights. n(C) = 40.00 / 12.011 = 3.330281 mol; n(H) = 6.71 / 1.008 = 6.656746 mol; n(O) = 53.29 / 15.999 = 3.330833 mol. STEP 3: the smallest is carbon at 3.330281, so the ratios are C 1.000000, H 1.998854, O 1.000166. STEP 4: at a multiplier of k = 1 every ratio is already within 0.05 of a whole number — hydrogen is 0.001146 away from 2 and oxygen 0.000166 away from 1 — so k = 1 is accepted and the subscripts are C₁H₂O₁, written CH₂O. The 'worst subscript deviation' output reads 0.0011, which is reassuringly small. The empirical formula mass is 12.011 + 2 × 1.008 + 15.999 = 30.026 g/mol. STEP 5: 180.16 / 30.026 = 6.0001, which rounds to a multiplier of 6, so the molecular formula is C₆H₁₂O₆. Now a case that shows why the tolerance matters. Switch the basis to element masses and enter 'Fe 34.97, O 15.03' — the hematite analysis. The moles are 0.626197 and 0.939434, giving ratios Fe 1.000000 and O 1.500219. At k = 1 oxygen would have to round to 2, and it sits 0.500 away, far outside tolerance, so k = 1 is rejected. At k = 2 the ratios become 2.000000 and 3.000439, both within 0.0005 of a whole number, and the answer is Fe₂O₃. A calculator that rounded 1.5002 to 2 at the first step would have returned FeO₂, which is not a compound. Finally, a case that needs a bigger multiplier: the exact percent composition of aspirin (60.00200 % C, 4.47605 % H, 35.52196 % O) gives mole ratios of C 2.25, H 2.00, O 1.00, and the search has to reach k = 4 before every subscript clears — returning C₉H₈O₄, with a worst deviation below 10⁻⁶.
Frequently asked questions.
What is the difference between an empirical formula and a molecular formula?
How do I find an empirical formula from percent composition?
My ratios came out as 1 : 1.5. What do I do?
Why do my percentages not add up to 100?
What does 'worst subscript deviation' tell me?
Why is ammonium nitrate written H4N2O3 instead of NH4NO3?
Can two different compounds have the same empirical formula?
Where do the atomic weights come from, and does the revision matter?
What if the molar mass divided by the empirical formula mass is not close to a whole number?
Does this work for hydrates and for ionic compounds?
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 are asserted in this calculator's test suite. 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. SECOND, INDEPENDENT AUTHORITY consulted for this page: 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.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 682 calculators remain free
- No billing is enabled