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

Percent Composition Calculator

Type a chemical formula to get the mass percent of every element, the molar mass, and grams of any chosen element in a sample of the 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
The chosen element's share of the compound's mass, shown to two decimals: grams of that element per 100 g of compound, not a share of the atoms.
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.

How much nitrogen is in a 50 kg bag of ammonium nitrate? The formula NH₄NO₃ holds the answer. Two nitrogen atoms, four hydrogens and three oxygens make up one formula unit, and once each is weighted by its atomic weight, nitrogen accounts for 34.9987% of the mass. The bag therefore holds 17,499.34 g, just under 17.5 kg, of nitrogen. The same arithmetic tells a geologist how much iron a pure ore could yield, tells a pharmacist how much of a salt is the active ion, and lets a chemist check whether a freshly made compound is what the label says.

Percent composition is always a share of mass. Atoms are counted from the formula, but each count is multiplied by how heavy that atom is before anything is divided, so light elements shrink and heavy ones swell. Water is two-thirds hydrogen by atom count and 11.1907% hydrogen by mass, and the two figures answer different questions. Elemental analysis, ore assays and fertilizer grades all work by mass; reaction stoichiometry works by moles.

The figure is also a property of one pure compound, fixed by its formula. Temperature, pressure and how much of the substance you have make no difference to it. That separates it from the "percent by mass" on a bottle of acid, which describes how a solution was mixed, and from a real sample's assay, which carries impurities and moisture that the formula knows nothing about.

Type any formula, nested parentheses included, choose the element you care about, and add a sample mass if you want grams rather than a percentage. Every element's share is listed in a full breakdown, and those shares add up to 100. When you have percentages and want the formula instead, the empirical formula calculator runs the same relationship in reverse.

What is percent composition calculator?

Percent composition is the mass fraction of each element in a compound, multiplied by 100. IUPAC calls the underlying quantity the mass fraction, symbol w, and defines it as the mass of a constituent divided by the total mass of all constituents. For a compound of known formula that fraction never needs a balance: it follows from how many atoms of each element one formula unit contains and from each element's standard atomic weight. The results here are therefore theoretical values for the pure substance. A laboratory analysis of a real sample comes back slightly different, and the size of the gap is how purity is judged. Many chemistry journals, for example, expect measured carbon, hydrogen and nitrogen to fall within 0.4 percentage points of the calculated figures before they accept a new compound as pure.

How to use this calculator.

  1. Type the formula with correct capitals and no spaces, charges or state labels. Capitals mark where each symbol starts, so Co is cobalt, CO is carbon monoxide, and lower-case input such as nh4no3 is rejected.
  2. Use parentheses for repeated groups, nested if necessary, as in Al2(SO4)3 or K3(Fe(CN)6). The number after a closing bracket multiplies everything inside it.
  3. Write a hydrate with its waters as a bracketed group: copper sulfate pentahydrate CuSO4·5H2O becomes CuSO4(H2O)5. The centred dot is not accepted.
  4. Enter the symbol of the element you want as the headline result; it must appear in the formula. The breakdown lists every element whichever one you choose.
  5. Leave the sample mass at 100 g to make the grams equal the percentage, enter the mass you actually have, or set it to 0 if you only want percentages.
  6. Before using any figure, check that the atoms-per-formula-unit count and the number of distinct elements match the compound you meant.

The formula.

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

The mass percent of an element E is %(E) = n(E) × A(E) ÷ M × 100. Here n(E) is the number of E atoms in one formula unit, A(E) is the standard atomic weight of E in grams per mole, and M is the molar mass of the compound, found by adding n × A over every element present. The numerator n(E) × A(E) is the element mass per mole reported alongside the result: the grams of E in one mole of the compound. Dividing by M gives a pure ratio, and multiplying by 100 turns it into percentage points.

Because the molar mass is nothing more than the sum of the numerators, the shares of all the elements partition it exactly and always add up to 100. A printed table that comes to 99.9 or 100.1 has been rounded; the chemistry has no gap. For a sample, the mass of E is simply the sample mass × %(E) ÷ 100, which is why 100 g of compound gives a number of grams equal to the percentage.

Atom counts come from reading the formula left to right. A symbol that appears twice is added up, so NH4NO3 is two nitrogens, and a bracketed group is multiplied by the number after it. Atomic weights are the conventional values in the CIAAW Abridged Standard Atomic Weights 2024 table: N 14.007, H 1.008, O 15.999, C 12.011, Fe 55.845, S 32.06, Cu 63.546, Al 26.982. Elements with no standard atomic weight are refused rather than given an invented one. Those are technetium, promethium, polonium, astatine, radon, francium, radium, actinium and everything after uranium; thorium, protactinium and uranium themselves are accepted.

The breakdown line lists elements in Hill order, the convention chemical indexes use: carbon first, hydrogen second and the rest alphabetically, or every element alphabetically if there is no carbon. Its percentages are shown to four decimal places, with trailing zeros dropped, so oxygen in ammonium nitrate appears as 59.964 rather than 59.9640.

Precision is limited by the atomic weights, not by the arithmetic. For fourteen elements, among them hydrogen, carbon, nitrogen, oxygen and sulfur, the official standard atomic weight is an interval, because their isotope mix varies between natural sources. The single conventional values are fine for nearly all work, but results beyond about four significant figures claim more than the inputs know. As a check on the whole method, aspirin, C9H8O4, comes out at 60.002% carbon, 4.476% hydrogen and 35.522% oxygen, which OpenStax Chemistry 2e works by hand as 60.00%, 4.476% and 35.52%.

A worked example.

Example

Ammonium nitrate, NH4NO3, with nitrogen chosen and the sample left at 100 g. Reading the formula gives N twice, so 2 N, 4 H and 3 O, and the atom count shows 2. The element masses per mole are 2 × 14.007 = 28.014 g for nitrogen, 4 × 1.008 = 4.032 g for hydrogen and 3 × 15.999 = 47.997 g for oxygen. Their sum is the molar mass: 28.014 + 4.032 + 47.997 = 80.043 g/mol. Nitrogen's share is 28.014 ÷ 80.043 × 100 = 34.9987%, which the headline result rounds to 35.00. Hydrogen's is 4.032 ÷ 80.043 × 100 = 5.0373% and oxygen's 47.997 ÷ 80.043 × 100 = 59.964%, and the breakdown line reads H 5.0373 %, N 34.9987 %, O 59.964 %. Those three add to 100. With a 100 g sample, the nitrogen in it is 100 × 34.9987 ÷ 100 = 34.9987 g, the same number as the percentage. To four significant figures, which is as far as the atomic weights justify, ammonium nitrate is 35.00% nitrogen. That theoretical figure is a ceiling for any real product: a commercial bag is labelled with the grade it actually guarantees, which for ammonium nitrate fertilizer is commonly 34%.

formulaNH4NO3
sample Mass100
elementN

Frequently asked questions.

Why is water only 11% hydrogen when two of its three atoms are hydrogen?
Because the percentage is by mass. A hydrogen atom weighs 1.008 against oxygen's 15.999, so the two hydrogens contribute 2.016 g of every 18.015 g of water, which is 11.1907%. By atom count hydrogen is two in three, about 66.7%, but that is a mole fraction, a different quantity. Mixing the two up is the most frequent error with this calculation.
Is this the same as the 37% printed on a bottle of hydrochloric acid?
No. That figure is the mass of HCl dissolved per 100 g of solution, a description of how a mixture was made, and it could be any value up to the limit of solubility. Percent composition describes the elements within one pure compound and is fixed by its formula: HCl itself is always the same proportions of hydrogen and chlorine whatever it is dissolved in.
How do I get the copper content of copper sulfate crystals?
Enter the pentahydrate as CuSO4(H2O)5, because blue crystals carry five waters per formula unit. Copper is then 25.4513% against 39.8153% for anhydrous CuSO4, so 50 g of crystals hold 12.7256 g of copper, not 19.9076 g. Using the anhydrous figure for weighed crystals overstates the copper by more than half. Check the bottle: anhydrous, pentahydrate or ·xH2O tells you which formula to type.
Can I work out the percent of water in a hydrate?
Indirectly. Run the hydrate and the anhydrous salt and subtract the molar masses: 249.677 − 159.602 = 90.075 g/mol of water in copper sulfate pentahydrate. Divide by the hydrate's molar mass and multiply by 100 to get 36.0766% water. The same subtraction works for any group, such as sulfate in a salt, because the calculator reports one element at a time.
Why doesn't my fertilizer label match the nitrogen and phosphorus figures here?
Two reasons. Labels guarantee a minimum for the commercial product, which is never the pure compound, and they express phosphorus as P2O5 and potassium as K2O. Pure diammonium phosphate, (NH4)2HPO4, is 21.2137% nitrogen and 23.4552% phosphorus; dividing the phosphorus by P2O5's 43.6429% phosphorus gives 53.7435% as P2O5, against the familiar 18-46-0 grade. Pure KCl works out to 63.1774% as K2O, against muriate of potash's usual 0-0-60.
What does an unexpected atom count tell me?
That the formula was read differently from what you meant. Type NH4N03 with a zero instead of the letter O and it reads as four nitrogens and four hydrogens, giving 93.2867% nitrogen and only two elements. Type CaOH2 instead of Ca(OH)2 and oxygen falls from 43.1868% to 27.5403%. The count and the number of distinct elements catch both mistakes.
How many significant figures should I report?
Usually four. The conventional atomic weights for hydrogen, carbon, nitrogen, oxygen, sulfur and several others stand in for ranges, because those elements' isotope mix varies from one natural source to another. Quoting 34.9987% nitrogen in ammonium nitrate implies a certainty the atomic weights do not have; 35.00% says what can be defended.
Why are elements such as radon and technetium refused?
They have no standard atomic weight. With no stable isotopes and no characteristic natural isotope mix, there is no single average mass for a sample of them, so any percentage would depend on which isotope you had. Rather than guess, the calculator stops with an error naming the element; the list is technetium, promethium, polonium, astatine, radon, francium, radium, actinium and everything heavier than uranium.
Is magnetite or hematite the richer iron ore?
Pure magnetite, Fe3O4, is 72.3596% iron and pure hematite, Fe2O3, is 69.9431%, because magnetite carries less oxygen per iron atom: four for every three, against three for every two. Mined ore is mixed with rock, so its iron grade sits well below these figures, which are the limit a concentrate can approach.
How do these theoretical figures compare with a laboratory analysis?
They are the benchmark the analysis is judged against. Combustion analysis measures carbon, hydrogen and nitrogen directly, and oxygen is normally taken as whatever is left to make 100. Agreement within a few tenths of a point supports purity. A shortfall can mean solvent or water trapped in the sample, or a different compound. To go from measured percentages back to a formula, use the empirical formula or combustion analysis calculators.

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 this calculator reproduces. 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. 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.

How this page was produced

Published by
Quanta Calculator
Primary sources
6 cited below
Method
%(E) = [ n(E) × A(E) ] ÷ M × 100
Published
Last verified

Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.

In this category

Embed

Quanta Pro

Paid features are coming later.

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