Answer: Type a chemical formula and the calculator adds up atomic weights for you: H2O is 18.015 g/mol, glucose (C6H12O6) is 180.156 g/mol, and CuSO4·5H2O is 249.677 g/mol. Each element's count and subtotal shows in the breakdown table.
Molecular weight of any formula, with element breakdown and mole conversion
| Element | Atomic Mass (g/mol) | Count | Subtotal (g/mol) |
|---|
| Compound | Formula | Molar Mass (g/mol) |
|---|---|---|
| Water | H2O | 18.015 |
| Methane | CH4 | 16.043 |
| Ammonia | NH3 | 17.031 |
| Nitrogen gas | N2 | 28.014 |
| Oxygen gas | O2 | 31.998 |
| Hydrochloric acid | HCl | 36.458 |
| Sodium hydroxide | NaOH | 39.997 |
| Ethanol | C2H5OH | 46.069 |
| Carbon dioxide | CO2 | 44.009 |
| Table salt | NaCl | 58.440 |
| Baking soda | NaHCO3 | 84.006 |
| Sulfuric acid | H2SO4 | 98.072 |
| Limestone | CaCO3 | 100.086 |
| Slaked lime | Ca(OH)2 | 74.092 |
| Rust | Fe2O3 | 159.687 |
| Aluminum sulfate | Al2(SO4)3 | 342.132 |
| Magnesium nitrate | Mg(NO3)2 | 148.313 |
| Potassium permanganate | KMnO4 | 158.032 |
| Copper(II) sulfate, anhydrous | CuSO4 | 159.602 |
| Copper(II) sulfate pentahydrate | CuSO4·5H2O | 249.677 |
| Aspirin | C9H8O4 | 180.159 |
| Glucose | C6H12O6 | 180.156 |
Values use IUPAC 2021 conventional atomic weights (C 12.011, H 1.008, O 15.999, S 32.06, Cu 63.546). Your textbook's table may differ in the third decimal if it rounds differently.
Type a formula, get grams per mole. The calculator parses the formula the way your chemistry teacher does: each element symbol carries a count (no subscript means one), parentheses distribute their multiplier across everything inside them, a leading coefficient multiplies the whole group, and a hydrate dot adds waters of hydration. It then sums count × atomic weight for every element and shows the work.
M = Σ (atomic weight × atom count). For C6H12O6 that's 6 × 12.011 + 12 × 1.008 + 6 × 15.999 = 72.066 + 12.096 + 95.994 = 180.156 g/mol. For a hydrate, CuSO4·5H2O = 159.602 + 5 × 18.015 = 159.602 + 90.075 = 249.677 g/mol. The grams-to-moles card divides mass by the result: n = m ÷ M, and moles × 6.022 × 10²³ gives particle count.
Enter the formula with proper capitalization (Co is cobalt, CO is carbon monoxide, and the calculator will not guess for you). Parentheses and multipliers work to any depth, so K4Fe(CN)6 and CH3(CH2)3CH3 both parse. Click any example chip to load it. Edit the mass field and the mole card converts instantly; type into the mole field instead and it works in reverse.
How many moles are in 25.0 g of glucose? Molar mass first: 180.156 g/mol from the table above. Then n = 25.0 ÷ 180.156 = 0.1388 mol, which holds 0.1388 × 6.022 × 10²³ ≈ 8.36 × 10²² molecules. Now run it backward for a lab prep: to measure out 0.75 mol of NaCl you'd weigh 0.75 × 58.440 = 43.83 g.
One thing that trips up first-year students: molar mass (in g/mol) and molecular weight (a relative mass with no units, or the same number in daltons per molecule) are numerically identical. Only the label changes. For ionic salts like NaCl there aren't discrete molecules, so chemists call it formula weight instead, but it's the same number and it works the same way in stoichiometry.
Every row under the result is one element: its atomic weight, how many atoms of it the formula contains, and the product of the two. The subtotals add up to the molar mass. Here's the table the calculator builds for potassium ferrocyanide, K4Fe(CN)6, a formula that tests both a plain subscript and a parenthesized group.
| Element | Count | Atomic weight (g/mol) | Subtotal (g/mol) |
|---|---|---|---|
| K (potassium) | 4 | 39.098 | 4 × 39.098 = 156.392 |
| Fe (iron) | 1 | 55.845 | 1 × 55.845 = 55.845 |
| C (carbon) | 6 | 12.011 | 6 × 12.011 = 72.066 |
| N (nitrogen) | 6 | 14.007 | 6 × 14.007 = 84.042 |
| Total | 368.345 |
Notice how the (CN)6 group became six carbons and six nitrogens. That's the distribution step people skip when they do it by hand. If you forget it, you'll get 4 × 39.098 + 55.845 + 12.011 + 14.007 = 238.255, which is way off.
Divide any subtotal by the total and multiply by 100 to get that element's mass percent. Water is 2.016 ÷ 18.015 = 11.19% hydrogen and 88.81% oxygen. Glucose works out to 40.00% carbon, 6.71% hydrogen and 53.28% oxygen. For a hydrate you can do the same with the water as a block: in CuSO4·5H2O, 90.075 ÷ 249.677 means 36.08% of the crystal's mass is water, which is why it loses over a third of its weight when you heat it.
These extend the table above. Every value comes from the same atomic weights the calculator uses, so you'll get these exact numbers if you type the formula in.
| Compound | Formula to type | Molar Mass (g/mol) |
|---|---|---|
| Acetic acid (vinegar) | CH3COOH | 60.052 |
| Nitric acid | HNO3 | 63.012 |
| Potassium chloride | KCl | 74.548 |
| Ammonium nitrate | NH4NO3 | 80.043 |
| Phosphoric acid | H3PO4 | 97.994 |
| Potassium nitrate | KNO3 | 101.102 |
| Calcium chloride | CaCl2 | 110.978 |
| Octane | C8H18 | 114.232 |
| Ammonium sulfate | (NH4)2SO4 | 132.134 |
| Calcium chloride dihydrate | CaCl2·2H2O | 147.008 |
| Silver nitrate | AgNO3 | 169.874 |
| Gypsum | CaSO4·2H2O | 172.164 |
| Citric acid | C6H8O7 | 192.123 |
| Caffeine | C8H10N4O2 | 194.194 |
| Epsom salt | MgSO4·7H2O | 246.466 |
| Washing soda | Na2CO3·10H2O | 286.138 |
| Calcium phosphate | Ca3(PO4)2 | 310.174 |
| Sucrose (table sugar) | C12H22O11 | 342.297 |
| Borax | Na2B4O7·10H2O | 381.363 |
| Potassium alum | KAl(SO4)2·12H2O | 474.372 |
The parser is strict on purpose. It would rather show an error than hand you a plausible-looking wrong answer. Here's what it handles:
Element symbols from H to U. All 92 naturally occurring elements are in its table, hydrogen through uranium. Symbols must start with a capital letter, with an optional lowercase second letter. Synthetic elements past uranium (Np, Pu and so on) and isotope labels like D for deuterium aren't included, so they return "Unknown element".
Subscripts, parentheses and leading coefficients. Write subscripts as plain digits after the symbol. Parentheses can nest, and the number after a closing parenthesis multiplies everything inside. A number at the very start multiplies the whole formula, so 2H2O gives 36.030. Spaces are ignored.
One hydrate dot. Use ·, a period, * or ~ between the salt and the water, as in MgSO4·7H2O. The number right after the dot applies to the water.
And here's what doesn't work:
Lowercase formulas. h2o returns "Unexpected character". Capitals matter because CO (carbon monoxide, 28.010) and Co (cobalt, 58.933) are different things.
Square brackets and charges. Rewrite [Cu(NH3)4]SO4 as Cu(NH3)4SO4 (227.726 g/mol). Ion charges like SO4^2- aren't accepted. Drop the charge, since electrons don't change the mass at three decimals anyway.
Fractions and decimal subscripts. The ½ symbol is rejected. Because a period counts as a hydrate dot, decimal subscripts such as Fe0.95O won't be read as decimals at all, and the result won't mean anything. For plaster of Paris (CaSO4·½H2O), type (CaSO4)2·H2O to get 290.283 and halve it: 145.14 g/mol.
A coefficient in front of a hydrate. The leading number multiplies the water too, so 2CaSO4·H2O comes out as 308.298, not 290.283. Use parentheses instead, as shown above.
A number inside an opening parenthesis. (2H2O) is an error. Put the multiplier after the group: (H2O)2.
Usually it's rounding in the atomic weight table, not a mistake. This calculator uses IUPAC's abridged values: chlorine is 35.45, sulfur 32.06, lithium 6.94. Older books often print 35.453 for chlorine or 32.065 for sulfur, and some round everything to two decimals (H 1.01, O 16.00). That's why NaCl shows up as 58.44 in one source and 58.443 in another. For lab work, the third decimal almost never matters, because your balance probably isn't that precise. If your teacher wants a specific table, match their values and you'll match their key.
Molar mass is the mass of one mole of a substance, in grams per mole (g/mol). Numerically it equals the sum of the atomic weights of every atom in the chemical formula: water (H2O) is 2 × 1.008 + 15.999 = 18.015 g/mol, and glucose (C6H12O6) is 6 × 12.011 + 12 × 1.008 + 6 × 15.999 = 180.156 g/mol. One mole always contains 6.022 × 10²³ particles, so molar mass is the bridge between grams on a scale and molecules in a flask.
Write out the formula, list each element with its count (multiplying through any parentheses), look up each element's atomic weight, multiply by the count, and add the subtotals. For Ca(OH)2: calcium 40.078, plus 2 × oxygen (15.999), plus 2 × hydrogen (1.008), which totals 74.092 g/mol. The calculator automates exactly this, including nested groups like Al2(SO4)3 (342.132 g/mol).
18.015 g/mol. Two hydrogens at 1.008 each plus one oxygen at 15.999 sum to 18.015 grams per mole, so one mole of water weighs 18.015 grams, about 18 milliliters.
Multiply the water count through the whole H2O unit and add it to the anhydrous salt. Copper(II) sulfate pentahydrate is CuSO4 (159.602 g/mol) plus 5 × H2O (5 × 18.015 = 90.075), totaling 249.677 g/mol. The calculator accepts the dot written as ·, ., *, or ~.
Divide mass by molar mass: moles = grams ÷ g/mol. For 25.0 g of glucose, 25.0 ÷ 180.156 = 0.1388 mol. Going the other way, grams = moles × molar mass, so 0.75 mol of NaCl weighs 0.75 × 58.440 = 43.83 g. Multiply moles by 6.022 × 10²³ if you need particle counts.
Divide each element's subtotal by the total molar mass and multiply by 100. Water's two hydrogens weigh 2.016 g/mol out of 18.015, so it's 11.19% hydrogen and 88.81% oxygen. Glucose is 40.00% carbon, 6.71% hydrogen and 53.28% oxygen. The breakdown table gives you every subtotal you need.
"Unexpected character" means the formula has something the parser can't read: a lowercase first letter (h2o), square brackets, a charge like ^2-, a fraction symbol, or a number right after an opening parenthesis. "Unknown element" means the symbol isn't in its table of elements H through U, which often happens with a capitalization slip like No or Cn. Fix the symbol and the result appears straight away.
No. Swap square brackets for parentheses, so [Cu(NH3)4]SO4 becomes Cu(NH3)4SO4 (227.726 g/mol), and leave charges off. Decimal subscripts don't work because a period is read as a hydrate dot. For a half-hydrate like CaSO4·½H2O, enter (CaSO4)2·H2O (290.283 g/mol) and divide by 2 to get 145.14 g/mol.
Different atomic weight tables round differently. This calculator uses IUPAC abridged values such as Cl 35.45 and S 32.06, while some books use 35.453 and 32.065, or round to H 1.01 and O 16.00. The gap is usually in the second or third decimal place, which is smaller than most lab balances can measure.