Parses chemical formulas (with parentheses and hydrates) and returns molar mass plus per-element breakdown.
| Element | Atoms | Atomic mass | Contribution | % |
|---|
Computing the molar mass of a compound is the most basic, most-used operation in chemistry. Every stoichiometry calculation, every solution preparation, every titration, every pharmaceutical-dose conversion routes through "given a molecular formula, what is its mass per mole, and what fraction of that mass comes from each element?" Schools teach the procedure — look up atomic masses, multiply by stoichiometric coefficients, sum — but the bookkeeping is tedious for anything past a four-atom molecule. Errors compound when formulas include nested parentheses (Ca(OH)₂, Fe(NO₃)₃·9H₂O) or hydrate dots (CuSO₄·5H₂O). This calculator parses the formula text directly: a small recursive descent over a grammar that accepts symbols, multipliers, parentheses, and hydrate dots, summed against an internal table of standard atomic weights.
The output is the total molar mass, the mass-percent contribution of each element (sorted high to low), and a stacked-bar visual that makes the proportions intuitive at a glance — useful when teaching, useful when sanity-checking a synthesis spreadsheet, and useful for industrial QA where the percent-mass of each element is the spec.
Molar mass M(compound) = Σ n_i · M_i where n_i is the count of atoms of element i in one formula unit and M_i is the standard atomic mass of element i (IUPAC 2021 conventional values).
The parser handles:
[...] are accepted as a synonym.· and . are accepted.Per-element breakdown:
The "moles per gram" inverse is also reported: n = 1 / M_total.
Enter the formula in the text box. The case matters: use proper element-symbol case (Na, not na or NA). Use 1, 2, 3 … for stoichiometric counts (not subscript Unicode characters — those are not parsed). Use parentheses for branched groups. Use the dot character · or a regular full-stop . for hydrates.
Press Tab or click outside the field to compute. The result panel shows:
Water H₂O.
Glucose C₆H₁₂O₆.
Copper(II) sulfate pentahydrate CuSO₄·5H₂O.
Aluminum sulfate Al₂(SO₄)₃.
Case sensitivity matters more than people expect. "CO" is carbon monoxide; "Co" is cobalt. "CN" is cyanide; "Cn" is copernicium. The parser will not warn you — it will quietly use whatever element matches the case you typed.
Subscript Unicode is not parsed. H₂O looks pretty but H2O is what the parser expects. Copy-pasting from a textbook that uses subscripts will fail with a "syntax error".
Brackets vs braces. The parser accepts () and [] as group delimiters; it does not accept curly braces {}.
Charge / oxidation state. The parser ignores +, −, and Roman numerals. "Fe(III)" must be entered as "Fe" — the III is informational, not stoichiometric. Polyatomic ions like SO₄²⁻ are entered as SO4 (the charge is meaningful chemically but invisible in the molar-mass calculation).
Hydrate notation variation. Different texts use ·, ., *, or , as the hydrate separator. The parser accepts · (middle dot) and . (full stop). For other separators, replace before pasting.
Standard vs isotope-specific atomic masses. The table uses 2021 IUPAC standard atomic weights, which are interval-averaged across natural isotopic abundance. For deuterium-labeled or ¹³C-enriched compounds, the calculator under-reports — adjust manually for isotope composition.
Polyatomic-ion shorthand. "Ammonium" written as NH4 works; written as (NH4) works too. But NH₄⁺ won't parse (Unicode + charge).
Common element-symbol gotchas. B (boron) vs Be (beryllium); K (potassium) vs Kr (krypton); Y (yttrium) vs Yb (ytterbium). When in doubt, name the element rather than the symbol and look up.
Anhydrous vs hydrate. CuSO₄ (anhydrous) is 159.6 g/mol; CuSO₄·5H₂O (pentahydrate) is 249.7 g/mol. A 1 g sample of pentahydrate contains only 0.64 g of anhydrous salt. This matters for accurate solution prep — read the label, type the formula that matches.
Significant figures. The calculator returns three or four decimals from a four-significant-figure atomic-mass table. For analytical-chemistry work requiring more precision, look up CODATA atomic masses with their measurement uncertainties.
Free radicals and structural ambiguity. Empirical formula H₂O is unambiguous. Cyclohexane (C₆H₁₂) and 1-hexene (also C₆H₁₂) have the same molar mass — the calculator computes mass, not structure.