Molecular Weight
Parse any chemical formula and get the molecular weight, percent composition, and a stoichiometric breakdown of every element. Handles nested parentheses, hydrate dot-notation, and complex coordination compounds.
How to use this tool
This is the Formula & Composition workspace, three connected modes. Compute a molecular weight from a formula, derive an empirical formula from percent composition, or work one up from combustion (CHN) data. Results chain: a formula from the composition or combustion mode hands off to the molecular-weight mode in one click.
Formula → MW
- Chemical formula: element symbols with counts, e.g. C6H12O6. Case matters: Co is cobalt, CO is carbon monoxide.
- Use parentheses for groups, Fe2(SO4)3, and a dot for hydrates: CuSO4·5H2O.
- Not sure of the formula? Type a name instead and press the look-up button.
Composition → Empirical
Enter each element's % by mass (they should sum to ≈100%) to get the simplest whole-number atom ratio.
Combustion → Empirical
Enter the sample, CO₂ and H₂O masses (plus optional N) to back out %C/%H/%N/%O and the empirical formula. Oxygen is taken by difference.
Worked example
Glucose C6H12O6 has a molar mass of 180.156 g/mol, of which carbon makes up 40.00% by weight.
Formula Input
Composition
Combustion data
Result
Weigh out the headline g/mol figure to get exactly one mole. The breakdown shows how much of the total weight each element contributes, useful for checking a formula or planning an elemental analysis.
Methodology
Formula → molecular weight
Formulas are tokenised with a regular expression that recognises element symbols (one uppercase letter optionally followed by one lowercase letter), an optional subscript, and balanced parentheses with an optional multiplier. A stack walks nested groups so that Fe2(SO4)3 resolves to Fe2S3O12. Hydrate dot-notation (·, •, ∙, or *) splits the formula into units; an optional leading coefficient scales its unit, so CuSO4·5H2O sums CuSO4 plus five H2O. Each element's count is multiplied by its IUPAC conventional atomic weight; percent composition is each element's mass contribution divided by the total.
Composition → empirical formula
Divide each percentage by the element's atomic weight to get moles per 100 g, normalise by the smallest, then multiply by 1–6 to find the smallest integer ratio.
Combustion → empirical formula
All carbon ends up as CO₂ and all hydrogen as H₂O. Mass C = m(CO₂) × (12.011 / 44.009); mass H = m(H₂O) × (2 × 1.008 / 18.015). Percentages divide by the sample mass; oxygen is the remainder after C, H and any measured N. The mole counts then reduce to the smallest whole-number ratio.
Sources
- IUPAC Technical Report, Atomic weights of the elements 2021 (Meija et al., Pure Appl. Chem. 93, 1077–1085).
- NIST Atomic Weights and Isotopic Compositions database.
Known limits
- Charges (e.g. SO42−) are ignored, the parser only counts atoms.
- Square brackets [ ] aren't supported; rewrite as parentheses if you have coordination notation.
- Hydrates accept a middle dot (
·,•,*) or a plain period as the separator, so bothCuSO4·5H2OandCuSO4.5H2Ogive the pentahydrate. A period inside a coefficient still reads as a decimal, so fractional hydrates likeCaSO4·0.5H2Owork too. - The parser covers elements with a standard atomic weight (most of H–U). Synthetic or short-lived radioelements without a conventional weight, including Pm, Po, At, Rn, Fr, Ra, Ac, Pa, Np and the heavier transuranics/transactinides, aren't recognised and return “Unknown element”, even though the periodic-table view shows all 118.
- In combustion mode oxygen is computed by difference, so it absorbs all weighing error; for halogen-, sulfur- or metal-containing samples the O-by-difference value is unreliable.