Empirical & Molecular Formula Calculator

Agarapu Ramesh — Editor and content reviewer

Convert percent composition, gram composition, or an empirical formula into the chemical formula you need.

What can you enter?

This calculator accepts the formats students usually see in homework, lab reports, and composition-analysis questions. Use element symbols, not full element names.

GoalInput exampleWhat the tool does
Percent compositionC:40.0,H:6.7,O:53.3Treats the data as a 100 g sample, then finds CH2O.
Mass compositionMg:2.43,O:1.60Converts grams to moles, then finds MgO.
Molecular formulaCH2O and 180.16 g/molFinds the multiplier 6 and gives C6H12O6.
Flexible separatorsFe 69.94 O 30.06Reads spaces, commas, colons, or equals signs between symbols and values.

Formula path used

mass or percent -> moles = amount / atomic mass -> divide by the smallest mole value -> multiply fractional ratios to whole numbers -> empirical formula. Molecular formula = empirical formula x (molecular mass / empirical formula mass).

Worked example: glucose

Input: C:40.0,H:6.7,O:53.3 with molar mass 180.16 g/mol.

  1. Assume 100 g, so the sample has 40.0 g C, 6.7 g H, and 53.3 g O.
  2. Convert to moles: C = 40.0 / 12.011, H = 6.7 / 1.008, O = 53.3 / 15.999.
  3. Divide by the smallest mole value to get a ratio near 1 : 2 : 1.
  4. The empirical formula is CH2O. Its empirical mass is about 30.03 g/mol.
  5. 180.16 / 30.03 is about 6, so the molecular formula is C6H12O6.

Built-in example data

ExampleComposition dataKnown molar massExpected result
GlucoseC 40.0%, H 6.7%, O 53.3%180.16 g/molCH2O -> C6H12O6
Iron(III) oxideFe 69.94%, O 30.06%Not neededFe2O3
CaffeineC 49.48%, H 5.19%, N 28.85%, O 16.48%194.19 g/molC4H5N2O -> C8H10N4O2
Vitamin CC 40.92%, H 4.58%, O 54.50%176.12 g/molC3H4O3 -> C6H8O6
Magnesium oxideMg 2.43 g, O 1.60 gNot neededMgO

Why this calculator is useful

Empirical formula problems are simple in idea but easy to misread because the answer depends on ratios, not direct masses. This tool keeps the mole conversion table visible, shows the whole-number ratio, and checks the molecular multiplier when molar mass is available.

Where it helpsWhy it matters
General chemistry homeworkShows every conversion step instead of only the final formula.
Combustion analysisTurns measured C, H, O, or N data into atom ratios.
Lab report checksHelps compare experimental composition with the expected compound formula.
Exam revisionPractices percent-to-moles and ratio rounding in one workflow.
Molecular formula questionsConnects empirical mass to the measured molar mass multiplier.

How to read the output

The result card highlights the empirical formula first because that is the lowest whole-number ratio. The mole-ratio view shows how far each element is from the smallest mole value. If a known compound molar mass is entered, the formula flow shows how the empirical formula becomes the molecular formula.

For example, CH2O and C6H12O6 have the same empirical ratio, but C6H12O6 is the actual molecular formula for glucose because its molar mass is six times the empirical formula mass.

Common mistakes to avoid

Rounding and result checking

Ratios close to whole numbers, such as 1.99 or 3.02, are normally rounded to 2 or 3. Ratios near common fractions need a multiplier: 1.5 uses x2, 1.33 uses x3, 1.25 uses x4, and 1.67 uses x3. If the molecular multiplier is not close to a whole number, recheck the composition data, atomic masses, molar mass, and significant figures.

Related Chemistry Tools

Molar Mass CalculatorPercent Composition CalculatorMole Gram Particles ConverterMolarity CalculatorLimiting Reagent CalculatorChemical Equation Balancer

Empirical & Molecular Formula Calculator FAQs

How to calculate empirical formula?

The empirical formula gives the simplest whole-number ratio of atoms in a compound. Follow these five steps: (1) Take the percentage of each element (treat as grams); (2) divide by the atomic mass to get moles; (3) divide every result by the smallest number of moles to get a ratio; (4) if any ratio is fractional, multiply all by the same small integer to get whole numbers; (5) write the formula. For example, a compound with 40% C, 6.7% H, 53.3% O gives the empirical formula CH2O. Steps: % → mass (g) → moles (÷ atomic mass) → ratio (÷ smallest) → whole numbers

How to calculate the molecular formula from the empirical formula?

The molecular formula is always a whole-number multiple of the empirical formula: Molecular formula = n × Empirical formula, where n = (Molecular mass) / (Empirical formula mass). For instance, the empirical formula of glucose is CH2O (mass 30 g/mol). Its molecular mass is 180 g/mol, so n = 180/30 = 6. Molecular formula = (CH2O)6 = C6H12O6. Always need molecular mass (from experiments like vapour density or mass spectrometry) to find the molecular formula. n = Mmolecular / Mempirical

How to calculate empirical formula from percent composition?

Assume you have 100 g of the compound, so each percentage directly becomes mass in grams. Then divide each mass by the corresponding atomic mass to get moles. Divide each mole value by the smallest one to get a ratio close to whole numbers. Worked example: a hydrocarbon contains 75% C and 25% H. C: 75/12 = 6.25 mol; H: 25/1 = 25 mol. Divide by 6.25 → 1 : 4. So the empirical formula is CH4, which is methane.

How to calculate the empirical formula of a compound?

If you are given experimental data — masses of elements, or percentages, or mass of compound and CO2/H2O produced on combustion — convert all information to moles of each element. Then find the simplest mole ratio. Example: 5.6 g of iron combines with 2.4 g of oxygen. Moles: Fe = 5.6/56 = 0.1; O = 2.4/16 = 0.15. Ratio Fe:O = 0.1 : 0.15 = 2 : 3. Empirical formula = Fe2O3, the formula of haematite (rust).

How to calculate molar mass from empirical formula?

This question can mean two things. (a) Empirical-formula mass — simply add the atomic masses of the atoms shown in the empirical formula. For CH2O: 12 + 2(1) + 16 = 30 g/mol. (b) Molar (molecular) mass — you need additional information such as vapour density, freezing-point depression, or the molecular formula. Once you know n = Mmolecular/Mempirical, Mmolecular = n × Mempirical.