What this calculator does
This tool tells you how many grams of a particular element are present in a sample of a chemical compound. It combines the percent-by-mass composition of the element with the total mass of the sample, so you get both the percentage and the actual mass in grams.
How to use it
Enter four values: the total mass of the compound sample (in grams), the molar mass of the whole compound (g/mol), the atomic mass of the element you care about (g/mol), and n, the number of atoms of that element in one formula unit. The calculator returns the mass of the element in grams plus its percent by mass.
The formula explained
The percent by mass of an element is the contribution of that element to the molar mass: \((n \times \text{atomic mass}) \div \text{molar mass}\). Multiplying this fraction by the total mass of your sample gives the mass of the element:
$$\text{mass}_{\text{element}} = \frac{n \times \text{atomic mass}}{\text{molar mass}} \times \text{total mass}$$The same fraction times 100 gives the percent by mass, a value that does not depend on sample size.
Worked example
How much oxygen is in 100 g of water (H₂O)? Water has a molar mass of 18.015 g/mol and contains 1 oxygen atom (atomic mass 16). The fraction is \(16 \div 18.015 = 0.8882\), so the percent by mass is 88.82%. In 100 g of water that is \(0.8882 \times 100 = 88.82\) g, that is 88.82 g of oxygen.
FAQ
What is "n"? It is how many atoms of the chosen element appear in one formula unit — for example \(n = 2\) for hydrogen in H₂O.
Where do I find the molar mass? Add up the atomic masses of every atom in the formula, or look it up for common compounds.
Does the answer change with sample size? The percent by mass stays constant, but the mass in grams scales directly with the total mass you enter.