Audited ·Last updated 29 Jul 2026·6 citations·Tier 1·0 uses

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

Data entered as
One element per entry: symbol then value. Separate with commas, semicolons or new lines; a colon, an equals sign or a % sign are all accepted. Symbols are case-sensitive — Co is cobalt, Cu is copper. Leave an element out entirely if it is absent.
Optional. Supply it and the calculator also returns the MOLECULAR formula, by rounding molar mass ÷ empirical formula mass to the nearest whole number. Leave it at 0 if you only want the empirical formula.
g/mol
How far the search goes when clearing the ratios to whole numbers. Twelve covers essentially every real empirical formula; raise it only if your ratios genuinely need a large multiplier, and watch the 'worst subscript deviation' output to judge the fit.
Empirical formula
CH2O
The simplest whole-number ratio of atoms, written in the Hill system (carbon first, hydrogen second, everything else alphabetically). This is what analysis alone can tell you — it does not distinguish CH2O from C6H12O6.
Empirical formula mass
30.026 g/mol
Molecular formula
C6H12O6
Multiplier (n)
6
Elements entered
3
Total entered
100
Worst subscript deviation
0.0011

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.

  1. Choose whether your numbers are mass percentages or element masses in grams. The maths is the same; only the 100% total check differs.
  2. 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.
  3. Check that symbols are capitalised correctly. Co is cobalt, Cu is copper, and 'carbon' spelled out will be rejected.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.

nᵢ = mᵢ ÷ Aᵢ → rᵢ = nᵢ ÷ min(n) → subscript = round(rᵢ × k)

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.

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⁻⁶.

input Basispercent
max Multiplier12
compositionC 40.00, H 6.71, O 53.29
molar Mass180.16

Frequently asked questions.

What is the difference between an empirical formula and a molecular formula?
An empirical formula gives the simplest whole-number ratio of atoms; a molecular formula gives the actual number of atoms in one molecule. The molecular formula is always the empirical formula multiplied by some whole number n. Glucose has the empirical formula CH₂O and the molecular formula C₆H₁₂O₆, so n = 6. Elemental analysis alone can only ever give you the empirical formula, because composition is a ratio and a ratio cannot count molecules. To get n you need one more measurement — the molar mass, usually from mass spectrometry — and then n = molar mass ÷ empirical formula mass, rounded to the nearest whole number: 180.16 ÷ 30.026 = 6.0001, so n = 6. For ionic compounds like NaCl and Fe₂O₃ there are no discrete molecules at all, so the empirical formula IS the formula, and asking for a molecular formula is a category error.
How do I find an empirical formula from percent composition?
Assume a 100 g sample, which makes each percentage a mass in grams directly. Divide each mass by that element's atomic weight to get moles. Divide every result by the smallest of them. Then multiply through by the smallest whole number that turns every ratio into a whole number. For 40.00 % C, 6.71 % H, 53.29 % O: moles are 3.330281, 6.656746 and 3.330833; dividing by the smallest gives 1.000, 1.999 and 1.000; those are already whole within tolerance, so the formula is CH₂O. The trick that catches people is step four — a ratio of 1.5 does not round to 2, it means you should double everything.
My ratios came out as 1 : 1.5. What do I do?
Multiply everything by 2, giving 2 : 3. A ratio of 1.5 is 3/2 and must never be rounded to 2 — that is the single most common error in this calculation and it produces a formula that does not exist. The same applies to other common fractions: 1.33 means multiply by 3 (giving 4:3), 1.25 means multiply by 4 (5:4), and 1.2 means multiply by 5 (6:5). This calculator does that search automatically, trying multipliers from 1 up to your ceiling and taking the first one that turns every ratio into a whole number within tolerance. The hematite example is the canonical case: 34.97 g Fe with 15.03 g O gives ratios of 1.000 and 1.500, which at a multiplier of 2 become 2.000 and 3.000 — Fe₂O₃, not FeO₂.
Why do my percentages not add up to 100?
Two common reasons. The first is simple rounding in the reported figures — 40.0 + 6.71 + 53.28 = 99.99, which this calculator accepts because the tolerance is ±2 percentage points. The second, and far more important, is a missing element. Combustion analysis measures carbon and hydrogen directly, from the CO₂ and H₂O collected, but it does not measure oxygen at all. Oxygen is found BY DIFFERENCE: whatever mass of the sample is not accounted for by the other elements is assumed to be oxygen. If your percentages come to 46.7, add oxygen as 53.3 and the analysis closes. The error message on this page gives you that number explicitly. If your figures really are grams rather than percentages, switch the basis to element masses and the total check goes away.
What does 'worst subscript deviation' tell me?
It is how far the least whole-number-like ratio sat from a whole number just before it was rounded, and it is your fit-quality check. For the glucose example it reads 0.0011, meaning the worst element (hydrogen, at 1.9989 against 2) was off by about one part in two thousand — the data support CH₂O cleanly. A value near zero means the composition is consistent with the formula shown. A value approaching or above 0.05 means the rounding did real work, and the formula should be treated as a suggestion rather than a result: re-check the analysis, consider whether an element is missing, or try a larger multiplier ceiling. Reporting this number is the honest alternative to silently rounding whatever comes out.
Why is ammonium nitrate written H4N2O3 instead of NH4NO3?
Because the output uses the Hill system, which is an INDEXING convention rather than a structural one: carbon first, hydrogen second, then all other elements alphabetically, and for carbon-free compounds every element alphabetically with hydrogen in its alphabetical place. H comes before N which comes before O, so ammonium nitrate indexes as H₄N₂O₃. The order carries no chemical meaning at all — it exists so that formulas can be sorted and searched consistently, which is exactly why Edwin Hill proposed it in 1900 for the US Patent Office's chemical index and why Chemical Abstracts and IUPAC formula indexes still use it. Write NH₄NO₃ when you want to show that the compound is an ammonium salt of nitric acid; write H₄N₂O₃ when you want to look it up.
Can two different compounds have the same empirical formula?
Constantly, and this is the fundamental limit of the method. CH₂O is the empirical formula of formaldehyde (CH₂O), acetic acid (C₂H₄O₂), glycolaldehyde (C₂H₄O₂ as well — an isomer of acetic acid), lactic acid (C₃H₆O₃), ribose (C₅H₁₀O₅) and glucose (C₆H₁₂O₆). Even fixing the molecular formula does not identify a compound: C₆H₁₂O₆ covers glucose, fructose, galactose and mannose, which differ only in stereochemistry and behave completely differently in biology. An empirical formula narrows the field; it never closes it. Identification needs a molar mass from mass spectrometry to fix n, and then NMR, IR or crystallography to fix the connectivity and stereochemistry.
Where do the atomic weights come from, and does the revision matter?
From the CIAAW Abridged Standard Atomic Weights 2024 table — the IUPAC Commission on Isotopic Abundances and Atomic Weights recommendation published as Atomic Weights 2021 (Pure Appl. Chem. 93(5), 573), with the 2024 revisions to gadolinium, lutetium and zirconium. These are conventional single values rather than the intervals CIAAW publishes for the fourteen elements whose isotopic composition varies measurably by source. The revision does matter at the fourth significant figure: lithium is 6.94 in the current table rather than the 6.941 that pre-2009 textbooks print, ytterbium is 173.05 rather than 173.04, and zirconium became 91.222 in 2024. For a two-element ratio those differences are far below the tolerance used here, but they will shift a computed empirical formula mass in the fourth digit — which is why this page reports the empirical formula mass of C₅H₇N as 81.118 g/mol where OpenStax prints 81.13. Both round the same way and give the same multiplier of 2 for nicotine; the difference is only which atomic-weight revision and how many figures were carried. Elements with no standard atomic weight at all — technetium, promethium, polonium, astatine, radon, francium, radium, actinium and the transuranics — are refused with an explicit error rather than given an invented value.
What if the molar mass divided by the empirical formula mass is not close to a whole number?
Something is wrong with one of the two inputs, and the calculator will still round because it has no way to refuse gracefully — which is why the raw multiplier is shown as its own output. If 180.16 ÷ 30.026 gives 6.0001 you can be confident. If it gives 5.7 you should not accept a molecular formula of C₆H₁₂O₆: either the molar mass is wrong (a mass-spectrometry peak misassigned, or a sodium adduct rather than the molecular ion), or the composition is wrong (an element missing, or a contaminated sample), or the empirical formula the composition implied is itself wrong — check the 'worst subscript deviation' first. One hard limit is enforced: if the molar mass is less than half the empirical formula mass, the input is refused outright, because a molecule cannot be lighter than its own empirical unit.
Does this work for hydrates and for ionic compounds?
For ionic compounds, yes and it is the natural tool — there are no molecules, so the empirical formula IS the formula, and you should leave the molar mass at 0 rather than asking for a molecular formula that does not exist. For hydrates, enter the analysis of the hydrated solid and you will get the combined formula: copper(II) sulfate pentahydrate analyses as CuSO₄·5H₂O, whose empirical formula in Hill order is CuH₁₀O₉S (no carbon, so every element sorts alphabetically and Cu comes before H). That is correct but not useful, because the whole point of the hydrate notation is to separate the salt from its waters of crystallisation, and composition data cannot make that separation — the water is chemically indistinguishable from any other source of H and O in the sample. The standard experiment for hydrates is different: heat the solid to constant mass, and the mass lost is the water.

References& sources.

  1. [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. [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. [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. [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. [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. [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
Coming soon