Molecular Weight Calculator — Molar Mass by Formula
Type any chemical formula — H₂O, CO₂, C₆H₁₂O₆, or Ca(OH)₂ — to get the molar mass in g/mol instantly. Parentheses and nested groups are fully supported. Enter an optional sample mass to convert grams to moles.
g
Sum of standard atomic weights for every atom in the formula
- 1
H × 2
1.008 × 2 = 2.016 g/mol - 2
O × 1
15.999 × 1 = 15.999 g/mol - 3
Total molecular weight
18.015
How does this calculator work?
Type a chemical formula and the calculator sums the IUPAC 2021 atomic weights of every atom: M = Σ (nᵢ × AWᵢ). H₂O → 18.015 g/mol; C₆H₁₂O₆ → 180.156 g/mol; Ca(OH)₂ → 74.093 g/mol. Parentheses supported. Enter a sample mass to convert grams to moles via n = m / M.
Formula
How this is calculated
The molecular weight (molar mass) is the sum of the standard atomic weights of every atom in the formula, expressed in g/mol. For H₂O that is 2 × 1.008 + 1 × 15.999 = 18.015 g/mol. The atomic weights used here follow IUPAC 2021 values for the most abundant natural isotope mix.
The formula parser handles element symbols (one uppercase letter optionally followed by one lowercase letter), numeric subscripts, and nested parentheses. Fe₂(SO₄)₃ expands to {Fe: 2, S: 3, O: 12} for a molar mass of 399.878 g/mol. Ca(OH)₂ becomes {Ca: 1, O: 2, H: 2} = 74.093 g/mol. Symbols must be correctly capitalised (Ca, not CA; Fe, not FE).
If you enter an optional sample mass in grams, the calculator converts it to moles via n = m / M. The elemental breakdown bar shows what fraction of the total molecular weight each element contributes — useful for understanding a compound's composition by mass.
Frequently asked questions
Molecular weight is a dimensionless ratio (relative to 1/12 the mass of carbon-12), while molar mass has units of g/mol — but their numerical values are identical. In everyday chemistry the terms are used interchangeably, and this calculator uses g/mol throughout.
The most common issue is capitalisation: symbols must use one uppercase letter and optional lowercase — Ca (calcium), not CA or ca. The parser also does not support isotope notation (²H, ¹⁴C) or the 10 rarest elements. Check the hint under the field for supported elements.
Divide the sample mass by the molar mass: n = m / M. For 36 g of water (M = 18.015 g/mol) you have 36 ÷ 18.015 ≈ 2 mol. Enter the sample mass in the optional field and the calculator performs this conversion automatically.
Also known as
TG we-Calculate Editorial Team. (2026). Molecular Weight Calculator — Molar Mass by Formula [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/molecular-weight-calculator
TG we-Calculate Editorial Team. "Molecular Weight Calculator — Molar Mass by Formula." TG we-Calculate. 2026. https://we-calculate.com/calculator/molecular-weight-calculator.
TG we-Calculate Editorial Team, "Molecular Weight Calculator — Molar Mass by Formula," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/molecular-weight-calculator
@misc{wecalculate_molecular_weight_calculator, title = {Molecular Weight Calculator — Molar Mass by Formula}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/molecular-weight-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
