Molecular Weight Calculator
Type a chemical formula and this calculator returns its molecular weight (molar mass) in grams per mole, using the abridged standard atomic weights from IUPAC. It handles parentheses and hydrates — Ca(OH)2, Al2(SO4)3, CuSO4·5H2O — and breaks down the percent composition by element.
Composition by mass
How molecular weight works
Every element has a standard atomic weight — the average mass of its atoms, weighted across the isotopes found in nature. A molecule’s molecular weight is simply the sum of the atomic weights of all the atoms in its formula. Count each element, multiply by its atomic weight, and add. The result, expressed in grams per mole, tells you the mass of one mole (6.022 × 10²³ molecules) — the bridge between the microscopic world of atoms and the grams you weigh on a balance.
How it’s calculated
The formula parser walks the string left to right, reading element symbols (an uppercase letter optionally followed by a lowercase one), subscripts, and nested groups in parentheses or brackets, multiplying group contents by the number that follows. A dot (·, period, or asterisk) starts a hydrate segment whose leading coefficient multiplies everything after it, so CuSO4·5H2O adds five waters. Each element count is multiplied by its IUPAC abridged standard atomic weight and summed. Percent composition divides each element’s mass contribution by the total.
Uses abridged standard atomic weights (uncertainties ignored). Symbols are case-sensitive, so “Co” (cobalt) differs from “CO” (carbon monoxide).
Worked example
Glucose is C6H12O6. Using C = 12.011, H = 1.008, and O = 15.999 g/mol: 6 × 12.011 + 12 × 1.008 + 6 × 15.999 = 72.066 + 12.096 + 95.994 = 180.156 g/mol. By mass that is carbon 40.0%, hydrogen 6.7%, and oxygen 53.3%.
Selected atomic weights (g/mol)
| Element | Sym | Weight | Element | Sym | Weight |
|---|---|---|---|---|---|
| Hydrogen | H | 1.008 | Sulfur | S | 32.06 |
| Carbon | C | 12.011 | Chlorine | Cl | 35.45 |
| Nitrogen | N | 14.007 | Potassium | K | 39.098 |
| Oxygen | O | 15.999 | Calcium | Ca | 40.078 |
| Sodium | Na | 22.99 | Iron | Fe | 55.845 |
| Magnesium | Mg | 24.305 | Copper | Cu | 63.546 |
Abridged standard atomic weights, IUPAC. The calculator includes 40+ common elements.
Common mistakes
- Getting the case wrong — “co” or “NACL” will not parse; use Co, NaCl.
- Forgetting a subscript applies only to the symbol (or group) directly before it.
- Writing hydrates without the dot, so the extra water is missed.
- Mixing up molecular weight (g/mol) with molarity (mol/L) — different quantities.
Where it is used
- Converting between grams and moles for stoichiometry.
- Preparing solutions of a known molarity (mass = M × molar mass × volume).
- Working out percent composition and empirical formulas.
- Chemistry, biology, and pharmacy coursework and lab prep.
Frequently asked questions
How is molecular weight calculated?
Add up the atomic weight of every atom in the formula. Count how many of each element appear, multiply each element’s standard atomic weight by that count, and sum the results. For water (H2O): 2 × 1.008 + 15.999 = 18.015 g/mol.
Is molecular weight the same as molar mass?
For practical purposes, yes. Molar mass is the mass of one mole of a substance in grams per mole, and molecular weight (relative molecular mass) is numerically almost identical. This calculator uses them interchangeably, reporting the result in g/mol.
Can I enter formulas with parentheses or hydrates?
Yes. The parser handles parentheses and brackets like Ca(OH)2 and Al2(SO4)3, and hydrates written with a dot such as CuSO4·5H2O (type a period or asterisk for the dot). Element symbols are case-sensitive: Co is cobalt, but CO is carbon plus oxygen.
What atomic weights does the tool use?
It uses the abridged standard atomic weights published by IUPAC — for example C = 12.011, H = 1.008, O = 15.999, and Na = 22.99 g/mol. These are weighted averages over each element’s natural isotopes, rounded to a few decimals.
What is percent composition?
Percent composition is the fraction of a compound’s total mass contributed by each element. For glucose (C6H12O6), carbon makes up about 40.0%, hydrogen 6.7%, and oxygen 53.3% by mass. The calculator lists this breakdown under the result.