Molecular Formula Calculator

Determine the molecular formula and empirical formula of any chemical compound from its elemental composition, mass data, or compound name.

Try:
Molecular Weight
0.000 g/mol
Calculation Breakdown
Element Atomic Mass Atoms Total %
Total Molecular Weight
Elements in this compound
In formula
Other elements

Quick Examples

Click any compound to calculate its molecular weight instantly.

Water
H₂O
18.015 g/mol
Carbon Dioxide
CO₂
44.009 g/mol
Sodium Chloride
NaCl
58.443 g/mol
Glucose
C₆H₁₂O₆
180.156 g/mol
Ethanol
C₂H₅OH
46.069 g/mol
Sulfuric Acid
H₂SO₄
98.077 g/mol

How to Use the Molecular Formula Calculator

To find the molecular formula of a compound, enter its chemical formula or compound name into the input field and click "Calculate." The calculator identifies each element, counts the atoms, and returns the complete molecular formula with associated molar mass.

Follow these 5 steps to determine a molecular formula:

  1. Enter the chemical formula using standard notation. Write element symbols with an uppercase first letter and lowercase second letter (e.g., "Fe" for iron, "Ca" for calcium). Place subscript numbers directly after each element.
  2. For compounds with polyatomic groups, use parentheses followed by subscripts. Enter calcium hydroxide as "Ca(OH)2" and aluminum sulfate as "Al2(SO4)3".
  3. Press "Calculate" or hit Enter. The calculator parses the formula, resolves parenthetical groups, and identifies every element and its atom count.
  4. Review the molecular formula displayed in the results. The element tiles show each atom's symbol, atomic number, and mass contribution.
  5. Check the breakdown table for exact atomic masses, atom counts, subtotals, and percentage composition by mass for each element.

The percentage composition output is particularly useful for reverse calculations: confirming whether experimental composition data matches a proposed molecular formula.

How the Molecular Formula Calculator Works

The molecular formula calculator works by parsing a chemical formula string into its component elements and their atom counts. It applies standard chemical notation rules—element symbols, subscripts, parentheses, and hydrate dots—to build an accurate atom inventory.

The relationship between empirical formula and molecular formula follows this equation:

n
Scaling Factor
n = Molar Mass ÷ Empirical Formula Mass. This integer tells you how many empirical units fit inside one molecule.
EF
Empirical Formula
The simplest whole-number ratio of atoms derived from elemental analysis. Found by dividing each element's mole quantity by the smallest mole quantity.
MF
Molecular Formula
Molecular Formula = n × Empirical Formula. Shows the actual number of atoms of each element in one molecule of the compound.
%
Percent Composition
Mass % of element = (atoms × atomic weight ÷ molar mass) × 100. Connects the molecular formula back to measurable lab data.

When you enter a known formula like C₆H₁₂O₆ (glucose), the calculator confirms that carbon makes up 40.00%, hydrogen 6.71%, and oxygen 53.29% of the total mass (180.156 g/mol). These percentages match the standard elemental analysis results for glucose, verifying the molecular formula.

The calculator supports formulas ranging from simple diatomic molecules like O₂ to complex coordination compounds and hydrated salts. It handles nested parentheses such as Ca₃(PO₄)₂ and multi-group hydrates like FeSO₄·7H₂O.

Common Compound Molecular Weights

Reference table of frequently searched chemical compounds.

Chemical Formula Compound Name Molecular Weight
H₂O Water 18.015 g/mol
CO₂ Carbon Dioxide 44.009 g/mol
NaCl Sodium Chloride 58.443 g/mol
NH₃ Ammonia 17.031 g/mol
CH₄ Methane 16.043 g/mol
H₂SO₄ Sulfuric Acid 98.077 g/mol
CaCO₃ Calcium Carbonate 100.086 g/mol
C₆H₁₂O₆ Glucose 180.156 g/mol
C₂H₅OH Ethanol 46.069 g/mol
HCl Hydrochloric Acid 36.461 g/mol
NaOH Sodium Hydroxide 39.997 g/mol
Ca(OH)₂ Calcium Hydroxide 74.092 g/mol
HNO₃ Nitric Acid 63.012 g/mol
KMnO₄ Potassium Permanganate 158.032 g/mol
CuSO₄ Copper(II) Sulfate 159.607 g/mol

Explore Related Chemistry Calculators

Specialized calculation tools designed for molecular biology, biochemistry, and stoichiometry.

Molecular Formula Calculator FAQs and Common Questions

Answers to common questions about finding molecular formulas, empirical formulas, and interpreting composition data.

What is a molecular formula and how does it differ from an empirical formula?
A molecular formula shows the exact number of each type of atom in a single molecule. An empirical formula shows the simplest whole-number ratio of atoms. For example, glucose has the molecular formula C₆H₁₂O₆ and the empirical formula CH₂O. The molecular formula is always a whole-number multiple of the empirical formula.
How do I determine a molecular formula from percent composition?
To determine a molecular formula from percent composition: convert each element's mass percentage to grams (assume a 100 g sample). Divide each element's mass by its atomic weight to get moles. Divide all mole values by the smallest mole value to get the simplest ratio. Round to the nearest whole number for the empirical formula. Multiply by the ratio of the compound's known molar mass to the empirical formula mass to get the molecular formula.
Can this calculator find the molecular formula of an unknown compound?
Yes, if you provide the elemental composition (as mass percentages or mass values) and the compound's molar mass. The calculator converts composition data into mole ratios to determine the empirical formula, then scales it using the molar mass to produce the molecular formula.
What information do I need to calculate a molecular formula?
You need 2 pieces of information: the elemental composition (mass percentages or mass of each element in a sample) and the compound's molar mass (from mass spectrometry or another measurement). The composition gives the empirical formula; the molar mass converts it to the molecular formula.
Why might a molecular formula differ from an empirical formula?
A molecular formula differs from an empirical formula when the true number of atoms in one molecule is a multiple of the simplest ratio. Acetic acid (C₂H₄O₂) has the empirical formula CH₂O. Ribose (C₅H₁₀O₅) also shares the same empirical formula. The molecular formula preserves structural and stoichiometric detail that the empirical formula omits.