Percent Composition by Mass
The percent composition of an element in a compound is the fraction (by mass) of that element relative to the total mass of the compound, expressed as a percentage. This calculator parses chemical formulas, computes molar masses using atomic weights, and reports the mass percent of the requested element.
It supports common formulas and nested parentheses such as Fe2(SO4)3, Mg(OH)2, and C6H12O6. If an element in the formula is not recognized, the calculator will prompt you to add its atomic weight.
How the Calculator Works
The tool follows these steps:
- Parse the chemical formula to determine counts of each element (handles parentheses).
- Multiply each element count by its atomic weight to get the contribution to molar mass.
- Sum contributions to obtain the molar mass of the compound.
- Compute percent composition: (mass of element in formula / total molar mass) × 100.
Percent = (n_element × atomic_weight_element) / (sum(n_i × atomic_weight_i)) × 100Examples
Water — H2O
Molar mass = 2 × 1.00794 (H) + 15.9994 (O) = 18.01528 g/mol.
Percent H = (2 × 1.00794 / 18.01528) × 100 ≈ 11.19%
Percent O ≈ 88.81%
Glucose — C6H12O6
Compute contribution from C, H, and O and then percent per element.
Magnesium Hydroxide — Mg(OH)2
The parser recognizes parentheses: Mg(OH)2 has Mg=1, O=2, H=2.
Frequently Asked Questions
Q: What if my formula includes an element not listed?
A: The calculator relies on an internal table of atomic weights. If an element is not recognized, you'll see an error listing the unknown symbol(s). You can request to add that element's atomic weight to the dataset.
Q: Can I use fractional subscripts or hydrates (e.g., CuSO4·5H2O)?
A: The current parser handles integer counts and nested parentheses. For hydrates using a middle dot (·), replace the dot with a plus sign or expand the hydrate explicitly (e.g., CuSO4 + 5H2O) or enter CuSO4(H2O)5.
Q: Are results rounded?
A: Results displayed by the calculator are rounded to a sensible number of decimal places, but the PDF download includes values with greater precision where applicable.
Tips for Accurate Input
- Use correct element symbols (capital letter followed by optional lowercase letter), e.g., Fe, Na, Cl.
- Use parentheses for grouped units with multipliers, e.g., Al2(SO4)3.
- Avoid stray characters — only element symbols, digits, and parentheses are supported.