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
- Type a formula into the Chemical formula box, for example CO2, or tap an example chip like NaCl or C6H12O6.
- Use parentheses for grouped units such as Ca(OH)2, and a dot for hydrates such as CuSO4.5H2O.
- Read the molar mass shown in the highlighted panel, given in grams per mole.
- Scan the results table for each element's atom count, mass contribution in g/mol, and mass percent.
- 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
- Percent composition by mass, step by step
How to turn a chemical formula into the mass percent of each element, why it matters, and where the numbers can trip you up.
Related tools
Molar Mass Calculator
Calculate the molar mass and molecular weight of any chemical formula. Get a full per element breakdown for compounds like H2O, NaCl, H2SO4 and hydrates.
Empirical Formula Calculator
Find the empirical formula from percent composition or masses. Enter each element percent, like 40% C and 6.7% H, to get the lowest whole number ratio.
Mole Calculator
Convert between moles, mass and particles. Enter mass and molar mass, or moles, or a particle count, and get the rest using Avogadro's number.
555 Timer Calculator
Calculate 555 timer astable frequency, period, high and low times and duty cycle from R1, R2 and the timing capacitor. Free oscillator design helper.
Absolute Humidity Calculator
Calculate absolute humidity in grams of water vapor per cubic meter from air temperature and relative humidity. Fast, free and works in your browser.
Allele Frequency Calculator
Find allele frequencies from genotype counts. Enter the number of AA, Aa and aa individuals to get the A and a allele frequencies and allele totals.