Percent Composition Calculator

Get molar mass and the mass percent of each element from a formula.

Chemistry and LabUpdated 2026-10-203 min read
Percent Composition Calculator
Use element symbols and integer subscripts. Parentheses are supported, as in Ca(OH)2. Hydrates with a dot are not.
Molar mass
...
Mass percent by element...
Largest share by mass...

What it does

Percent composition tells you how much of a compound's mass comes from each element. It is a bridge between a chemical formula and a laboratory measurement. A formula gives the atom counts; percent composition gives the mass share you would expect for each element.

The calculation uses the molar mass. For each element, multiply its atomic weight by the number of atoms in the formula. Add those masses to get the molar mass of the compound. Then divide each element's mass by the total and multiply by 100.

Glucose is the default. Its formula is C6H12O6. Carbon contributes 6 x 12.011 = 72.066 g/mol, hydrogen contributes 12 x 1.008 = 12.096 g/mol, and oxygen contributes 6 x 15.999 = 95.994 g/mol. The total is 180.156 g/mol. The mass shares are 40.00% carbon, 6.71% hydrogen, and 53.28% oxygen.

The result is a theoretical composition based on the formula. A real sample can differ because of impurities, moisture, isotopes, or measurement error. The atomic weights used here are standard values, and different periodic tables can change the last digit. The tool supports parentheses and integer subscripts, but not hydrates, charges, or isotopes.

How to use

  1. Enter a chemical formula, such as C6H12O6 or Ca(OH)2.
  2. Use uppercase for the first letter of each element and lowercase for the second, as in Na or Cl.
  3. Add integer subscripts after an element or a closing parenthesis. A missing subscript means 1.
  4. Read the molar mass first.
  5. Read the mass percent for each element and check that the shares are reasonable.
  6. Use the largest share to identify the element that contributes most of the mass.

Formula

Molar mass = sum(atomic weight x subscript). Mass percent of element = (mass of element in one mole / molar mass) x 100.
M
Molar mass of the compound in grams per mole.
n_i
Number of atoms of element i in the formula.
A_i
Atomic weight of element i in grams per mole.
m_i
Mass of element i in one mole, n_i x A_i.
%i
Mass percent of element i, m_i / M x 100.

Parentheses multiply the counts inside them. In Ca(OH)2, the O and H counts are each multiplied by 2. A subscript after an element applies only to that element. Hydrates written with a dot, such as CuSO4.5H2O, are not supported because the parser cannot tell a hydrate coefficient from a subscript without more rules.

Worked example

Example: percent composition of glucose, C6H12O6

Formula C6H12O6. Atomic weights: C 12.011, H 1.008, O 15.999.

  1. Carbon mass: 6 x 12.011 = 72.066 g/mol.
  2. Hydrogen mass: 12 x 1.008 = 12.096 g/mol.
  3. Oxygen mass: 6 x 15.999 = 95.994 g/mol.
  4. Molar mass: 72.066 + 12.096 + 95.994 = 180.156 g/mol.
  5. Carbon percent: 72.066 / 180.156 x 100 = 40.00%. Hydrogen: 12.096 / 180.156 x 100 = 6.71%. Oxygen: 95.994 / 180.156 x 100 = 53.28%.
  6. The tool shows 180.156 g/mol, C 40.00%, H 6.71%, O 53.28%, and oxygen as the largest share.

Reference table

Percent composition of common compounds
CompoundFormulaMolar massMass percent
WaterH2O18.015 g/molH 11.19%, O 88.81%
Sodium chlorideNaCl58.440 g/molNa 39.34%, Cl 60.66%
GlucoseC6H12O6180.156 g/molC 40.00%, H 6.71%, O 53.28%
AspirinC9H8O4180.159 g/molC 60.00%, H 4.48%, O 35.52%
UreaCH4N2O60.056 g/molC 20.00%, H 6.71%, N 46.65%, O 26.64%

Limits

  • The formula parser supports element symbols, integer subscripts, and parentheses. It does not support hydrates, charges, isotopes, or fractional subscripts.
  • The built-in atomic-weight table covers common elements including H, C, N, O, Na, Mg, Al, Si, P, S, Cl, K, Ca, Fe, Cu, and Zn. Other elements return an error.
  • The result is a theoretical mass percent from standard atomic weights, not a laboratory analysis.
  • Atomic weights vary slightly by source and by isotopic composition, so the last digit can differ.
  • The tool does not check whether the formula is chemically reasonable or charge balanced.

Common mistakes

  • Multiplying the atomic weight by the element symbol instead of its subscript.
  • Forgetting to multiply every element inside parentheses by the subscript outside.
  • Using the mass of the element in the sample instead of the mass in one mole of the formula.
  • Dividing by the element mass instead of the compound's molar mass.
  • Expecting the percentages to sum to exactly 100.00 after rounding.

Try it yourself

Quick checks. Answers sit tucked under each question.

What is the percent composition of water, H2O?

Molar mass is 18.015 g/mol. Hydrogen is 11.19% and oxygen is 88.81%.

What is the percent composition of calcium hydroxide, Ca(OH)2?

Molar mass is 74.092 g/mol. Calcium is 54.09%, oxygen is 43.19%, and hydrogen is 2.72%.

What is the percent composition of ammonium sulfate, (NH4)2SO4?

Molar mass is 132.134 g/mol. Nitrogen is 21.20%, hydrogen is 6.10%, sulfur is 24.26%, and oxygen is 48.43%.

Questions

What is percent composition?

It is the mass percentage of each element in a compound. It is calculated from the formula and the atomic weights.

How do I find percent composition from experimental data?

Divide the mass of each element by the total mass of the sample and multiply by 100. The formula method on this page gives the theoretical value.

Why do the percentages sometimes add to 99.99 or 100.01?

Each percentage is rounded to two decimals. The small gap is rounding error, not a missing element.

Can I enter a formula with parentheses?

Yes. For Ca(OH)2, the parser multiplies the O and H counts by 2. Nested parentheses also work.

Can I enter a hydrate?

No. A dot in a formula, such as CuSO4.5H2O, is rejected because the parser does not treat the dot as a hydrate separator. Enter the anhydrous formula or calculate the water separately.

Does the tool use the same atomic weights as my textbook?

It uses standard atomic weights. Small differences in the last digit can come from the source or from rounding.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.