🔬
🔬 Science & engineering

Percent Composition Calculator (mass % of each element and grams in a sample)

Results update as you type.

Your numbers

Understanding the percent composition calculator — concept and principle

This calculator parses a chemical formula and gives the molar mass, the mass percent of each element and how many grams of each element a sample contains. It handles brackets and hydrates. Chemistry students use it for stoichiometry, empirical-formula problems and checking lab results.

Percent composition of glucoseWhat glucose is made ofFormulaC₆H₁₂O₆Sample25 gM = 72.066 + 12.096 + 95.994 = 180.156Oxygen53.284 %Carbon40.002 % · 10 gHydrogen6.714 % · 1.679 g
Hydrogen atoms are half the count but only about 7 % of the mass; oxygen is heaviest.

How it is calculated

Molar mass M = Σ (n × A)

Mass percent of element X = n_X × A_X ÷ M × 100

Grams of X in a sample = sample mass × percent ÷ 100

The principle

A chemical formula fixes the ratio of atoms. Multiplying each atom count by its atomic weight gives that element's share of the formula's mass, and dividing by the total gives its percent. Because every sample of a pure compound has the same composition (the law of definite proportions), these percentages apply to any amount of it.

Worked example

Default inputs: C₆H₁₂O₆ (glucose), sample 25 g.

  1. M = 6 × 12.011 + 12 × 1.008 + 6 × 15.999 = 180.156 g/mol; 3 elements, 24 atoms.
  2. C: 72.066 ÷ 180.156 = 40.002%, so 10 g in 25 g.
  3. H: 12.096 ÷ 180.156 = 6.714%, so 1.679 g.
  4. O: 95.994 ÷ 180.156 = 53.284%, so 13.321 g.

How to read the result

The percentages add up to 100%. Comparing measured percentages from elemental analysis with calculated values checks whether a compound is pure or confirms its formula. Going the other way, percent composition can be turned into an empirical formula.

Common mistakes

Keep in mind: Results depend on the formula being correct and the sample being pure.

Frequently asked questions

What percent of glucose is carbon?

About 40.0% by mass.

How do I enter a hydrate?

Use a dot, for example CuSO4·5H2O or CuSO4*5H2O.

Why do percentages from different tables differ slightly?

They use slightly different atomic weights.

Can I get an empirical formula from percentages?

Yes: divide each percent by its atomic weight and find the simplest whole-number ratio.

Sources: OpenStax, Chemistry 2e (2019), section 3.2 "Determining Empirical and Molecular Formulas" · IUPAC abridged standard atomic weights

Checked 9 Nov 2026. Mass percent from a formula: OpenStax, Chemistry 2e (2019), §3.2 “Determining Empirical and Molecular Formulas” (percent composition) — standard method. Atomic weights: IUPAC abridged standard atomic weights (the same table as our molar mass calculator).

🔬 All science & engineering tools →🌍 Calculators by country →