Molecular Weight Calculator
Molar mass of a chemical formula, with a per-element mass breakdown.
Results update as you type.
About this calculator
The molecular weight, or molar mass, of a compound is the mass of one mole of it in grams per mole, found by adding up the standard atomic weight of every atom in its chemical formula. This molecular weight calculator parses a formula you type — element symbols with optional subscripts, nested parentheses, and a leading multiplier for hydrates — and sums the atomic weights, drawing on IUPAC standard values (hydrogen 1.008, carbon 12.011, oxygen 15.999, and so on).
As a worked example, water H2O contains two hydrogen atoms and one oxygen: 2 × 1.008 + 15.999 = 18.015 g/mol. Glucose C6H12O6 sums to 6 × 12.011 + 12 × 1.008 + 6 × 15.999 = 180.156 g/mol. The calculator also returns a per-element breakdown showing each element’s atom count, atomic weight, mass subtotal and percentage of the total mass — so for water it reports oxygen as about 88.8% of the mass and hydrogen the rest.
The parser understands parentheses and hydrate dot-notation, so Ca(OH)2 is read as one calcium, two oxygen and two hydrogen (74.09 g/mol) and CuSO4.5H2O includes the five waters of crystallisation (249.68 g/mol). Molar mass is the essential bridge between the mass you weigh on a balance and the moles a reaction needs, so it underlies solution preparation, reaction stoichiometry, yield calculations and converting between grams and moles at every step of quantitative chemistry.
Frequently asked questions
How is molecular weight calculated?
Multiply each element’s atomic weight by how many atoms of it the formula contains, then add them up. Water (H₂O) is 2 × 1.008 + 15.999 = 18.015 g/mol.
What formula syntax is supported?
Element symbols with optional counts, nested parentheses and a leading multiplier for hydrates. Ca(OH)2 is read as one calcium, two oxygen and two hydrogen; CuSO4.5H2O includes five waters.
What is the difference between molecular weight and molar mass?
Numerically they are the same value. Molecular weight (or molecular mass) is a relative figure in daltons for one molecule; molar mass is the mass of a mole in grams per mole. Both equal the summed atomic weights.
How do I enter a hydrate like copper sulfate pentahydrate?
Use a dot before the water group: CuSO4.5H2O. The leading 5 multiplies the H2O, adding five waters of crystallisation, and the calculator returns 249.68 g/mol for that hydrate.
What is the percentage composition it shows?
For each element it gives that element’s share of the total mass. In water, oxygen is about 88.8% and hydrogen 11.2%; in glucose, carbon is 40.0%, hydrogen 6.7% and oxygen 53.3% — useful for empirical-formula and purity work.
Why did my formula fail to parse?
Every element symbol must be capitalised correctly (Co is cobalt, but CO is carbon plus oxygen), and only real elements are accepted. Check for lowercase symbols, unmatched parentheses or typos if you see a parse error.
Can I compute the molar mass of a polyatomic ion or group?
Yes — wrap the group in parentheses with its multiplier, like Ca(OH)2 or (NH4)3PO4. The parser expands the parentheses and multiplies the enclosed atoms, so ammonium phosphate sums correctly across all three ammonium groups.
API — use this calculator from code
Call this calculator as a free JSON endpoint — no key required. Send the field values below as query parameters or JSON. Read the full API docs →
Endpoint
GET https://calculator.free/api/v1/molecular-weight/
curl
curl "https://calculator.free/api/v1/molecular-weight/?formula=H2O"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/molecular-weight/?" + new URLSearchParams({
"formula": "H2O"
}));
const data = await r.json();
console.log(data.results);
Results are estimates for general guidance only, not financial, medical or tax advice.