Empirical & Molecular Formula Calculator

Assumes a 100 g sample (percent = grams). Give the molar mass to also get the molecular formula.

Parentheses and hydrates supported. Returns molar mass and each element's mass percent.

All C ends up in CO₂, all H in H₂O; remaining mass is taken as oxygen (CₓHᵧOᵤ). Moles C = mol CO₂, moles H = 2 × mol H₂O.

From percent composition to a formula — the method

  1. Percent → grams. Assume a 100 g sample, so 40.0% C means 40.0 g C.
  2. Grams → moles. Divide each mass by the element's atomic weight.
  3. Moles → ratio. Divide every mole value by the smallest one.
  4. Clear fractions. Multiply by a small integer until the ratios are whole numbers — those are the empirical subscripts.
  5. Empirical → molecular. Divide the molar mass by the empirical-formula mass and multiply the subscripts by that factor.

This tool runs every step on the server with the exact IUPAC atomic weights from chempy, and shows the moles, mole ratios and the multiplier it used so you can follow along.

Frequently asked

Treat each percent as grams (100 g sample), divide by atomic weights to get moles, divide all by the smallest, then multiply to whole numbers. C 40.0%, H 6.7%, O 53.3% → CH₂O.
Empirical is the simplest whole-number ratio (CH₂O); molecular is the real count (C₆H₁₂O₆ = glucose), always a whole multiple. Divide molar mass by empirical mass for the multiplier.
For each element, mass % = (atoms × atomic weight) ÷ molar mass × 100. Water: H = 11.2%, O = 88.8%.
All carbon becomes CO₂ and all hydrogen becomes H₂O. moles C = mol CO₂, moles H = 2 × mol H₂O, and oxygen mass is the sample mass minus C and H. Convert to moles and take the ratio.
Yes — free, no signup, exact atomic weights via the open-source chempy library.

Support This Free Tool

Every coffee helps keep the servers running. Every book sale funds the next tool I'm dreaming up. You're not just supporting a site — you're helping me build what developers actually need.

500K+ users
200+ tools
100% private
Privacy Guarantee: Private keys you enter or generate are never stored on our servers. All tools are served over HTTPS.