Chemistry calculator

Molecular Weight Calculator

Parse a common chemical formula into atoms and add their standard atomic weights.

Molar mass

18.015 g/mol

H × 22.016 g/mol
O × 115.999 g/mol

How the molecular weight calculator works

The parser reads case-sensitive element symbols, whole-number subscripts, and ordinary parenthesized groups. It never evaluates the input as code. Each detected element is matched against the bundled atomic-weight table.

Displayed masses use conventional standard atomic weights rounded for practical calculation. The breakdown makes formula interpretation auditable before using the result in mole conversions.

Molar mass = Σ(element atom count × element atomic weight)

Worked example

For glucose, C6H12O6, the contributions are 6×12.011 + 12×1.008 + 6×15.999 = 72.066 + 12.096 + 95.994 = 180.156 g/mol. Water gives 18.015 g/mol, CO2 gives 44.009 g/mol, and NaCl gives 58.4398 g/mol.

Assumptions and practical limits

The parser does not support hydrate dots, leading coefficients, charges, isotope notation, square brackets, fractional subscripts, or every element. Unsupported or malformed formulas show a dash.

Atomic weights vary naturally by isotopic composition and source. Results should not be presented with more precision than the input constants justify.

Frequently asked questions

Are element symbols case-sensitive?

Yes. Co is cobalt, while CO is carbon plus oxygen.

Can it parse parentheses?

Yes, for common groups such as Ca(OH)2, including a whole-number multiplier.

Why might a valid advanced formula fail?

Hydrates, charges, isotopes, brackets, and uncommon elements are outside this deliberately safe parser.