Empirical Formula Calculator

Simplest whole-number formula from percent composition, plus the molecular formula

Find the empirical formula from mass percentages or grams of up to five elements, with fractional ratios cleared automatically, and the molecular formula when the molar mass is known. Every step is shown.

ChemistryUpdated October 21, 2026Checked against 6 reference values

What this calculator does

An empirical formula gives the simplest whole-number ratio of atoms in a compound. This calculator finds it from elemental analysis results, entered as mass percentages or as grams of each element, for up to five elements. It converts each amount to moles, divides by the smallest, and multiplies through when needed to clear ratios such as 1.5 or 1.33.

If you also know the compound's molar mass, for example from mass spectrometry, the calculator scales the empirical formula up to the molecular formula. Each step is shown so you can follow the working, and a warning appears if your percentages do not add up to 100%. Formulas containing carbon are written in Hill order, carbon then hydrogen then the rest alphabetically; others keep the order you entered.

The method

moles = grams ÷ atomic mass

ratio = moles ÷ smallest moles

n = molar mass ÷ empirical formula mass

With percentages, assume a 100 g sample so each percentage becomes grams. Atomic masses are the IUPAC standard atomic weights. After dividing by the smallest number of moles, ratios within about 0.1 of a whole number are rounded. If one is clearly a fraction, all ratios are multiplied by the smallest whole number that clears it. The molecular formula is the empirical formula multiplied by n.

Worked examples

Glucose. 40.0% C, 6.71% H and 53.3% O give a mole ratio of 1 : 2 : 1, so the empirical formula is CH₂O. With a molar mass of 180.16 g/mol, n = 6 and the molecular formula is C₆H₁₂O₆.

Vitamin C. 40.92% C, 4.58% H and 54.50% O give 1 : 1.33 : 1, which becomes C₃H₄O₃ after multiplying by 3. Its molar mass of 176.12 g/mol gives C₆H₈O₆.

Rust. 69.94% Fe and 30.06% O give 1 : 1.5, doubled to Fe₂O₃.

Caffeine. Four elements give C₄H₅N₂O with a formula mass of 97.097 g/mol; at 194.19 g/mol the molecular formula is C₈H₁₀N₄O₂.

Clearing fractional ratios

Ratio ends inFix
x.5multiply by 2
x.33 or x.67multiply by 3
x.25 or x.75multiply by 4
x.2, x.4, x.6 or x.8multiply by 5
x.17 or x.83multiply by 6

Never round 1.5 to 2 or 1.33 to 1; that gives the wrong formula. The calculator tries multipliers up to 8.

Where the percentages come from

Combustion analysis burns a weighed sample in oxygen and measures the carbon dioxide and water produced, which give the carbon and hydrogen content. Nitrogen and sulfur are measured as their gases, and oxygen is usually found by difference, as 100% minus everything else. Modern CHN analyzers are accurate to about 0.3 percentage points, so ratios rarely come out as exact whole numbers. If the rounding looks ambiguous, compare the result with the molar mass or other evidence before trusting it.

Different compounds, same empirical formula

Many compounds share an empirical formula. Formaldehyde (CH₂O), acetic acid (C₂H₄O₂) and glucose (C₆H₁₂O₆) all reduce to CH₂O. Acetylene (C₂H₂) and benzene (C₆H₆) are both CH. Elemental analysis alone cannot tell these apart, which is why a molar mass measurement, or spectroscopy to see the structure, is needed to pin down the actual molecule. Even the molecular formula does not identify a compound uniquely: glucose and fructose are both C₆H₁₂O₆.

From combustion data to percentages

If your data are masses of carbon dioxide and water from burning a sample, convert them first. Carbon makes up 12.011 ÷ 44.009 = 27.29% of CO₂ by mass, so multiply the CO₂ mass by 0.2729 to get grams of carbon. Hydrogen makes up 2 × 1.008 ÷ 18.015 = 11.19% of water, so multiply the water mass by 0.1119 to get grams of hydrogen. Subtract both from the original sample mass to find oxygen when the compound contains only C, H and O. Enter those three masses here in grams mode and the calculator does the rest.

Empirical Formula Calculator: common questions

What is the difference between empirical and molecular formulas?

The empirical formula is the simplest whole-number ratio of atoms, such as CH₂O. The molecular formula is the actual number of atoms in one molecule, such as C₆H₁₂O₆ for glucose, which is a whole-number multiple of the empirical formula.

Why assume a 100 g sample?

It turns percentages directly into grams. 40% carbon becomes 40 g of carbon, which converts to moles. The sample size cancels out in the ratio, so any mass would work.

What if my ratios are not whole numbers?

Small deviations within about 0.1 come from measurement error and are rounded. Values near .5, .33, .25 or .2 mean you should multiply all ratios by 2, 3, 4 or 5. The calculator does this for you.

My percentages don't add up to 100. What now?

Usually an element was not measured, most often oxygen. Enter the remaining percentage as oxygen if the compound contains it, since analyzers often determine oxygen by difference.

Can I enter grams instead of percentages?

Yes. Switch the amounts to grams and enter the mass of each element in your sample. The ratios come out the same either way.

Sources