Boneyard Tools

Percent Composition Calculator

Type a chemical formula such as H2O, CO2 or Ca(OH)2 to see the fraction of the total mass each element contributes. The calculator parses the formula, multiplies every element's standard atomic weight by its atom count, adds those up to get the molar mass, then divides each element's mass by that total. You get a table of atom counts, mass in grams per mole, and mass percent that sums to about 100 percent.

How to calculate percent composition

  1. Type a formula into the Chemical formula box, for example CO2, or tap an example chip like NaCl or C6H12O6.
  2. Use parentheses for grouped units such as Ca(OH)2, and a dot for hydrates such as CuSO4.5H2O.
  3. Read the molar mass shown in the highlighted panel, given in grams per mole.
  4. Scan the results table for each element's atom count, mass contribution in g/mol, and mass percent.
  5. Click Copy to put the molar mass and the full per-element breakdown on your clipboard.

Examples

Water

H2O
Molar mass 18.015 g/mol. H 11.19% (2.016 g/mol), O 88.81% (15.999 g/mol).

Carbon dioxide

CO2
Molar mass 44.009 g/mol. C 27.29% (12.011 g/mol), O 72.71% (31.998 g/mol).

Glucose

C6H12O6
Molar mass 180.156 g/mol. C 40.00%, H 6.71%, O 53.28% by mass.

Frequently asked questions

What is percent composition by mass?

It is the share of a compound's total mass that comes from each element. For one element it equals its combined mass in the formula divided by the molar mass, multiplied by 100. For water that means the two hydrogen atoms account for 11.19 percent and the single oxygen for 88.81 percent.

How does the calculator work out the numbers?

It parses the formula into element counts, multiplies each count by that element's standard atomic weight to get a mass in grams per mole, sums those masses into the molar mass, then divides every element mass by the molar mass and times 100. Molar mass and per-element mass are rounded to six figures and the percentages to two decimal places.

Which atomic weights do you use?

Standard atomic weights following the IUPAC conventional values, for example H 1.008, C 12.011, O 15.999 and Ca 40.078 g/mol. For elements with no stable isotope, the mass number of the most stable isotope is used, so results for radioactive elements are approximate.

Can I enter parentheses, brackets and hydrates?

Yes. Nested parentheses, square brackets and curly braces with multipliers all work, so Ca(OH)2 and K4[Fe(CN)6] parse correctly. Hydrate dot notation is supported with a middle dot, a period or an asterisk, so CuSO4.5H2O and CuSO4*5H2O both include the water of crystallisation.

Why do the percentages sometimes total 99.99 or 100.01?

Every atom's mass is part of the whole, so the true total is exactly 100 percent. Because each element percentage is rounded to two decimal places on its own, the displayed figures can add up to a hundredth above or below 100. The underlying calculation stays exact.

Is the formula case sensitive?

Yes, and it must be. Element symbols start with a capital letter and any following letters are lower case, so Co is cobalt while CO is one carbon and one oxygen. Writing co or cO is rejected as an unknown symbol.

What happens with an unknown or malformed formula?

The tool flags the problem instead of guessing. An unrecognised symbol, a mismatched bracket, or a stray character each raise a clear message, so you can fix a typo like H2o or Ca(OH2 before reading a result.

Does percent composition depend on how much sample I have?

No. It is an intensive property fixed by the formula, so a gram of pure glucose and a kilogram of pure glucose are both 40.00 percent carbon. Sample size only matters when you convert a percentage into an actual mass of an element.

Is my formula sent anywhere?

No. The parsing and the arithmetic run entirely in your browser using a built-in table of atomic weights, so nothing is uploaded and the tool keeps working offline once the page has loaded.

Learn more

Related tools