How to Find the Molecular Formula of a Compound

Finding a molecular formula is a two-part process: first you determine the simplest ratio of atoms in a compound (the empirical formula), then you scale that ratio up using the compound’s actual molar mass. The molecular formula tells you exactly how many of each type of atom are in one molecule, while the empirical formula only gives you the lowest whole-number ratio.

For example, glucose and acetic acid both share the empirical formula CH₂O, but their molecular formulas are C₆H₁₂O₆ and C₂H₄O₂. The molecular formula is the one that reflects reality.

Empirical Formula vs. Molecular Formula

The empirical formula is the simplified version. It reduces the subscripts to the smallest whole numbers. The molecular formula is always a whole-number multiple of the empirical formula. That multiplier can be 1 (meaning they’re identical), 2, 3, or higher. Your job is to find that multiplier.

To do that, you need two things: the empirical formula and the compound’s molar mass. The molar mass typically comes from a lab technique like mass spectrometry, where the instrument measures the mass of the intact molecule, or it may simply be given to you in a problem.

Step 1: Find the Empirical Formula

If you’re starting from percent composition data (the percentage of each element in the compound), follow these steps:

  • Assume a 100 g sample. This converts percentages directly into grams. A compound that is 69.94% iron and 30.06% oxygen becomes 69.94 g of iron and 30.06 g of oxygen.
  • Convert grams to moles. Divide each element’s mass by its atomic weight. Iron’s atomic weight is 55.85 g/mol, so 69.94 g ÷ 55.85 = 1.252 mol Fe. Oxygen’s is 16.00 g/mol, so 30.06 g ÷ 16.00 = 1.879 mol O.
  • Divide by the smallest mole value. Take every result and divide by whichever is smallest. Here, 1.252 is smaller: Fe gives 1.252 ÷ 1.252 = 1, and O gives 1.879 ÷ 1.252 = 1.5.
  • Get whole numbers. If the ratios aren’t whole numbers, multiply all of them by the smallest integer that makes them whole. A ratio of 1:1.5 multiplied by 2 becomes 2:3. The empirical formula is Fe₂O₃.

Common fractional results and how to handle them: if you get a ratio ending in .5, multiply everything by 2. If it ends in .33 or .67, multiply by 3. If it ends in .25 or .75, multiply by 4. Numbers within about 0.05 of a whole number (like 2.98 or 1.02) can be safely rounded.

When You Have Combustion Data Instead

For organic compounds (those containing carbon and hydrogen), the starting data often comes from combustion analysis rather than percentages. In this technique, the compound is burned completely in excess oxygen, and the resulting CO₂ and H₂O are captured and weighed separately.

Each molecule of CO₂ contains exactly one carbon atom, and each molecule of H₂O contains two hydrogen atoms. So you convert the mass of CO₂ to moles of carbon using CO₂’s molar mass (44.01 g/mol), and the mass of H₂O to moles of hydrogen using H₂O’s molar mass (18.015 g/mol), remembering to multiply by 2 since each water molecule holds two hydrogens. For instance, 4.305 g of CO₂ yields 0.0978 mol of carbon, and 1.410 g of H₂O yields 0.1565 mol of hydrogen.

If the compound also contains oxygen or nitrogen, you find those by subtraction: convert the moles of C and H back to grams, add them up, and subtract from the original sample mass. Whatever is left belongs to the remaining element. From there, you proceed with the same divide-by-the-smallest method above.

Step 2: Calculate the Empirical Formula Mass

Add up the atomic weights of every atom in the empirical formula. The standard atomic weights you’ll use most often are carbon at 12.011, hydrogen at 1.008, nitrogen at 14.007, and oxygen at 15.999. For Fe₂O₃, that’s (2 × 55.85) + (3 × 16.00) = 159.70 g/mol.

Step 3: Find the Multiplier

Divide the compound’s actual molar mass by the empirical formula mass. The result, often called “n,” should come out very close to a whole number.

n = molar mass ÷ empirical formula mass

A Purdue University chemistry example illustrates this cleanly: a compound with an empirical formula mass of 159.06 g/mol and a known molar mass of 318.31 g/mol gives 318.31 ÷ 159.06 = 2.001. That rounds to 2.

Step 4: Write the Molecular Formula

Multiply every subscript in the empirical formula by n. If the empirical formula is C₃H₄N₂ and n = 3, the molecular formula is C₉H₁₂N₆. If n = 1, the empirical and molecular formulas are the same.

Here’s a full quick example: triethylenemelamine has an empirical formula of C₃H₄N₂ and a molar mass of 204.23 g/mol. The empirical formula mass is (3 × 12.011) + (4 × 1.008) + (2 × 14.007) = 68.08 g/mol. Dividing 204.23 by 68.08 gives 3.0, so every subscript gets tripled. The molecular formula is C₉H₁₂N₆.

Writing Elements in the Correct Order

Molecular formulas follow a convention called the Hill system. If the compound contains carbon, carbon goes first, hydrogen second, and every remaining element follows in alphabetical order. So a compound with carbon, hydrogen, nitrogen, and oxygen is written as C, H, N, O. If no carbon is present, all elements are simply listed alphabetically. This is why water is H₂O (H before O) and table salt is ClNa in some databases, though many common inorganic compounds keep their traditional names.

What a Molecular Formula Cannot Tell You

A molecular formula identifies the exact count of each atom in a molecule, but it says nothing about how those atoms are arranged. Compounds that share the same molecular formula but have different structures are called isomers. The formula C₃H₈O, for instance, applies to three distinct compounds: 1-propanol, 2-propanol (rubbing alcohol), and ethyl methyl ether. All three have the same number of carbons, hydrogens, and oxygens, yet they behave quite differently because their atoms are connected in different ways.

To pin down the actual structure, chemists rely on additional techniques like infrared spectroscopy and nuclear magnetic resonance. The molecular formula is the essential first step, telling you what atoms you’re working with and how many of each, but it’s the starting point for identifying a compound rather than the final answer.