Molecular Formula Calculator: 5 Free Modes, Every Step Shown

Molecular Formula Calculator

Find the true molecular formula of a compound from its empirical formula and molar mass, straight from percent composition, from combustion analysis, or from gas-density and vapour-density data — then check any formula for molar mass, percent composition and degree of unsaturation. Every ratio, every n and every rounding decision is shown.

✓ Trusted by students, teachers & analytical labs
⚡ n = M ÷ EFM📐 % → formula🔥 Combustion analysis🌪 Gas & vapour density↺ One-click reset🔒 100% free

Molecular Formula from the Empirical Formula and the Molar Mass

Type the empirical formula (brackets and Unicode subscripts are understood) and the molar mass from mass spectrometry, freezing-point depression, vapour density or the question itself. The tool computes the empirical formula mass, divides it into the molar mass, rounds to the nearest whole number n and multiplies every subscript by n. If the formula you typed is not the simplest ratio, it tells you; if n is not close to an integer, it warns you instead of rounding silently.

CH₂O, M = 180.16 → glucose CH, M = 78.11 → benzene NO₂, M = 92.01 → N₂O₄ C₃H₄O₃, M = 176.12 → vitamin C C₄H₅N₂O, M = 194.19 → caffeine P₂O₅, M = 283.89 → P₄O₁₀ CH₂, M = 56.11 → butene HO, M = 34.01 → H₂O₂

Molecular Formula Straight from Percent Composition (or Element Masses) and the Molar Mass

The complete textbook problem in one run. Enter up to six elements with their mass percent (or the mass of each in grams) and the molar mass. The tool converts each entry to moles, divides by the smallest, multiplies by the smallest integer that makes every ratio whole (the empirical formula), then divides the molar mass by the empirical formula mass to get n and the molecular formula. Leave the molar mass blank and you get the empirical formula alone.

Glucose: 40.00% C, 6.71% H, 53.29% O, M = 180.16 Caffeine: C 49.48, H 5.19, N 28.85, O 16.48%, M = 194.19 Vitamin C: 40.92% C, 4.58% H, 54.50% O, M = 176.12 (needs ×3) Nicotine: 74.03% C, 8.70% H, 17.27% N, M = 162.24 Aspirin: 60.00% C, 4.48% H, 35.52% O, M = 180.16 (n = 1) 30.45% N, 69.55% O, M = 92.01 → N₂O₄ Oxygen by difference: 38.7% C, 9.7% H, M = 62.07 92.26% C, 7.74% H, M = 26.04 → acetylene

Molecular Formula from Combustion Analysis and the Molar Mass

A weighed sample is burned in excess oxygen and the CO₂ and H₂O are trapped and weighed. All the carbon ends up in CO₂ (12.011/44.009 of its mass) and all the hydrogen in H₂O (2.016/18.015); nitrogen and sulfur can be entered as N₂ and SO₂, and any mass not accounted for is oxygen. Add the molar mass and the tool carries the empirical formula through to the molecular formula in the same run.

1.000 g acetic acid → 1.466 g CO₂, 0.600 g H₂O, M = 60.05 0.2500 g ester → 0.4995 g CO₂, 0.2045 g H₂O, M = 88.11 11.5 g ethanol → 22.0 g CO₂, 13.5 g H₂O, M = 46.07 Nicotine: 1.000 g → 2.713 g CO₂, 0.777 g H₂O, 0.173 g N₂, M = 162.24 Micro-scale (mg): 10.68 mg isopropanol → 23.46 mg CO₂, 12.81 mg H₂O Hydrocarbon: 0.4000 g → 1.2568 g CO₂, 0.5145 g H₂O, M = 84.16

Molar Mass from Gas Data, Vapour Density or Moles → Molecular Formula

When the question gives you an empirical formula but no molar mass, the molar mass usually hides in gas data. Choose the method: ideal gas (a known mass of vapour at a known volume, temperature and pressure: M = mRT/PV), vapour density relative to hydrogen (M = 2 × VD), or a known mass and amount (M = m/n). The tool finds M, then n = M / empirical formula mass, then the molecular formula.

CH₂: 1.000 g fills 0.436 L at 25 °C, 1.00 atm → butene CH: 0.500 g of vapour fills 0.196 L at 100 °C, 1.00 atm → benzene NO₂: vapour density 46.0 → N₂O₄ P₂O₅: vapour density 141.9 → P₄O₁₀ CH₂O: 4.000 g is 0.02220 mol → glucose C₂H₅: 2.000 g fills 0.842 L at 25 °C → butane

Analyse a Molecular Formula: Molar Mass, Percent Composition, Empirical Formula, n and Degree of Unsaturation

The reverse check. Type any molecular formula — C₆H₁₂O₆, C₈H₁₀N₄O₂, (NH₄)₂SO₄, CuSO₄·5H₂O — and the tool returns the molar mass, the mass percent of each element, the empirical formula and the whole-number ratio n between the two, and for organic formulas the degree of unsaturation (rings + π bonds). Give a sample mass and it also reports the grams of each element.

C₆H₁₂O₆ (glucose) C₈H₁₀N₄O₂ (caffeine) C₆H₆ (benzene) C₉H₈O₄ (aspirin) C₂H₄O₂ (acetic acid, n = 2) (NH₄)₂SO₄, 100 g sample CuSO₄·5H₂O C₁₀H₁₄N₂ (nicotine)

🕘 Recent calculations

  • No calculations yet — your last 10 results will appear here.

molecular formula = (empirical formula) × n · n = molar mass ÷ empirical formula mass · moles = mass ÷ atomic weight · ratio = moles ÷ smallest · C from CO₂: × 12.011/44.009 · H from H₂O: × 2.016/18.015 · ideal gas M = mRT/PV (R = 0.082057 L·atm/mol·K) · M = 2 × vapour density · DBE = C + 1 + N/2 − H/2 − X/2 · Atomic weights: IUPAC 2021 (C 12.011, H 1.008, O 15.999, N 14.007, S 32.06).

A molecular formula calculator answers the question that elemental analysis alone cannot: not just the ratio of atoms in a compound, but how many of each atom sit in one actual molecule. Analysis tells you glucose is CH2O — one carbon, two hydrogens, one oxygen — and it tells you exactly the same thing about formaldehyde, acetic acid, lactic acid and ribose. What separates them is the molar mass. Divide 180.16 g/mol by the 30.03 g/mol of one CH2O unit and you get 6; multiply every subscript by 6 and the molecule appears: C6H12O6. That single division, n = M / EFM, is the heart of every molecular formula problem, and it is the step students most often forget to finish.

The free molecular formula calculator above covers the whole problem in five modes: molecular formula from an empirical formula and a molar mass; molecular formula straight from percent composition or element masses plus molar mass, so the empirical step is done for you; molecular formula from combustion analysis (CO2, H2O, optional N2 and SO2) plus molar mass; molar mass from gas data — the ideal gas law, vapour density or mass and moles — carried straight through to the formula; and a formula analyser that returns molar mass, percent composition, empirical formula, n and the degree of unsaturation for anything you type. Every mode prints the empirical formula mass, the quotient n before and after rounding, a table of the multiples it considered and a warning whenever n is not close to a whole number.

Below the tool is a complete guide: what a molecular formula is and how it differs from the empirical and structural formulas, the n = M / EFM rule and why it must give an integer, where molar masses come from in real problems, worked examples for glucose, vitamin C and caffeine, a reference table of common compounds, the combustion and gas-data routes, the degree of unsaturation as a check, ten practice problems with hidden answers and a frequently-asked-questions section. All numbers use IUPAC 2021 standard atomic weights, the same values the molecular formula calculator uses internally.

✍️ Written by: Ahmad Raza, M.Phil. Chemistry ✓ Verified Expert 🗓️ Last updated: September 7, 2026 ⏱️ Reading time: ~24 minutes

🔑 KEY TAKEAWAY

The molecular formula gives the actual number of atoms of each element in one molecule; the empirical formula gives only their simplest whole-number ratio. The two are related by a whole number n: molecular formula = (empirical formula) × n, where n = molar mass ÷ empirical formula mass. To find it: (1) get the empirical formula from percent composition or analysis, (2) add up its atomic masses to get the empirical formula mass, (3) divide the experimental molar mass by that number and round to the nearest integer, (4) multiply every subscript by n. Glucose: CH2O has EFM 30.03 g/mol; M = 180.16 g/mol; n = 180.16 / 30.03 = 6.00; molecular formula C6H12O6. If n is not within about 0.1 of a whole number, the molar mass or the empirical formula is wrong. The molecular formula calculator above performs all four steps from any starting data and shows the working.

📑 Table of Contents (click to expand)
  1. What Is a Molecular Formula?
  2. How to Use This Molecular Formula Calculator
  3. The Five Modes Explained
  4. The Rule: n = Molar Mass ÷ Empirical Formula Mass
  5. Where the Molar Mass Comes From
  6. Worked Examples
  7. Reference Table: Empirical vs Molecular Formulas
  8. From Percent Composition to Molecular Formula in One Run
  9. From Combustion Analysis to Molecular Formula
  10. From Gas Data and Vapour Density
  11. Degree of Unsaturation: The Built-in Sanity Check
  12. One Molecular Formula, Many Molecules
  13. Who Uses a Molecular Formula Calculator?
  14. Step-by-Step Walkthrough in the Tool
  15. A Short History: From Ratios to Molecules
  16. Limitations and Sources of Error
  17. Practice Problems (With Answers)
  18. Tips for Accurate Results
  19. Common Mistakes
  20. How This Calculator Is Different
  21. Where the Numbers Come From
  22. Exam Checklist
  23. Frequently Asked Questions
  24. 10 Facts Worth Knowing
  25. Final Thoughts
molecular formula calculator converting an empirical formula and molar mass into the molecular formula with n shown
Our free molecular formula calculator takes an empirical formula, percent composition, combustion data or gas data plus a molar mass and returns the molecular formula with n, the multiples table and every step.

What Is a Molecular Formula?

The molecular formula of a compound states how many atoms of each element are present in one molecule. Water is H2O: two hydrogen atoms and one oxygen atom per molecule. Glucose is C6H12O6: six carbons, twelve hydrogens, six oxygens. Hydrogen peroxide is H2O2, benzene C6H6, caffeine C8H10N4O2. Because the formula counts atoms in a real molecule, its molar mass is the molar mass of the substance itself, and that is the property that makes it measurable.

The empirical formula, by contrast, gives only the simplest whole-number ratio of the atoms. It is what elemental analysis delivers, because analysis measures masses of elements, not molecules. H2O2 has the empirical formula HO; C6H6 is CH; C6H12O6 is CH2O; caffeine is C4H5N2O. The molecular formula is always a whole-number multiple of the empirical formula — twice it for hydrogen peroxide and caffeine, six times for benzene and glucose, and exactly once for water, ammonia, ethanol and any compound whose subscripts share no common factor. Our companion empirical formula calculator covers that first half of the story in depth; this page is about the second half, and about doing both halves in one pass.

There is a third level, the structural formula, which shows how the atoms are connected. It matters because a molecular formula does not identify a single substance: C2H6O is both ethanol and dimethyl ether; C4H10 is butane and isobutane; C6H12O6 is glucose, fructose, galactose and a dozen other sugars. Isomers share a molecular formula and differ in structure. Spectroscopy (NMR, IR, mass-spectral fragmentation) settles the structure; the molecular formula is the essential first step that tells the spectroscopist what to look for, and the degree of unsaturation derived from it narrows the options before any spectrum is recorded.

For ionic and network solids the term molecular formula does not strictly apply, and a molecular formula calculator has to be read with that in mind, because there are no molecules to count — sodium chloride is a lattice, not a collection of NaCl pairs. Their formulas are formula units and are always the empirical ratio; the mass of one such unit is the formula weight, handled by our formula weight calculator. Mode 5 of the molecular formula calculator will still parse Na2SO4 or CuSO4·5H2O and return molar mass and percent composition, but the multiplier n and the degree of unsaturation are only meaningful for molecular substances.

The three formulas of acetic acid

Empirical formula CH2O (ratio 1 : 2 : 1, empirical formula mass 30.03 g/mol). Molecular formula C2H4O2 (M = 60.05 g/mol, n = 2). Structural formula CH3COOH (a methyl group attached to a carboxylic acid group). The molecular formula calculator gets you from the first to the second; the third comes from spectroscopy and chemistry.

How to Use This Molecular Formula Calculator

Pick a mode with the pill tabs at the top of the molecular formula calculator: From Empirical Formula, From % Composition, From Combustion, From Gas Data or Analyse a Formula. Each mode has example chips that load a textbook problem, so you can see the expected input before entering your own.

  1. Enter what the problem gives you. In Mode 1 type the empirical formula (CH2O, NO2, C3H4O3; brackets and pasted Unicode subscripts are fine) and the molar mass. In Mode 2 type up to six elements with their percentages or masses, plus the molar mass. In Mode 3 type the sample mass and the masses of CO2, H2O and, if present, N2 and SO2. In Mode 4 choose how the molar mass is to be found and fill the matching boxes.
  2. Press Calculate. The headline shows the molecular formula with real subscripts; beneath it the empirical formula mass, the quotient n = M / EFM to three decimals, the rounded n, the molecular mass and, for organic formulas, the degree of unsaturation.
  3. Read the steps. The steps box shows the empirical formula mass being added up, the division, the rounding decision with its deviation, and the multiplication of each subscript. A table lists the multiples (EF)1, (EF)2, (EF)3 … with their masses and the percentage gap from your molar mass, and marks the one chosen; the bar chart shows the same comparison visually.
  4. Heed the warnings. If the formula you typed is not the simplest ratio, the tool says so and names the true empirical formula. If n is more than 0.15 from a whole number (adjustable), the result is flagged rather than silently rounded — that flag almost always means a wrong molar mass or a mis-copied percentage.
  5. Copy, download, print or share. The toolbar copies the working as text, downloads a CSV or TXT, prints a clean page, or shares via WhatsApp, Facebook, X or the native share sheet. The last ten calculations stay in the history panel until you press Clear All.

Leave the molar mass blank in Mode 2 or Mode 3 and the molecular formula calculator stops at the empirical formula, lists the first six possible molecules (EF)n with their masses, and tells you exactly what value of M would select each — useful when the molar mass is the next thing you are about to measure.

The Five Modes Explained

Mode 1 — Molecular formula from empirical formula and molar mass

The core molecular formula calculator problem. Type the empirical formula and the molar mass, and the tool computes the empirical formula mass from IUPAC atomic weights, forms n = M / EFM, rounds it and multiplies the subscripts. It checks that the typed formula really is the simplest ratio (C2H4O2 triggers a note that CH2O is the empirical formula) and reports the degree of unsaturation of the result as a plausibility check.

Mode 2 — Molecular formula straight from percent composition

The full textbook problem in one run, and the reason most people open a molecular formula calculator. Enter the elements and their mass percentages (or masses in grams — only ratios matter) and the molar mass. The tool converts each entry to moles, divides by the smallest, multiplies by the smallest integer that makes every ratio whole, then applies n = M / EFM. Oxygen can be taken by difference when only C, H and N were measured. Without a molar mass the run ends at the empirical formula with a list of candidate molecules.

Mode 3 — Molecular formula from combustion analysis

Enter the sample mass and the masses of CO2, H2O and optionally N2 and SO2 collected, in grams or milligrams. The molecular formula calculator converts each product to the element it carries, takes oxygen by difference if asked, finds the empirical formula, and — with the molar mass — the molecular formula. A mass-balance check refuses data in which the recovered carbon and hydrogen exceed the sample mass, the commonest sign of a typing error or a g/mg mix-up.

Mode 4 — Molar mass from gas data, then the molecular formula

Many problems give the empirical formula and then hide the molar mass inside gas data. Choose the ideal gas route (a known mass of vapour occupying a known volume at a known temperature and pressure: M = mRT/PV), the vapour density route (M = 2 × VD relative to hydrogen), or simply a mass and an amount in moles (M = m/n). The molecular formula calculator finds M, shows the arithmetic, then finishes with n and the formula. The same physics underlies our dedicated molar mass from gas density and vapor density tools.

Mode 5 — Analyse a molecular formula

The reverse check, which turns the molecular formula calculator into a verification tool. Type any formula and get its molar mass, the mass percent of each element, the empirical formula, the multiplier n between the two, the number of atoms per molecule and the degree of unsaturation (rings plus π bonds). Add a sample mass to get the grams of each element in it. This is the mode for confirming a result, preparing the theoretical percentages for an analysis report, or checking a formula copied from a paper.

The Rule: n = Molar Mass ÷ Empirical Formula Mass

Because a molecule is n empirical units stuck together, its mass is n times the mass of one unit — the single fact every molecular formula calculator is built on. Mass is additive, so:

n = Mmolar / Mempirical   →   molecular formula = (empirical formula)n

The empirical formula mass (EFM) is simply the sum of the atomic masses in one empirical unit: CH2O = 12.011 + 2(1.008) + 15.999 = 30.026 g/mol; CH = 13.019; NO2 = 46.005; C3H4O3 = 88.062; C4H5N2O = 97.097. The molar mass M is the experimental value for the compound. Divide, and n must come out as a whole number — 6.00 for glucose, 6.00 for benzene, 2.00 for N2O4, 2.00 for vitamin C, 2.00 for caffeine — because you cannot have 2.4 empirical units in a molecule.

That integer requirement is more than a formality; it is the built-in error check of the whole method. If n comes out as 3.3 or 1.6, something upstream is wrong: the molar mass was misread, a percentage was mistyped, an atomic mass was taken for O2 instead of O, or the “empirical” formula was not actually reduced. The molecular formula calculator therefore reports n to three decimals before rounding, states the deviation, and warns when it exceeds the tolerance (0.15 by default) instead of quietly rounding to the nearest integer and printing a wrong formula with a straight face.

Small deviations in n are normal and harmless, and a molecular formula calculator should say so rather than hide them. A molar mass from freezing-point depression is good to perhaps 2–5%, so for glucose n might come out as 5.8 or 6.2; the rounding to 6 is safe because the neighbouring candidates (n = 5, 150 g/mol; n = 7, 210 g/mol) are 17% away. Trouble starts only when the empirical formula mass is small relative to the molar mass: with CH2 (14.03) and a molar mass measured as 84 ± 4 g/mol, n could be 5.7–6.3 and C6H12 is still safe; at 140 ± 7 g/mol, n ranges 9.5–10.5 and C10H20 is no longer certain. The multiples table the tool prints makes this spacing visible at a glance.

Step 1 — Empirical formula mass. Add the atomic masses of the empirical unit.
Step 2 — Divide. n = M / EFM. Keep two decimals.
Step 3 — Judge. Within about 0.1 of a whole number? Round. Otherwise stop and recheck the data.
Step 4 — Multiply. Every subscript × n. Then verify that n × EFM reproduces M and that the percent composition is unchanged.
molecular formula calculator rule: n equals molar mass divided by empirical formula mass, molecular formula equals empirical formula times n, glucose CH2O times 6 gives C6H12O6
The one rule behind every molecular formula calculator: n = M / EFM must be a whole number, and every subscript of the empirical formula is multiplied by it.

Where the Molar Mass Comes From

In an examination the molar mass is usually given. In the laboratory, and in the better exam questions, it has to be found, and knowing the routes tells you which mode of the molecular formula calculator to open.

  • Mass spectrometry. The molecular ion peak gives the molecular mass directly, often to four decimal places in high-resolution instruments, which fixes the formula outright. Our exact mass calculator and monoisotopic mass calculator explain the difference between the average molar mass used here and the monoisotopic mass a spectrometer reports.
  • Gas density and the ideal gas law. Vaporise a weighed sample and measure its volume, temperature and pressure: M = mRT/PV. This is the Dumas method, and Mode 4 performs it with R = 0.082057 L·atm/(mol·K).
  • Vapour density. The density of a gas relative to hydrogen at the same conditions equals M/2, so M = 2 × VD. A vapour density of 46.0 for a gas with empirical formula NO2 means M = 92 and the molecule is N2O4. Mode 4 again.
  • Colligative properties. Dissolving a known mass in a solvent and measuring the freezing-point depression, boiling-point elevation or osmotic pressure gives the moles of solute and therefore M = m/n. Enter that mass and amount in Mode 4’s third method.
  • Titration. For an acid or base, the volume of standard titrant gives the moles of the sample; M = m/n follows, or the equivalent weight if the number of acidic protons is unknown.

Each of these routes delivers M to the molecular formula calculator with a different precision — mass spectrometry to 0.01%, gas density to about 1%, cryoscopy to a few percent — and that precision decides how confidently n can be rounded. The molecular formula calculator’s deviation readout is where that judgement is made visible.

Worked Examples

Example 1 — Glucose from empirical formula and molar mass (Mode 1)

Given: empirical formula CH2O; M = 180.16 g/mol (the first example chip in the molecular formula calculator).
Step 1: EFM = 12.011 + 2(1.008) + 15.999 = 30.026 g/mol.
Step 2: n = 180.16 / 30.026 = 6.000.
Step 3: Deviation from 6 is 0.000 → round to 6.
Step 4: (CH2O)6 = C6H12O6; M = 6 × 30.026 = 180.156 g/mol. Degree of unsaturation = 6 + 1 − 12/2 = 1 (the ring of the pyranose form, or the C=O of the open chain).

Example 2 — Vitamin C from percent composition (Mode 2)

Given: 40.92% C, 4.58% H, 54.50% O; M = 176.12 g/mol.
Moles (100 g): C 40.92 / 12.011 = 3.407; H 4.58 / 1.008 = 4.544; O 54.50 / 15.999 = 3.406.
Divide by 3.406: C 1.000, H 1.334, O 1.000. The 1.33 is ⅓ → multiply all by 3 → C 3, H 4, O 3 → empirical formula C3H4O3, EFM 88.062.
n: 176.12 / 88.062 = 2.000 → C6H8O6, ascorbic acid.
Trap: rounding 1.33 to 1 gives CHO (29.02) and n = 6.07 — the non-integer n is the giveaway, and the molecular formula calculator would have flagged it.

Example 3 — Caffeine, four elements (Mode 2)

Given: 49.48% C, 5.19% H, 28.85% N, 16.48% O; M = 194.19 g/mol.
Moles: C 4.120; H 5.149; N 2.060; O 1.030.
Divide by 1.030: C 4.00, H 5.00, N 2.00, O 1.00 → C4H5N2O, EFM 97.097.
n: 194.19 / 97.097 = 2.000 → C8H10N4O2. Degree of unsaturation = 8 + 1 + 4/2 − 10/2 = 6: two rings plus four double bonds, exactly the purine skeleton with two C=O and one C=N.

Caffeine shows why the molar mass is indispensable: C4H5N2O looks like a perfectly reasonable formula, and nothing in the percentages says it is half a molecule. Only the 194 on the mass spectrum doubles it.

Reference Table: Empirical vs Molecular Formulas

The compounds below appear in nearly every problem set. Empirical formula masses, molar masses and percentages were computed with IUPAC 2021 atomic weights (C 12.011, H 1.008, N 14.007, O 15.999, S 32.06, P 30.974) — the same values the molecular formula calculator uses — and rounded as shown. Use them to test the molecular formula calculator, set your own problems or check an answer.

Compound Empirical formula EFM (g/mol) Molar mass n Molecular formula Percent composition
Hydrogen peroxideHO17.00734.0142H2O2H 5.93, O 94.07
AcetyleneCH13.01926.0382C2H2C 92.26, H 7.74
BenzeneCH13.01978.1146C6H6C 92.26, H 7.74
StyreneCH13.019104.1528C8H8C 92.26, H 7.74
EthyleneCH214.02728.0542C2H4C 85.63, H 14.37
Butene / cyclobutaneCH214.02756.1084C4H8C 85.63, H 14.37
CyclohexaneCH214.02784.1626C6H12C 85.63, H 14.37
ButaneC2H529.06258.1242C4H10C 82.66, H 17.34
OctaneC4H957.116114.2322C8H18C 84.12, H 15.88
NaphthaleneC5H464.087128.1742C10H8C 93.71, H 6.29
FormaldehydeCH2O30.02630.0261CH2OC 40.00, H 6.71, O 53.28
Acetic acidCH2O30.02660.0522C2H4O2C 40.00, H 6.71, O 53.28
Lactic acidCH2O30.02690.0783C3H6O3C 40.00, H 6.71, O 53.28
RiboseCH2O30.026150.1305C5H10O5C 40.00, H 6.71, O 53.28
GlucoseCH2O30.026180.1566C6H12O6C 40.00, H 6.71, O 53.28
Ethylene glycolCH3O31.03462.0682C2H6O2C 38.70, H 9.74, O 51.55
Ethyl acetateC2H4O44.05388.1062C4H8O2C 54.53, H 9.15, O 36.32
Ascorbic acid (vitamin C)C3H4O388.062176.1242C6H8O6C 40.92, H 4.58, O 54.50
AspirinC9H8O4180.159180.1591C9H8O4C 60.00, H 4.48, O 35.52
CaffeineC4H5N2O97.097194.1942C8H10N4O2C 49.48, H 5.19, N 28.85, O 16.48
NicotineC5H7N81.118162.2362C10H14N2C 74.03, H 8.70, N 17.27
SucroseC12H22O11342.297342.2971C12H22O11C 42.11, H 6.48, O 51.41
Dinitrogen tetroxideNO246.00592.0102N2O4N 30.45, O 69.55
Phosphorus(V) oxideP2O5141.943283.8862P4O10P 43.64, O 56.36
Sulfur (rhombic)S32.06256.488S8S 100

Notice how much the table repeats itself in the first two columns: five compounds are CH2O, three are CH, three are CH2. Analysis alone cannot tell glucose from formaldehyde or benzene from acetylene. The n column is where the molar mass earns its keep, and it is the number the molecular formula calculator is really computing. You can regenerate any row with Mode 5, and any percent-composition entry can be pushed through Mode 2 with the molar mass to recover the molecular formula in the sixth column.

From Percent Composition to Molecular Formula in One Run

The complete textbook problem has two halves, and Mode 2 of the molecular formula calculator does both. The first half converts percentages into the empirical formula: assume 100 g so percentages become grams; divide each mass by the atomic mass to get moles; divide every mole value by the smallest; and if a ratio ends in .5, .33, .67 or .25, multiply the whole set by 2, 3 or 4 until every ratio is a whole number. The second half is n = M / EFM and the multiplication of the subscripts.

Stage Operation Nicotine: 74.03% C, 8.70% H, 17.27% N, M = 162.24
1% → g (assume 100 g)74.03 g C, 8.70 g H, 17.27 g N
2g → mol (÷ atomic mass)C 6.164, H 8.631, N 1.233 mol
3÷ smallestC 5.00, H 7.00, N 1.00
4Whole numbers → empirical formulaC5H7N, EFM 81.118 g/mol
5n = M / EFM162.24 / 81.118 = 2.000 → 2
6Subscripts × n → molecular formulaC10H14N2, DBE 5

Two refinements matter in practice, and both are options in the molecular formula calculator. First, if the percentages sum to noticeably less than 100 and oxygen was not reported, the shortfall is oxygen — CHN analysers do not measure it — and the tool’s “assign the remainder to oxygen” option handles this. Second, the rounding tolerance decides when a ratio such as 1.45 is accepted as 1.5 (×2) rather than rounded to 1; textbook data never need more than 0.05, but real analyses with ±0.3% error may need 0.15. The steps box names the multiplier used and the largest deviation so you can judge.

From Combustion Analysis to Molecular Formula

Organic compounds are analysed by burning a weighed sample in excess oxygen: all the carbon becomes CO2, all the hydrogen becomes H2O, nitrogen is collected as N2 and sulfur as SO2. The products are weighed, and the element masses follow from the fixed fraction of each product that is the element:

m(C) = m(CO2) × 12.011 / 44.009 = m(CO2) × 0.27292
m(H) = m(H2O) × 2.016 / 18.015 = m(H2O) × 0.11191
m(N) = m(N2)  |  m(S) = m(SO2) × 32.06 / 64.064
m(O) = m(sample) − m(C) − m(H) − m(N) − m(S)  (by difference — never from the oxygen in the products)

Burn 0.2500 g of an ester and collect 0.4995 g CO2 and 0.2045 g H2O. Carbon: 0.4995 × 0.27292 = 0.1363 g (0.01135 mol). Hydrogen: 0.2045 × 0.11191 = 0.02289 g (0.02270 mol). Oxygen by difference: 0.2500 − 0.1363 − 0.0229 = 0.0908 g (0.005675 mol). Divide by 0.005675: C 2.00, H 4.00, O 1.00 → C2H4O (44.05). With M = 88.11 g/mol, n = 2.00 and the molecular formula is C4H8O2 — ethyl acetate, or one of its several isomers. Mode 3 of the molecular formula calculator prints each of those lines and carries straight on to the molecular formula when M is supplied.

The molar mass for a combustion problem usually comes from a separate measurement quoted in the question — a mass spectrum, a vapour density, or a freezing-point depression. When it is missing, the tool stops at the empirical formula and lists the candidates (C2H4O, C4H8O2, C6H12O3 …) with the molar mass each would require, so a single later measurement settles the choice.

molecular formula calculator data sources: mass spectrum molecular ion peak, combustion analysis train and Dumas vapour density bulb giving the molar mass
Where the molar mass comes from: the molecular ion in a mass spectrum, the Dumas vapour-density bulb, and colligative measurements — each feeds a molecular formula calculator with the number that turns a ratio into a molecule.

From Gas Data and Vapour Density

Before mass spectrometers, the molar mass of any volatile compound was measured by weighing its vapour. Vaporise a known mass m in a bulb of volume V at temperature T and pressure P; the ideal gas law gives the amount, n = PV/RT, and therefore M = m/n = mRT/PV. Cannizzaro used exactly this reasoning in 1858 to settle the atomic weights, and it remains the fastest hand calculation of a molar mass from first principles.

M = mRT / PV   (R = 0.082057 L·atm·mol−1·K−1)   |   M = 2 × vapour density (relative to H2)

Take the molecular formula calculator’s own example, a hydrocarbon of empirical formula CH2: 1.000 g of its vapour occupies 0.436 L at 25 °C (298.15 K) and 1.00 atm. n = (1.00 × 0.436) / (0.082057 × 298.15) = 0.01782 mol, so M = 1.000 / 0.01782 = 56.1 g/mol. EFM of CH2 is 14.027, n = 56.1 / 14.027 = 4.00, and the molecular formula is C4H8. Mode 4 of the molecular formula calculator runs this with the temperature converted from °C automatically. Vapour density is even quicker: it is the mass of a volume of gas divided by the mass of the same volume of hydrogen, and since hydrogen is 2.016 g/mol, M ≈ 2 × VD. A vapour density of 141.9 for phosphorus(V) oxide vapour gives M = 283.8 and, from P2O5 (141.94), n = 2 → P4O10.

Gas data carry a caveat: real vapours near their boiling points are not ideal, and the molar mass from PV = nRT can be low by 1–3%. That is why n from a gas measurement often reads 5.9 or 2.05 rather than a clean integer, and why the tool’s tolerance exists. For a rigorous treatment of the correction see our van der Waals equation calculator; for the gas-density calculation in isolation, the molar mass from gas density page.

Degree of Unsaturation: The Built-in Sanity Check

Once a molecular formula calculator has produced a formula, one more piece of arithmetic tells you whether it can be a real neutral molecule and hints at its structure. The degree of unsaturation (also called double-bond equivalents, DBE, or the index of hydrogen deficiency) counts rings plus π bonds:

DBE = C + 1 + N/2 − H/2 − X/2   (X = halogens; oxygen and sulfur do not count)

A saturated acyclic hydrocarbon CnH2n+2 has DBE 0; each ring or double bond removes two hydrogens and adds 1; a triple bond adds 2; a benzene ring counts 4 (one ring plus three double bonds). Glucose C6H12O6: 6 + 1 − 6 = 1. Benzene C6H6: 6 + 1 − 3 = 4. Caffeine C8H10N4O2: 8 + 1 + 2 − 5 = 6. Aspirin C9H8O4: 9 + 1 − 4 = 6 (a benzene ring, two C=O). Nicotine C10H14N2: 10 + 1 + 1 − 7 = 5 (a pyridine ring, 4, and a pyrrolidine ring, 1).

The check is powerful because DBE must be a non-negative whole number for any neutral closed-shell molecule. If the molecular formula calculator reports DBE = 2.5 or −1, the formula cannot be a stable molecule: an odd number of hydrogens with no nitrogen means a radical or an ion, and a negative value means too many hydrogens for the carbons — both signs of a wrong n or a mistyped element. The tool prints DBE for every carbon-containing result and flags any that fails the test, which catches the classic error of multiplying by the wrong n before the formula ever reaches a report.

One Molecular Formula, Many Molecules

A molecular formula is a count, not a structure, and the number of distinct molecules sharing a count grows explosively with size. C4H10 has two isomers (butane and isobutane), C6H14 five, C10H22 seventy-five, and C20H42 more than 366,000. Add heteroatoms and functional groups and C6H12O6 covers glucose, fructose, galactose, mannose and their ring and chain forms — all identical to a molecular formula calculator, all sharply different to a living cell.

That is why the output of a molecular formula calculator is the beginning of an identification, not the end. It fixes the molar mass, the elemental composition and the degree of unsaturation; from there, infrared spectroscopy reveals the functional groups, NMR the carbon–hydrogen framework, and mass-spectral fragmentation the way the pieces are joined. In modern practice a high-resolution mass spectrum often gives the molecular formula directly, because an exact mass such as 180.0634 fits C6H12O6 and no other reasonable combination of C, H, N and O — a calculation our average vs monoisotopic mass guide explains — but the classical route through the empirical formula and molar mass is still what every chemistry course teaches, examines and uses when no spectrometer is to hand.

Who Uses a Molecular Formula Calculator?

  • High-school and first-year university students meet the empirical-to-molecular calculation in the stoichiometry unit of every syllabus — IGCSE, A-level, AP, IB, JEE, NEET, MDCAT — usually as a two-part question worth the most marks on the paper.
  • Organic and medicinal chemists combine a CHN analysis with a mass spectrum for every new compound; the calculated percentages for the proposed molecular formula (Mode 5) must match the found values within 0.4% before a journal accepts the structure.
  • Analytical laboratories characterising unknowns from combustion data and GC–MS molecular ions, where Mode 3 and Mode 1 reproduce the working an auditor wants to see.
  • Teachers and tutors who generate problems in Mode 5 (formula → percentages and M), then check student answers in Mode 2 with the printed steps as a marking scheme.
  • Anyone reading a label or a paper who wants the molar mass, composition or degree of unsaturation of a formula quickly, with the empirical formula and n thrown in.

Step-by-Step Walkthrough in the Tool

Suppose a liquid is found by combustion to contain 52.14% C and 13.13% H, with the remainder oxygen, and its vapour density is 23.0 — a typical exam problem for a molecular formula calculator. Here is the whole problem in the molecular formula calculator.

  1. Open Mode 2. Type C and 52.14 on the first row, H and 13.13 on the second. Set “If the percentages sum to less than 100%” to assign the remainder to oxygen; the tool assigns 34.73% to O.
  2. The molar mass from vapour density is 2 × 23.0 = 46.0 g/mol; type 46.0 in the molar mass box. (Or open Mode 4 later to have the tool do the doubling.)
  3. Press Calculate. Moles: C 4.341, H 13.026, O 2.171 → divided by 2.171: 2.000, 6.000, 1.000 → empirical formula C2H6O (46.069). n = 46.0 / 46.069 = 0.999 → 1 → molecular formula C2H6O; DBE = 2 + 1 − 3 = 0, a saturated acyclic molecule.
  4. Read the multiples table: n = 1 (46.07, −0.1%), n = 2 (92.14, +100%), n = 3 (138.21). The chosen row is unambiguous.
  5. Now the chemistry: C2H6O with DBE 0 is ethanol or dimethyl ether. A boiling point of 78 °C or an O–H stretch in the IR settles it as ethanol.
  6. Press Copy for the working or CSV for the per-element table; the result is also stored in the history strip.

Switch to Mode 5, type C2H6O and confirm the molar mass 46.069 g/mol and the same percentages. Forward and reverse agreeing is the cheapest confidence check there is.

A Short History: From Ratios to Molecules

For the first half of the nineteenth century chemists could measure ratios but could not agree on molecules — there was, in effect, an empirical formula calculator but no molecular formula calculator. Dalton’s atomic theory (1808) explained the fixed proportions Proust had measured, and Berzelius’s combustion analyses gave reliable empirical formulas by the 1820s, but without a way to count atoms per molecule, formulas were ambiguous by whole-number factors: water was written HO by some and H2O by others, acetic acid appeared in the literature with at least nineteen different formulas, and atomic weights differed by factors of two from one textbook to the next.

The resolution came from gases. Avogadro’s hypothesis (1811) — equal volumes of gases at the same temperature and pressure contain equal numbers of molecules — implied that gas density is proportional to molecular mass, but it was ignored for decades. Jean-Baptiste Dumas built the vapour-density apparatus in 1826 and Liebig made combustion analysis routine in 1831, yet it took Stanislao Cannizzaro’s pamphlet at the Karlsruhe Congress of 1860 to show that combining the two measurements fixes molecular formulas unambiguously. Within a decade the modern formulas of water, benzene and acetic acid were settled, Mendeleev had the atomic weights he needed for the periodic table, and the calculation that any molecular formula calculator performs today — empirical ratio times the integer from the molar mass — had become the standard first step in characterising any new compound. The mass spectrometer, from Aston’s first instrument in 1919 to modern high-resolution machines, changed only how the molar mass is measured, not the logic.

Limitations and Sources of Error

  • The molar mass carries the risk in any molecular formula calculator. A 5% error in M is harmless when EFM is large relative to M (n small), but for CH2 with M near 140 it makes n = 10 ± 0.5 and the formula uncertain. Look at the spacing of the multiples table.
  • Errors in the empirical formula propagate. A ratio wrongly rounded (1.33 → 1) gives an empirical formula mass a third too small and an n that is a non-integer by the same factor; the tool’s warning is the safety net, but it cannot repair mistyped percentages.
  • Non-ideal gases. Vapour-density molar masses are typically 1–3% low near the boiling point; a very light empirical unit combined with a heavy molecule may need the tolerance raised.
  • Formula, not structure. C2H6O is two compounds, C6H12O6 dozens; the molecular formula calculator cannot distinguish isomers, only constrain them through the degree of unsaturation.
  • Ionic and polymeric substances. Salts have no molecular formula, and polymers have a distribution of molar masses rather than one value (see our number average and polydispersity pages); for both, n is not meaningful.
  • Atomic weights. Using C = 12, O = 16 changes EFM by up to 0.1% — invisible in exams, visible against real analyses. The tool uses IUPAC 2021 conventional values throughout.

Practice Problems (With Answers)

Work each problem by hand first, then verify with the free molecular formula calculator above. Answers are hidden until you click.

Problem 1 — A compound has the empirical formula CH2 and a molar mass of 84.2 g/mol. What is its molecular formula?

EFM of CH2 = 12.011 + 2.016 = 14.027 g/mol. n = 84.2 / 14.027 = 6.00 → C6H12 (cyclohexane or a hexene; DBE = 1). Mode 1.

Problem 2 — Hydrogen peroxide is 5.93% H and 94.07% O; M = 34.01 g/mol. Find the empirical and molecular formulas.

Moles: H 5.93 / 1.008 = 5.883; O 94.07 / 15.999 = 5.880. Ratio 1 : 1 → empirical formula HO, EFM 17.007. n = 34.01 / 17.007 = 2.00 → H2O2. Mode 2 with M.

Problem 3 — Aspirin is 60.00% C, 4.48% H and 35.52% O; M = 180.16 g/mol. Find the molecular formula.

Moles: C 4.995; H 4.444; O 2.220. Divide by 2.220: C 2.25, H 2.00, O 1.00. The .25 means quarters → ×4 → C 9, H 8, O 4 → empirical formula C9H8O4, EFM 180.16. n = 180.16 / 180.16 = 1 → molecular formula C9H8O4 — the same. DBE = 9 + 1 − 4 = 6.

Problem 4 — A gas contains 30.45% N and 69.55% O. Its vapour density is 46.0. What is the molecular formula?

Moles: N 2.174; O 4.347; ratio 1 : 2 → NO2 (46.005). M = 2 × 46.0 = 92.0; n = 92.0 / 46.005 = 2.00 → N2O4. Mode 2 with M = 92.0, or Mode 4 with NO2 and VD 46.0.

Problem 5 — 0.2500 g of an ester gives 0.4995 g CO2 and 0.2045 g H2O on combustion; M = 88.1 g/mol. Find the molecular formula.

C: 0.4995 × 0.27292 = 0.1363 g (0.01135 mol). H: 0.2045 × 0.11191 = 0.02289 g (0.02270 mol). O by difference: 0.0908 g (0.005675 mol). Ratio 2 : 4 : 1 → C2H4O (44.05). n = 88.1 / 44.05 = 2 → C4H8O2; DBE 1 (the ester C=O). Mode 3.

Problem 6 — A hydrocarbon has the empirical formula C2H5. 2.000 g of its vapour occupies 0.842 L at 25 °C and 1.00 atm. Find the molecular formula.

n(gas) = PV/RT = (1.00 × 0.842) / (0.082057 × 298.15) = 0.03442 mol; M = 2.000 / 0.03442 = 58.1 g/mol. EFM of C2H5 = 29.062; n = 58.1 / 29.062 = 2.00 → C4H10, butane or isobutane (DBE 0). Mode 4, ideal gas.

Problem 7 — Nicotine is 74.03% C, 8.70% H and 17.27% N. A solution of 1.000 g in 50.0 g of water freezes at −0.229 °C (Kf = 1.86 °C·kg/mol). Find the molecular formula.

Molality = 0.229 / 1.86 = 0.1231 mol/kg; moles = 0.1231 × 0.0500 = 0.006156 mol; M = 1.000 / 0.006156 = 162.4 g/mol. Empirical formula from the percentages: C5H7N (81.118). n = 162.4 / 81.118 = 2.00 → C10H14N2. Enter 1.000 g and 0.006156 mol in Mode 4 (mass and moles) or type M directly in Mode 2.

Problem 8 — Sulfur vapour just above its boiling point has a molar mass of about 256 g/mol. What is the molecular formula of the vapour?

Empirical formula S, EFM 32.06. n = 256 / 32.06 = 7.99 → 8 → S8, the crown-shaped ring. Mode 2 with a single element (S, 100%) and M = 256 handles this, or Mode 1 with the formula S.

Problem 9 — A student reports that the empirical formula CH2O with M = 100 g/mol gives the molecular formula C3H6O3. What went wrong?

n = 100 / 30.026 = 3.33, which is not close to a whole number; rounding it to 3 is not justified. Either the molar mass is wrong (90.08 would give lactic acid, C3H6O3) or the empirical formula is wrong. The molecular formula calculator flags this case with a deviation of 0.33 and refuses to present the answer as clean.

Problem 10 — A compound CxHy has DBE 4 and molar mass 92.14 g/mol, and its empirical formula is C7H8. What is it?

EFM of C7H8 = 84.077 + 8.064 = 92.141 g/mol; n = 92.14 / 92.141 = 1.00 → molecular formula C7H8. DBE = 7 + 1 − 4 = 4, consistent with one benzene ring: toluene (methylbenzene). Mode 5 confirms M, DBE and n = 1.

Tips for Accurate Results

  • Always compute the empirical formula mass with at least four significant figures in the atomic masses (C 12.011, H 1.008, O 15.999, N 14.007); with C = 12 and H = 1, CH2 becomes 14.00 and n drifts.
  • Report n to two decimals before rounding, as the molecular formula calculator does. A value of 5.98 is a confident 6; a value of 5.6 is a question, not an answer.
  • Make sure the formula you divide into M is really the empirical formula. If you start from C2H4O2 instead of CH2O, n halves and you may still get a correct molecule — but you will get the wrong one for glucose (n = 3 gives C6H12O6 only by luck of the even multiple).
  • After multiplying, check three things: n × EFM equals M; the percent composition is unchanged; and the degree of unsaturation is a whole number ≥ 0.
  • In combustion problems convert CO2 and H2O to C and H first, take oxygen by difference from the sample mass, and keep grams and milligrams consistent.
  • When the molar mass comes from gas data, convert °C to kelvin and use R in the units of your pressure and volume (0.082057 L·atm/mol·K, or 8.314 J/mol·K with Pa and m³).
  • For vapour density, remember M = 2 × VD, not VD itself — the factor of two is the molar mass of H2.
  • Keep the molecular formula calculator’s tolerance at the default for textbook data; raise it only when you know the molar mass is approximate.

Common Mistakes

Mistake What happens Fix
Stopping at the empirical formulaCH2O reported for glucose; half the marks lostWhenever a molar mass is given, finish with n = M / EFM
Rounding a non-integer nn = 3.33 becomes 3 and a wrong formula is printed with confidenceTreat any deviation above about 0.1 as an error signal
Dividing M by the molar mass of the molecule instead of the EFMn = 1 alwaysThe denominator is the mass of one empirical unit
Multiplying only one subscript by nCH2O × 6 written as C6H2OEvery subscript is multiplied; check that the ratio is unchanged
Using vapour density as the molar massM half its true value; n halvesM = 2 × VD
Using °C in the ideal gas lawM wrong by a factor of T(K)/T(°C), often 10×Add 273.15
Rounding 1.33 or 1.5 in the empirical stepWrong EFM, then a non-integer nMultiply the ratio set by 3 or 2 first
Ignoring a fractional or negative DBEA formula that cannot exist as a neutral molecule goes unchallengedCompute C + 1 + N/2 − H/2 and require a whole number ≥ 0

Every row corresponds to a safeguard in the molecular formula calculator: it insists on the reduced empirical formula, reports n before rounding, flags deviations, doubles vapour density, converts temperature, and computes the degree of unsaturation for each result.

How This Calculator Is Different

Feature This calculator Generic molecular formula tool By hand
Empirical formula + M with reduced-formula check and integer warning✅ n shown before rounding, deviation and tolerance stated⚠️ Usually rounds silently✅ Fast
Percent composition → molecular formula in one run (6 elements, O by difference)✅ Both halves, all steps❌ Usually needs two separate toolsSlow
Combustion analysis with N and S, g or mg, mass-balance check✅ Built in, carried to the molecular formula❌ RareVery slow
Molar mass from ideal gas, vapour density or moles✅ Three methods, °C converted, M shown❌✅
Multiples table (EF)1, (EF)2 … with % gap from M, and bar chart✅ Shows how safe the rounding is❌—
Degree of unsaturation on every organic result✅ Flags impossible formulas❌✅ If remembered
Formula analyser: M, %, empirical formula, n, atoms, grams in sample; brackets and hydrates parse✅ Full periodic table⚠️ SometimesSlow
Copy / CSV / TXT / print / share, history, per-mode reset, no sign-up✅ All included❌ Final formula onlyYour notebook
Readable by AI assistants and answer engines✅ Plain-text summary and structured data on the page❌—

This molecular formula calculator belongs to a family of free tools on molecularweightcalculator.org. Its natural partner is the empirical formula calculator, which treats the first half of the problem in depth. For the masses that feed every calculation start with the molecular weight calculator and the atomic mass calculator; use the formula weight calculator for ionic solids and the molar mass of hydrates calculator for salt·xH2O; turn to grams to moles, molarity, stoichiometry and equivalent weight for the rest of the mole concept; find molar masses experimentally with the freezing point depression, boiling point elevation, osmotic pressure, vapor density, gas density and van der Waals equation tools; read the mass-spectrometry side in the exact mass, monoisotopic mass, isotopic mass and average vs monoisotopic mass guides; and for mixtures and polymers see average molecular weight of a mixture, number average, weight average, polydispersity index and viscosity molecular weight.

Where the Numbers Come From

The atomic weights in this molecular formula calculator are the IUPAC 2021 standard atomic weights, using the conventional value for elements published as an interval: H 1.008, C 12.011, N 14.007, O 15.999, S 32.06, Cl 35.45, and five significant figures for the others. Combustion-product molar masses follow directly (CO2 44.009, H2O 18.015, N2 28.014, SO2 64.064 g/mol). The gas constant is R = 0.082057 L·atm·mol−1·K−1, derived from the 2019 SI exact value 8.314462618 J·mol−1·K−1. Reference-table values were computed from these same constants, so the tool and the table agree to the last digit; textbooks that use C = 12.01 and O = 16.00 differ in the second decimal.

If you spot a discrepancy worth checking, our corrections policy explains how reports are handled, and the contact page is the fastest route to us. More about the site and its author is on the about page.

Trusted external references for further molecular formula calculator reading:

Exam Checklist

☐ I can define molecular formula, empirical formula and structural formula and give a compound for which the first two differ (H2O2 / HO) and one for which they are the same (H2O).
☐ I can compute an empirical formula mass from atomic masses to four significant figures.
☐ I can state and apply n = M / EFM, and I know n must be a whole number — the rule behind every molecular formula calculator.
☐ I can multiply every subscript by n and verify that n × EFM = M.
☐ I can carry a percent-composition or combustion problem all the way to the molecular formula when M is given.
☐ I can find M from gas data (M = mRT/PV), from vapour density (M = 2 × VD) and from a colligative measurement (M = m/n).
☐ I can compute the degree of unsaturation C + 1 + N/2 − H/2 − X/2 and use it to reject impossible formulas.
☐ I recognise a non-integer n as a warning, and I can name the usual causes: wrong M, wrong rounding in the empirical step, wrong atomic mass, vapour density not doubled.

Frequently Asked Questions

What is a molecular formula?

A molecular formula gives the actual number of atoms of each element in one molecule of a compound: H2O, C6H12O6, C8H10N4O2. It differs from the empirical formula, which gives only the simplest whole-number ratio (CH2O for glucose), and from the structural formula, which shows how the atoms are bonded. The molecular formula is always a whole-number multiple of the empirical formula.

How do I find the molecular formula from the empirical formula?

Add the atomic masses in the empirical formula to get the empirical formula mass, divide the molar mass by it, round the result to the nearest whole number n, and multiply every subscript by n. CH2O has EFM 30.03 g/mol; with M = 180.16 g/mol, n = 6 and the molecular formula is C6H12O6. Mode 1 of the molecular formula calculator does this and shows the steps.

Why must n be a whole number?

Because a molecule contains whole atoms. The molecular formula is n copies of the empirical unit, so n counts units and cannot be 2.4. If M / EFM is not close to an integer, the molar mass is wrong, the empirical formula was rounded incorrectly, or an atomic mass was misused. A deviation of a few hundredths is normal experimental scatter; a deviation of 0.3 or more is an error to find.

Can I get the molecular formula from percent composition alone?

No. Percent composition gives only the ratio of atoms, i.e. the empirical formula; formaldehyde, acetic acid and glucose all have the same percentages. You need one more piece of information, the molar mass, from mass spectrometry, gas density, vapour density or a colligative property. Mode 2 of the molecular formula calculator takes the percentages and the molar mass together and returns the molecular formula in one run.

Can the empirical and molecular formulas be the same?

Yes, whenever the subscripts share no common factor: H2O, NH3, CO2, C2H6O (ethanol), C9H8O4 (aspirin) and C12H22O11 (sucrose) all have n = 1. The calculation still has to be done to prove it.

How do I get the molar mass from vapour density or gas data?

Vapour density relative to hydrogen is M/2, so M = 2 × VD. From gas data, use the ideal gas law: M = mRT/PV with R = 0.082057 L·atm/(mol·K), T in kelvin, P in atm and V in litres. For 1.000 g of vapour occupying 0.436 L at 25 °C and 1.00 atm, M = 56.1 g/mol. Mode 4 performs both calculations and carries M through to the molecular formula.

What is the degree of unsaturation and why does the tool show it?

The degree of unsaturation (double-bond equivalents) is C + 1 + N/2 − H/2 − halogens/2 and counts the rings plus π bonds in a molecule: 0 for a saturated open chain, 1 for one ring or one double bond, 4 for a benzene ring. It must be a whole number ≥ 0 for any neutral molecule, so a fractional or negative value means the molecular formula is wrong — a quick check the molecular formula calculator applies to every organic result.

Does the molecular formula tell me which compound I have?

Not on its own. Isomers share a molecular formula: C2H6O is ethanol or dimethyl ether, C4H10 is butane or isobutane, C6H12O6 is glucose, fructose or galactose. The formula fixes the composition, molar mass and degree of unsaturation; spectroscopy (IR, NMR, MS fragmentation) settles the structure.

Do ionic compounds have molecular formulas?

Strictly no. Salts such as NaCl or CaCl2 are lattices without discrete molecules, so their formulas are formula units, always in the simplest ratio, and the idea of a multiplier n does not apply. Mode 5 will still give their molar mass (formula weight) and percent composition, but the n and degree-of-unsaturation readouts are meaningful only for molecular substances.

Which atomic masses does the calculator use?

The IUPAC 2021 standard atomic weights, with the conventional single value for interval elements: C 12.011, H 1.008, O 15.999, N 14.007, S 32.06, Cl 35.45. Using C = 12 and O = 16 instead shifts an empirical formula mass by up to 0.1%, which is invisible in exam problems but can matter when n is large or the molar mass is precise.

10 Facts Worth Knowing

  1. Before Cannizzaro’s 1858 pamphlet, acetic acid had been written with at least nineteen different formulas, because chemists could measure its composition but not its molecular mass.
  2. Avogadro’s hypothesis of 1811 — the key to turning gas density into molecular mass — was ignored for almost fifty years, largely because Dalton refused to believe that molecules of an element could contain two atoms.
  3. Benzene’s molecular formula C6H6 was established from vapour density in the 1830s, three decades before Kekulé proposed the ring; its empirical formula CH had been known even longer.
  4. Five common compounds — formaldehyde, acetic acid, lactic acid, ribose and glucose — share the empirical formula CH2O; only the molar mass (30, 60, 90, 150, 180 g/mol) separates them.
  5. C20H42 has 366,319 structural isomers, all with the same molecular formula and molar mass of 282.55 g/mol.
  6. High-resolution mass spectrometry can read a molecular formula directly: the exact mass 180.0634 fits C6H12O6 and no other plausible combination of C, H, N and O within 5 ppm.
  7. The “nitrogen rule” is a consequence of the degree-of-unsaturation formula: a neutral molecule with an odd nominal molecular mass must contain an odd number of nitrogen atoms.
  8. Phosphorus pentoxide keeps its historical name although the molecule is P4O10; the name records the empirical formula P2O5 found in the 1800s before vapour-density measurements doubled it.
  9. Sulfur vapour just above the boiling point is S8, but at higher temperatures the rings break down and the average molecular formula drifts through S6 and S2 — a case where n depends on temperature.
  10. Journals typically require calculated and found elemental percentages to agree within 0.4% before accepting a molecular formula — a standard set in Fritz Pregl’s micro-analysis era a century ago.

Final Thoughts

The molecular formula is where a ratio becomes a molecule. Everything before it — percentages, combustion masses, mole ratios — describes a compound only up to a whole-number factor; the single division n = M / EFM supplies that factor, and the requirement that it be an integer is the method’s own proofreader. Learn to compute the empirical formula mass carefully, to read n before rounding it, and to check the result with the degree of unsaturation, and every version of the problem — from a two-line exam question to a CHN report in a research paper — falls to the same short routine.

Bookmark this molecular formula calculator page for your next problem set or analysis, share it with a classmate before the stoichiometry exam, and explore the rest of our free chemistry tools — from the molecular weight calculator homepage to the empirical formula calculator that begins where this page ends. If a result surprises you, read the steps: the reason is almost always in n.

AR

Written & Reviewed By

Ahmad Raza, M.Phil. Chemistry

Ahmad is a chemistry educator and science content developer with over 10 years of experience teaching analytical and physical chemistry. He builds free calculation tools that help students and lab professionals work faster and make fewer errors. When he’s not balancing equations, he’s usually grading titration reports.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top