Formula Parser
Parse a chemical formula and view its element composition.
Learn more
What it does
The Formula Parser takes a chemical formula and breaks it into its constituent elements, showing the atom count and mass contribution of each, the total atom count, and the molar mass. It is useful for checking a formula's composition before further calculation. The breakdown view also makes typos obvious: an unexpected element or an atom count off by one stands out immediately, before the mistake reaches a stoichiometry calculation.
How it works
The parser reads element symbols and subscripts, expands parentheses and nested groups, and tallies how many atoms of each element appear. For each element it computes mass contribution as atom count times atomic weight, then sums these for the molar mass and expresses each contribution as a percentage of the total. So Ca(OH)2 yields Ca:1, O:2, H:2. Percent composition is independent of sample size — it depends only on the formula. This is exactly the data used to derive empirical formulas from elemental analysis, just applied in the opposite direction.
Worked example
Parse C6H12O6: carbon 6 atoms (6 x 12.011 = 72.066 g), hydrogen 12 (12 x 1.008 = 12.096 g), oxygen 6 (6 x 15.999 = 95.994 g). Total atoms 24, molar mass 180.156 g/mol, with oxygen making up about 53.3% of the mass. Hydrate check: CuSO₄ (159.61 g/mol) plus 5 H₂O adds 90.08 g, giving 249.69 g/mol for the pentahydrate — water is 36.1% of the crystal's mass, which is why the anhydrous form gains so much weight in humid air.
When to use it
Use it to verify the element tally of a complex formula like Fe2(SO4)3. Use it to see which element dominates the mass of a compound. Use it as a first step before running the molar mass or stoichiometry tools. Use it when you meet an unfamiliar formula in a paper, before setting up reaction stoichiometry, and when preparing standards where the exact hydrate form matters.
FAQ
- What does a chemical formula parser do?
- It reads a formula such as Fe2(SO4)3, expands any parentheses, and reports the count of each element, the mass each contributes, the total atom count, and the molar mass.
- How are parentheses handled in formula parsing?
- The group inside parentheses is treated as a unit and multiplied by the subscript after it, so Fe2(SO4)3 means 2 Fe and 3 x (1 S + 4 O) = 3 S and 12 O.
- What is the total atom count of a formula?
- It is the sum of every subscript across all elements after expanding groups; for H2O it is 3, and for C6H12O6 it is 24.
- How is the mass percentage of an element calculated?
- Divide that element's total mass contribution (atom count times atomic weight) by the molar mass of the whole formula and multiply by 100.