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
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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
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.
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%.
Frequently asked questions.
Why is water only 11% hydrogen when two of its three atoms are hydrogen?
Is this the same as the 37% printed on a bottle of hydrochloric acid?
How do I get the copper content of copper sulfate crystals?
Can I work out the percent of water in a hydrate?
Why doesn't my fertilizer label match the nitrogen and phosphorus figures here?
What does an unexpected atom count tell me?
How many significant figures should I report?
Why are elements such as radon and technetium refused?
Is magnetite or hematite the richer iron ore?
How do these theoretical figures compare with a laboratory analysis?
References& sources.
- [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]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]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]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]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]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
- Overseen by
- Daniel, Quanta Calculator Researcher
- 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