Audited ·Last updated 29 Jul 2026·6 citations·Tier 1·0 uses

Percent Composition Calculator

Enter a chemical formula and get the mass percent of every element in it, plus the grams of any element in a sample of that compound.

Percent Composition Calculator

Hill/IUPAC notation, case sensitive: Co is cobalt, CO is carbon monoxide. Parentheses and nesting both work, e.g. Al2(SO4)3 or K3(Fe(CN)6). Write hydrates in expanded form — CuSO4·5H2O becomes CuSO4(H2O)5. Repeated symbols are added up, so NH4NO3 is read as 2 N, 4 H, 3 O.
The element whose percentage becomes the headline result. Every element's percentage is listed in the breakdown regardless. Symbols are case-sensitive: N is nitrogen, Na is sodium.
Optional. Enter a mass of the compound and the calculator also reports how many grams of the featured element that sample contains. The default of 100 g is chosen so the answer equals the percentage — the '100 gram basis' every textbook uses. Set it to 0 to skip.
g
Mass percent
35.00
Mass of the featured element per 100 g of compound. This is a MASS fraction, not a mole fraction — water is 11.19% hydrogen by mass but 66.7% hydrogen by atom count.
Full composition
H 5.0373 %, N 34.9987 %, O 59.964 %
Molar mass
80.043 g/mol
Element mass per mole
28.014 g/mol
Element in your sample
34.9987 g
Atoms per formula unit
2
Distinct elements
3

Background.

Percent composition is the percentage by mass of each element in a compound. Enter a chemical formula and this calculator returns the mass percent of every element in it, the molar mass it was computed from, and — if you give it a sample mass — how many grams of any one element that sample actually contains. It is the direct answer to questions like 'how much nitrogen is in ammonium nitrate?', 'what fraction of this ore is iron?' and 'how many grams of copper are in 50 g of copper sulfate?'.

The calculation is one line. For any element E in a compound, the mass percent is the element's atomic weight times how many of its atoms appear in one formula unit, divided by the compound's molar mass, times 100. Ammonium nitrate NH₄NO₃ contains two nitrogens — one in the ammonium ion and one in the nitrate — so its nitrogen contribution is 2 × 14.007 = 28.014 g per 80.043 g of compound, which is 34.998 percent. That is the number behind the '34-0-0' grade printed on a bag of AN fertiliser, and the small gap between the theoretical 35.00 percent and the labelled 34 percent is exactly what an agronomist is looking at when comparing nitrogen sources on a cost-per-kilo-of-N basis.

WHAT THIS PAGE IS NOT, stated here rather than in a collapsed FAQ. This is ELEMENTAL composition of a pure compound, computed from its formula. It is not the mass percent of a solute in a solution — mass of solute divided by mass of solution, the w/w percent that appears on a bottle of hydrochloric acid — which is a different quantity computed from different inputs. And it is a MASS basis, not a mole basis: water is 11.19 percent hydrogen by mass but two atoms in three, 66.7 percent, by count. Mass percent and mole percent are different numbers for the same substance and are not interchangeable.

UNITS AND CONVENTIONS. Formula subscripts are dimensionless counts; atomic weights, the molar mass and the per-mole element mass are in g/mol; the sample mass and the element mass in it are in grams; percentages are percentage points. There is no temperature or pressure basis anywhere on this page — a composition is fixed by the formula and does not change with conditions. Atomic weights come from the CIAAW Abridged Standard Atomic Weights 2024 table, which is the IUPAC Atomic Weights 2021 recommendation with the 2024 revisions to gadolinium, lutetium and zirconium. Elements with no IUPAC standard atomic weight — technetium, promethium, polonium, astatine, radon, francium, radium, actinium and everything heavier than uranium — are refused with an explicit error rather than given an invented value.

A PROPERTY WORTH USING AS A CHECK: the percentages of all elements in a compound sum to exactly 100, because the numerators partition the denominator. If you add up a published analysis and it does not reach 100, an element is missing — and in combustion analysis the missing element is almost always oxygen, which the technique does not measure directly and which is conventionally found by difference. That is the hand-off to the empirical formula calculator, which runs this calculation backwards: give it percentages and it gives you the formula.

READING THE ATOM COUNT OUTPUT. The 'atoms per formula unit' figure exists to catch the most common input error, which is a formula the parser read differently from how you meant it. NH₄NO₃ has two nitrogens and it is easy to type NH4N03 (with a zero) or to forget that the multiplier after a parenthesis applies to everything inside it — Ca(OH)₂ is two oxygens and two hydrogens, not one oxygen and two hydrogens. If the atom count does not match what you intended, fix the formula before reading any of the percentages.

ON ROUNDING. Nothing is rounded during the calculation. The atomic-weight sum, the molar mass and every percentage are carried at arbitrary decimal precision and rounded once, at the end, to ten decimal places. The composition breakdown STRING is shortened to four decimal places purely so it fits on a line; that formatting is display-only and never feeds a numeric output. Report your answer to the significant figures the atomic weights justify — four is almost always the honest ceiling, and for elements whose standard atomic weight CIAAW publishes as an interval rather than a single value (hydrogen, lithium, boron, carbon, nitrogen, oxygen, magnesium, silicon, sulfur, chlorine, argon, bromine, thallium and lead), the real uncertainty in the fourth digit can exceed what the conventional value suggests.

What is percent composition calculator?

Percent composition, sometimes called percentage composition by mass or percent by mass, is the mass fraction of each element in a compound expressed as a percentage. IUPAC's formal term for the underlying quantity is MASS FRACTION, symbol w, defined in the Gold Book as the 'mass of a constituent divided by the total mass of all constituents in the mixture' and sourced to the Green Book; mass percent is that fraction multiplied by 100. For a pure compound of known formula the mass fraction of element E is w(E) = n(E) × A(E) / M, where n(E) is the number of E atoms per formula unit, A(E) is E's standard atomic weight, and M is the compound's molar mass. Three distinctions matter. First, mass basis versus mole basis: the mass fraction of hydrogen in water is 2 × 1.008 / 18.015 = 0.1119, while the MOLE fraction of hydrogen atoms is 2/3 = 0.667. Both are legitimate quantities; they are not the same number and confusing them is a common source of error. Second, elemental composition versus solution concentration: this page computes the former. The 'mass percent' printed on a reagent bottle (37 percent HCl) is the latter — mass of solute over mass of solution — and is a property of a mixture you made, not of a compound. Third, theoretical versus measured: the percentages here are theoretical, derived from the formula and the periodic table. A real elemental analysis of a real sample will differ, and the size of that difference is precisely how purity is assessed — a combustion analysis agreeing with theory to within 0.4 percentage points on carbon is the conventional bar for reporting a new compound as pure.

How to use this calculator.

  1. Type the chemical formula in Hill/IUPAC notation. Capitalisation matters: Co is cobalt, CO is carbon monoxide, and Na is sodium while NA is nothing.
  2. Use parentheses for repeated groups, and remember the multiplier applies to everything inside: Ca(OH)2 is one calcium, two oxygens and two hydrogens.
  3. Write hydrates in expanded form. CuSO4·5H2O becomes CuSO4(H2O)5; the centred dot is not parsed.
  4. Enter the element you want featured as the headline percentage. Every element appears in the breakdown regardless of what you choose here.
  5. Check the 'atoms per formula unit' output against what you intended. This is the fastest way to catch a formula the parser read differently from how you meant it.
  6. Optionally enter a sample mass to get the grams of the featured element in that sample. Leaving it at 100 g makes the answer equal the percentage, which is the 100 gram basis textbooks use.
  7. Add up the breakdown percentages as a check — they must come to exactly 100.
  8. To go the other way, from measured percentages to a formula, use the empirical formula calculator.

The formula.

%(E) = [ n(E) × A(E) ] ÷ M × 100

For a compound whose formula gives n(E) atoms of element E per formula unit, the mass of E in one mole of compound is n(E) × A(E) grams, where A(E) is E's standard atomic weight in g/mol. The compound's molar mass is the sum of that quantity over all its elements, M = Σ n(i) × A(i). The mass fraction of E is therefore w(E) = n(E) × A(E) / M, and the mass percent is 100 × w(E).

Because the numerators n(i) × A(i) partition the denominator M exactly, the percentages of all elements sum to precisely 100. That is not an approximation and it is worth using as a check on any composition you are handed.

WORKED THROUGH, for ammonium nitrate NH₄NO₃. The parser reads the formula left to right and ADDS repeated symbols, so NH₄NO₃ becomes 2 N, 4 H and 3 O — not 1 N. The molar mass is 2 × 14.007 + 4 × 1.008 + 3 × 15.999 = 28.014 + 4.032 + 47.997 = 80.043 g/mol. Nitrogen's share is 28.014 / 80.043 × 100 = 34.9987 percent; hydrogen's is 4.032 / 80.043 × 100 = 5.0373 percent; oxygen's is 47.997 / 80.043 × 100 = 59.9640 percent. Those three add to 100.0000.

UNITS. Subscripts are pure counts. Atomic weights, the element mass per mole and the molar mass are all in g/mol, so the ratio in the formula is dimensionless and the ×100 puts it in percentage points. The sample-mass outputs are grams: mass of E in the sample = sample mass × w(E), which is g × (dimensionless) = g.

MASS BASIS, NOT MOLE BASIS. This is the distinction that trips people. The mass fraction of hydrogen in water is 2 × 1.008 / 18.015 = 0.1119, so water is 11.19 percent hydrogen BY MASS. Two of water's three atoms are hydrogen, so it is 66.7 percent hydrogen BY MOLE FRACTION. Both statements are true and they describe different quantities. Elemental analysis, fertiliser grades, ore assays and pharmacopoeial assays are all mass-based; reaction stoichiometry is mole-based.

ROUNDING STAGE. No intermediate rounding. The atomic-weight sum, the molar mass, every percentage and the sample-mass conversion are all carried at arbitrary decimal precision and rounded once, at the return boundary, to ten decimal places. The composition breakdown string is separately truncated to four decimal places so it fits on one line; that is display formatting only and never feeds a numeric output.

SIGNIFICANT FIGURES. Four significant figures is almost always the honest ceiling, because that is roughly where the standard atomic weights themselves stop being sharp. For the fourteen elements whose standard atomic weight CIAAW publishes as an INTERVAL rather than a single value — hydrogen, lithium, boron, carbon, nitrogen, oxygen, magnesium, silicon, sulfur, chlorine, argon, bromine, thallium and lead — the genuine uncertainty in the fourth digit can be larger than the conventional single value implies. This calculator uses the conventional (abridged) values, which is what every textbook quotes.

INVALID DOMAIN. An empty or unparseable formula, an unbalanced parenthesis, a stray character, an unknown element symbol, a subscript of zero, an element that does not appear in the formula you entered, a wrongly-cased symbol, and a negative sample mass all raise a field error naming the specific fault. Elements with no IUPAC standard atomic weight are refused rather than guessed. A sample mass of exactly zero is accepted and simply reports 0 g of the element.

A worked example.

Example

Worked example — nitrogen in ammonium nitrate, the fertiliser sold as grade '34-0-0'. Type NH4NO3 and choose N. The parser adds the two separate nitrogen symbols together, so the formula unit is 2 N, 4 H and 3 O — the 'atoms per formula unit' output reads 2, which is the check that the formula was read correctly. Using the CIAAW abridged 2024 atomic weights (N = 14.007, H = 1.0080, O = 15.999), the molar mass is 2 × 14.007 + 4 × 1.008 + 3 × 15.999 = 28.014 + 4.032 + 47.997 = 80.043 g/mol. Nitrogen contributes 28.014 g of every 80.043 g, so the mass percent is 28.014 / 80.043 × 100 = 34.9987 percent. The breakdown line reads 'H 5.0373 %, N 34.9987 %, O 59.964 %' — Hill order puts hydrogen first here because the compound contains no carbon and the remaining symbols sort alphabetically — and those three figures add to exactly 100.0000. With the sample mass left at the default 100 g, the 'element in your sample' output also reads 34.9987 g, which is the whole point of the 100 gram basis: on 100 g the percentage and the mass are the same number. Change the sample mass to 50000 g, a 50 kg bag, and it becomes 17499.34 g — just under 17.5 kg of nitrogen per bag. That is the number a grower needs to compare AN against urea, CO(NH2)2, which this calculator gives as 46.6465 percent nitrogen: urea carries a third more nitrogen per kilogram of product, which is why it dominates where freight cost matters. Two more checks worth running. Aspirin, C9H8O4 with C selected, returns 60.0020 percent carbon, 4.4760 percent hydrogen and 35.5220 percent oxygen against a molar mass of 180.159 g/mol — the figures OpenStax prints as 60.00, 4.476 and 35.52. And hematite, Fe2O3 with Fe selected, returns 69.9431 percent iron, the theoretical grade of a pure iron ore.

formulaNH4NO3
sample Mass100
elementN

Frequently asked questions.

How do you calculate percent composition?
For each element, multiply its standard atomic weight by how many of its atoms are in one formula unit, divide by the compound's molar mass, and multiply by 100. For nitrogen in NH₄NO₃: there are two nitrogens, so 2 × 14.007 = 28.014 g per formula unit; the molar mass is 80.043 g/mol; 28.014 / 80.043 × 100 = 34.9987 percent. Repeat for every element and the results must add to exactly 100, because the numerators partition the denominator. That sum is the single best check on the whole calculation — if it does not reach 100, either an element was left out or a subscript was misread.
Is percent composition by mass or by moles?
By mass, always, when the term is used without qualification — and this page reports mass percent. The two are genuinely different numbers. Water, H₂O, is 2 × 1.008 / 18.015 = 11.19 percent hydrogen BY MASS, because hydrogen atoms are light. But two of water's three atoms are hydrogen, so it is 66.7 percent hydrogen BY MOLE FRACTION. Both statements are correct and they answer different questions. Mass percent is what elemental analysis measures, what fertiliser grades quote, what ore assays report and what pharmacopoeias specify. Mole fraction is what you want for reaction stoichiometry, gas partial pressures and colligative properties. IUPAC's formal name for the underlying quantity here is the mass fraction w, defined as the mass of a constituent divided by the total mass of all constituents.
Why does NH4NO3 give two nitrogens?
Because the parser reads the formula left to right and adds up every occurrence of a symbol, which is what the chemistry requires. NH₄NO₃ is the ammonium salt of nitric acid: one nitrogen sits in the ammonium cation NH₄⁺ and one in the nitrate anion NO₃⁻, so a formula unit contains two nitrogen atoms in total. The same applies to any formula where a symbol appears more than once. This page shows the atom count as its own output precisely so that you can confirm the parser read your formula as you intended before trusting the percentages. If you meant something else, the formula is wrong rather than the parser.
Is this the same as mass percent of a solution?
No, and mixing them up is the most common misuse of the phrase. This page computes ELEMENTAL composition: the mass fraction of each element in a pure compound, fixed by its chemical formula and unchangeable. A solution's mass percent — the w/w figure on a bottle of 37 percent hydrochloric acid or 30 percent hydrogen peroxide — is mass of solute divided by mass of solution, a property of a mixture you prepared, and it can be anything you choose. Different inputs, different formula, different meaning. If you want to know how concentrated a solution is, that is a solution-concentration calculation; if you want to know what a compound is made of, that is this page.
Why does percent nitrogen in fertiliser matter?
Because fertiliser is priced by the tonne of product but used by the kilogram of nutrient, so the percentage is what makes two products comparable. Ammonium nitrate is 34.9987 percent nitrogen theoretically, which is why it is graded 34-0-0 in the N-P-K system — the small shortfall against theory is coating, anti-caking agents and moisture. Urea, CO(NH₂)₂, comes out of this calculator at 46.6465 percent nitrogen, so a tonne of urea delivers about a third more nitrogen than a tonne of AN and can justify a proportionally higher price. Calcium ammonium nitrate, ammonium sulfate and DAP all sit at different percentages. Note that the calculator gives the THEORETICAL figure for a pure compound; a real product is a formulation and its label grade is the number to use for a purchase decision.
Do the percentages always add up to exactly 100?
For a formula, yes, exactly — not approximately. Each element's numerator is n(E) × A(E) and the denominator is the sum of all those numerators, so the fractions partition the whole by construction. Any shortfall you see in a printed table is rounding in the display, not in the chemistry. For a MEASURED analysis it is different: a real combustion analysis reports carbon, hydrogen and nitrogen but not oxygen, so the measured percentages fall short of 100 by roughly the oxygen content, which is then found by difference. That gap is informative rather than an error — it is how oxygen gets into an empirical formula at all, and it is the input the combustion analysis calculator is built around.
How many significant figures should I report?
Four is almost always the honest ceiling, because that is roughly where the standard atomic weights themselves stop being sharp. For fourteen elements — hydrogen, lithium, boron, carbon, nitrogen, oxygen, magnesium, silicon, sulfur, chlorine, argon, bromine, thallium and lead — CIAAW publishes the standard atomic weight as an INTERVAL rather than a single value, because their natural isotopic composition varies measurably between terrestrial sources. This calculator uses the conventional single values that every textbook quotes, but for those elements the genuine uncertainty in the fourth digit can be larger than the value implies. Reporting 34.9987 percent nitrogen suggests a precision the underlying constants do not support; 35.00 percent is the honest statement.
How do I handle a hydrate like CuSO4·5H2O?
Write it in expanded form — CuSO4(H2O)5 — because the centred dot is not parsed. The waters of crystallisation are genuinely part of the solid you weigh, so they belong in the formula and in the percentages: copper is 39.8153 percent of anhydrous CuSO₄ (M = 159.602 g/mol) but only 25.4513 percent of the pentahydrate (M = 249.677 g/mol), because the five waters add 90.075 g/mol of mass that contains no copper at all. Weighing out pentahydrate crystals while using the anhydrous percentage leaves you 36 percent short on copper — 25.4513 / 39.8153 = 0.639. Always check the bottle label — 'anhydrous' means no water, and a '·xH₂O' on the label tells you the formula unit to type.
Where do the atomic weights come from?
From the CIAAW Abridged Standard Atomic Weights 2024 table — the IUPAC Commission on Isotopic Abundances and Atomic Weights recommendation published as Atomic Weights 2021 (Pure Appl. Chem. 93(5), 573, doi:10.1515/pac-2019-0603), with the 2024 revisions to gadolinium, lutetium and zirconium. The named revision matters at the fourth digit: lithium is 6.94 in the current table rather than the 6.941 that pre-2009 textbooks print, ytterbium is 173.05 rather than 173.04, and zirconium became 91.222 in 2024. Elements with no standard atomic weight at all — technetium, promethium, polonium, astatine, radon, francium, radium, actinium and the transuranics — are refused with an explicit error, because no natural-abundance molar mass exists for them and inventing one would produce a confidently wrong percentage.

References& sources.

  1. [1]Flowers, P., Theopold, K., Langley, R. & Robinson, W. R. (2019). Chemistry 2e, Section 3.2 'Determining Empirical and Molecular Formulas'. OpenStax, Rice University. Peer-reviewed, CC BY 4.0. PRIMARY SOURCE: defines percent composition as 'the percentage by mass of each element in the compound', and works Example 3.10 (aspirin C9H8O4 → 60.00 % C, 4.476 % H, 35.52 % O) and its Check Your Learning (Fe2O3 → 69.9 % Fe), both of which are asserted against this calculator in its test suite. Retrieved 2026-07-29. Open access.
  2. [2]IUPAC. Compendium of Chemical Terminology (the Gold Book), 'mass fraction, w' (M03722): 'Mass of a constituent divided by the total mass of all constituents in the mixture.' Sourced there to the Green Book 2nd ed. p. 41 and to Pure Appl. Chem. 1996, 68, 957 (Glossary of terms in quantities and units in Clinical Chemistry, IUPAC-IFCC Recommendations 1996) p. 980. SECOND, INDEPENDENT AUTHORITY consulted for this page: it agrees with the OpenStax definition, supplies the formal name and symbol for the quantity, and is the basis for this page's explicit separation of MASS fraction from MOLE fraction. Retrieved 2026-07-29 via the legacy IUPAC host (the current goldbook.iupac.org returns HTTP 403 to automated retrieval). Open access.
  3. [3]Meija, J. et al. (2021). 'Atomic weights of the elements 2021 (IUPAC Technical Report)'. Pure and Applied Chemistry 93(5), 573–600, doi:10.1515/pac-2019-0603, as maintained in the CIAAW table 'Abridged Standard Atomic Weights 2024' (named revision: 2024, incorporating the Gd, Lu and Zr revisions on the Atomic Weights 2021 base). The named, versioned source of every atomic weight used here — N 14.007, H 1.0080, O 15.999, C 12.011, Fe 55.845, S 32.06, Al 26.982. Also the source for the list of fourteen elements whose standard atomic weight is published as an interval rather than a single value, which is why four significant figures is the honest ceiling on this page. Retrieved 2026-07-29. Open access.
  4. [4]IUPAC (2007). Quantities, Units and Symbols in Physical Chemistry ('the Green Book'), 3rd edition (2nd printing 2008), section 2.10 on composition of mixtures — the governing definitions of mass fraction, mole fraction, and the distinction between them that this page turns on. International Union of Pure and Applied Chemistry / RSC Publishing. Retrieved 2026-07-29. Bibliographic reference: a print and PDF edition rather than a live web page.
  5. [5]NIST Chemistry WebBook, Standard Reference Database Number 69, National Institute of Standards and Technology. Searchable by formula and molecular weight; used to confirm the molar masses quoted on this page — ammonium nitrate NH4NO3 80.04 g/mol, aspirin C9H8O4 180.16 g/mol, urea CH4N2O 60.06 g/mol, iron(III) oxide Fe2O3 159.69 g/mol. Retrieved 2026-07-29. Open access.
  6. [6]Hill, E. A. (1900). 'On a system of indexing chemical literature; adopted by the Classification Division of the U.S. Patent Office'. Journal of the American Chemical Society 22(8), 478–494, doi:10.1021/ja02046a005. The origin of the ordering used in this page's composition breakdown — carbon first, hydrogen second, all remaining elements alphabetically, and for carbon-free compounds every element alphabetically (which is why the ammonium nitrate breakdown begins with hydrogen). Adopted by Chemical Abstracts and by IUPAC formula indexes. Retrieved 2026-07-29. Publisher page paywalled; record and abstract open.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 682 calculators remain free
  • No billing is enabled
Coming soon