How do you find a formula from percent composition?
Enter each element's mass percentage or grams and get the simplest whole-number formula, and the molecular formula from a molar mass.
What you enter stays on your device while you use this tool. Opening a shared link sends the settings in its address to HowToolbox to prepare the page.
Each symbol followed by its amount, such as C 40.0, H 6.71, O 53.3.
Optional, for the molecular formula.
Empirical formula
C₅H₇N
The mole ratio is 5.00 : 7.01 : 1.00, which gives C₅H₇N.
Mole ratios
- Ratio to the smallest
Formula facts
- Molar mass of C₅H₇N
- 81.118 g/mol
- Sum of percentages
- 100%
From amounts to atoms
| Element | Mass % | Moles | Ratio | Atoms |
|---|---|---|---|---|
| C | 74.02 | 6.163 | 5.00 | 5 |
| H | 8.71 | 8.641 | 7.01 | 7 |
| N | 17.27 | 1.233 | 1.00 | 1 |
Enter each element's mass percentage or grams and get the simplest whole-number formula, and the molecular formula from a molar mass.
How to use
- Choose whether you have mass percentages or masses in grams.
- Type each element's symbol followed by its amount, such as C 40.0, H 6.71, O 53.3.
- Read the empirical formula. Add the compound's molar mass, if you know it, for the molecular formula.
How it works
An empirical formula gives the simplest whole-number ratio of atoms in a compound. Analysis gives the mass of each element, but formulas count atoms, so the masses are turned into amounts in moles and compared.
For each element, n = m ÷ M: its mass (or, for percentages, its grams in a 100 g sample) divided by its atomic weight. Divide every n by the smallest and round; a ratio such as 1.5 or 1.33 is first multiplied by 2 or 3 to clear the fraction. Nicotine is 74.02 % C, 8.710 % H and 17.27 % N: 6.163, 8.641 and 1.233 mol, a ratio of 5.00 : 7.01 : 1.00, so C₅H₇N (81.12 g/mol). Its molar mass of 162.2 g/mol is 2 × 81.12, so the molecular formula is C₁₀H₁₄N₂. The method follows OpenStax Chemistry 2e, section 3.2.
Measured percentages carry errors, so a ratio within 0.1 of a whole number is taken as whole. Results far from any simple ratio usually mean a missing element (often oxygen, found by difference) or a measurement error.
Worked example
What is the empirical formula of a compound that is 74.02% carbon, 8.71% hydrogen and 17.27% nitrogen?
- Moles in 100 g: C 6.163, H 8.641, N 1.233 (mass ÷ atomic weight).
- Divide by the smallest (1.233): C 5, H 7.01, N 1.
- The ratios round to whole numbers, 5 : 7 : 1, so those are the atom counts.
C5H7N
Sources
Frequently asked questions
Can composition tell me how the atoms are connected?
No. Different compounds can have the same empirical or molecular formula. The result describes atom counts, not the arrangement of bonds.
What if the percentages do not add up to 100?
Often one element was not measured and is found by difference: give it 100 minus the others. The calculator still works from the ratios and notes the sum.
Can I enter element names instead of symbols?
Use chemical symbols, such as C for carbon and Na for sodium. Enter each element once, followed by its amount.
Can I mix grams and percentages in one calculation?
No. Use the same basis for every element: either masses from the same sample or mass percentages. Mixing the two changes the ratios.
Why is no molecular formula shown for my molar mass?
The molecular molar mass must be close to a whole-number multiple of the empirical formula’s molar mass. Check the entered molar mass and composition if no multiple fits.
Next you might need
More in Chemistry
- Chemical equilibrium calculator, private, runs on your device
- Gas law calculator, private, runs on your device
- Molarity calculator, private, runs on your device
- Moles calculator, private, runs on your device
- Partial pressure calculator, private, runs on your device
- pH calculator, private, runs on your device





