Molecular Weight Calculator: Formula, Molar Mass and Composition

Molecular Weight Calculator

Enter a chemical formula to calculate average molar mass, element counts, mass contributions and percent composition.

Examples: H2O, Ca(OH)2, K4[Fe(CN)6], CuSO4·5H2O.

Molecular-weight formula

Average molar mass = Σ(element count × atomic weight).

Mass percent for an element equals its mass contribution divided by the total molar mass, multiplied by 100. Moles equal sample mass in grams divided by molar mass in g/mol; mass equals moles multiplied by molar mass.

Scope: values use conventional average atomic weights, so natural isotopic composition is assumed. Elements without a standard atomic weight use a representative isotope mass number. The parser supports integer subscripts, nested (), [] or {}, and hydrate separators “·” or “.”. It does not interpret charges, electron notation, isotopic labels, fractional stoichiometry, structural formulas or ambiguous abbreviations.

Eight checked examples

FormulaCompoundCalculated average molar mass
H2OWater18.015 g/mol
NaClSodium chloride58.440 g/mol
C6H12O6Glucose180.156 g/mol
Ca(OH)2Calcium hydroxide74.092 g/mol
Al2(SO4)3Aluminum sulfate342.131 g/mol
(NH4)2CO3Ammonium carbonate96.086 g/mol
K4[Fe(CN)6]Potassium ferrocyanide formula unit368.346 g/mol
CuSO4·5H2OCopper(II) sulfate pentahydrate249.677 g/mol

How to use the calculator

  1. Enter element symbols with correct capitalization: Co is cobalt, while CO contains carbon and oxygen.
  2. Place integer subscripts after an element or closing group. Use parentheses or brackets for repeated groups.
  3. For hydrates, separate components with a middle dot or period and place the coefficient before the hydrate component.
  4. Select mass-to-moles or moles-to-mass only when a sample conversion is needed; otherwise leave formula mass selected.
  5. For analytical work, confirm whether an isotope-specific mass, reagent assay, hydration state or purity correction is required.

Atomic-weight references and limits

The calculator uses commonly published conventional atomic weights consistent with reference tables from the Commission on Isotopic Abundances and Atomic Weights and NIST. Atomic weights can be intervals in natural materials, and isotope-specific work requires isotope masses rather than these averaged values.

  • Maximum formula length: 200 characters after spaces are removed.
  • Maximum nesting depth: 12 groups.
  • Each integer multiplier must be from 1 to 1,000,000.
  • Total atom count must not exceed 100,000,000 per formula unit.

Related calculators