Molecular Formula Calculator
Find the molecular formula of any compound from its empirical formula and molar mass, percent composition, or element masses — with step-by-step working.
How the Molecular Formula Calculator Works
The calculator accepts three types of input and handles each with a separate calculation pipeline. All three methods ultimately deliver the same result: the actual number of atoms of each element in one molecule of your compound.
Molecular Formula Examples
These three examples illustrate the most common exam scenarios: deriving the molecular formula from a known empirical formula, from percent composition data, and from combustion analysis masses.
Empirical mass: 30.03 g/mol
n = 180 / 30.03 = 6
Molecular: C₆H₁₂O₆ (Glucose)
Moles: C = 7.69, H = 7.64
Ratio 1 : 1 → CH
n = 78 / 13 = 6 → C₆H₆ (Benzene)
Moles: C = 0.450, H = 0.476, O = 0.200
Ratio 9:8:4
C₉H₈O₄ (Aspirin, MM = 180)
Molecular Formula vs Empirical Formula
Understanding the relationship between molecular and empirical formulas is essential for general chemistry, organic chemistry, and any stoichiometry exam. The two formulas are related by a single integer multiplier n.
| Property | Empirical Formula | Molecular Formula |
|---|---|---|
| Definition | Simplest whole-number ratio of atoms | Actual number of atoms per molecule |
| Glucose | CH₂O (mass 30) | C₆H₁₂O₆ (mass 180) |
| Benzene | CH (mass 13) | C₆H₆ (mass 78) |
| Ethylene | CH₂ (mass 14) | C₂H₄ (mass 28) |
| Acetic acid | CH₂O (mass 30) | C₂H₄O₂ (mass 60) |
| Requires molar mass? | No | Yes |
| Unique? | No (multiple compounds share) | Yes (per compound) |
The key relationship: Molecular Formula = n × Empirical Formula, where n = Molar Mass ÷ Empirical Formula Mass. If n = 1, the molecular formula is identical to the empirical formula (e.g., water H₂O, carbon dioxide CO₂).
How to Find Molecular Formula from Percent Composition
Percent composition problems are the most common molecular formula question type on general chemistry exams. The calculator automates every step, but understanding the process helps you check answers and catch rounding errors.
- Step 1 — Assume 100 g sample. This converts percentages directly into grams. If carbon is 40.0%, you have 40.0 g of carbon.
- Step 2 — Convert grams to moles. Divide each element’s mass by its atomic mass. Carbon: 40.0 ÷ 12.011 = 3.330 mol; Hydrogen: 6.71 ÷ 1.008 = 6.657 mol; Oxygen: 53.29 ÷ 16.00 = 3.331 mol.
- Step 3 — Divide by the smallest mole value. All three divided by 3.330 give ratios of 1 : 2 : 1 → empirical formula CH₂O.
- Step 4 — Calculate empirical formula mass. 12.011 + 2(1.008) + 15.999 = 30.03 g/mol.
- Step 5 — Find n from molar mass. n = 180 ÷ 30.03 = 5.99 ≈ 6. Molecular formula: C₆H₁₂O₆.
A common exam trap: ratios that are not whole numbers after dividing by the smallest. If you get 1 : 1.5 : 1, multiply everything by 2 to get 2 : 3 : 2. Ratios ending in .33 multiply by 3; ratios ending in .25 multiply by 4. The calculator handles non-integer ratios automatically using a fractional-to-integer conversion routine.
Converting Molecular Formula to Empirical Formula (Reverse)
To go from molecular formula back to empirical formula, divide all subscripts by their greatest common divisor (GCD). For C₆H₁₂O₆, GCD of 6, 12, 6 is 6 → empirical formula CH₂O. For C₉H₈O₄ (aspirin), GCD of 9, 8, 4 is 1 → the molecular and empirical formulas are identical.
This reverse direction is tested in organic chemistry contexts: given the molecular formula, identify whether the compound can be represented more simply. If GCD = 1, the molecular formula is already in its simplest form.
Degree of Unsaturation (DBE) from Molecular Formula
Once you have the molecular formula, you can calculate the degree of unsaturation (also called the double bond equivalent, DBE or DoU). This tells you how many rings and pi bonds the molecule contains, and it is one of the most powerful tools in organic chemistry structure determination.
For a compound with formula CₚHₛNₜO (where oxygen and sulfur do not change the count):
DBE = C − H/2 + N/2 + 1
- DBE = 0: Fully saturated, no rings, no double bonds (e.g., alkanes)
- DBE = 1: One double bond or one ring (e.g., alkenes, cycloalkanes)
- DBE = 2: Two pi bonds or two rings (e.g., alkynes, dienes)
- DBE = 4: Benzene ring (3 double bonds + 1 ring = 4)
- DBE ≥ 4: Likely contains an aromatic ring
Example: Aspirin C₉H₈O₄. DBE = 9 − 8/2 + 0/2 + 1 = 9 − 4 + 1 = 6. This accounts for the benzene ring (DBE 4) plus the carboxylic acid C=O (DBE 1) plus the ester C=O (DBE 1). The DBE correctly predicts the functional groups without any spectroscopy data.
Three Ways to Calculate Molecular Formula
The calculator supports every common input format you will encounter in general chemistry and organic chemistry coursework.
Method 1: Empirical Formula + Molar Mass
This is the most direct method. You already know the empirical formula (perhaps derived from a previous calculation) and the experimental molar mass (from mass spectrometry or another technique). The calculator finds the empirical formula mass, divides the molar mass by it to get n, and multiplies all subscripts by n. Used for: most textbook stoichiometry problems, Orgo 1 review questions.
Method 2: Percent Composition by Element
Enter the percentage by mass of each element and, optionally, the molar mass. The calculator converts percentages to a 100 g sample, calculates mole ratios, derives the empirical formula, then scales to the molecular formula if the molar mass is provided. If no molar mass is given, the output is the empirical formula only. Used for: combustion analysis, elemental analysis (EA) data interpretation, general chemistry exam questions.
Method 3: Actual Element Masses
Enter the actual gram masses of each element from an experimental sample. This is the raw data form of Method 2 — the calculator converts masses to moles internally. Useful when you have combustion analysis output in grams (e.g., CO₂ mass → carbon mass → moles of carbon) or when working with a weighed sample. Used for: combustion analysis problems, analytical chemistry.
All three methods display the empirical formula, the multiplier n, and (when molar mass is provided) the final molecular formula with the degree of unsaturation. The organic chemistry solver can help you interpret what the molecular formula tells you about a compound’s structure and reactivity.