Home › Math & Science › Molecular Weight Calculator

Molecular Weight Calculator

Finding the molar mass of a compound by hand means looking up every atomic weight and adding up the products — slow work, and easy to get wrong on a long formula. This free molecular weight calculator does it instantly: type any chemical formula, including parentheses, brackets, and hydrates, and it returns the molecular weight in g/mol with a per-element breakdown showing exactly where every gram comes from.

Use standard symbols: a capital letter, then a lowercase letter if the element has one. Parentheses and brackets work — try Ca(OH)2 or MgSO4·7H2O.

180.156 g/mol
Molar mass of C6H12O6 · 24 atoms in total

How it works

A molecular weight is simply the sum of the atomic weights of every atom in the formula. The calculator reads your formula the way a chemist does, in three steps. First, it splits the formula into element symbols and counts: in C6H12O6 there are 6 carbons, 12 hydrogens, and 6 oxygens. Second, it handles groups — anything inside parentheses or brackets is multiplied by the number after the closing bracket, so the (OH)2 in Ca(OH)2 means two oxygens and two hydrogens. Third, it multiplies each count by that element's standard atomic weight and adds everything up.

Molecular weight = Σ (atoms of each element × atomic weight of that element), using IUPAC standard atomic weights — for example H = 1.008, C = 12.011, O = 15.999

Hydrates — crystals that trap water molecules, written with a dot such as CuSO4·5H2O (blue vitriol) — are handled too. Everything after the dot is counted as extra formula units: the 7H2O in MgSO4·7H2O adds 14 hydrogens and 7 oxygens on top of the MgSO4. You can type the dot as ·, as a plain period, or as *, and leading numbers on a hydrate part are read as multipliers, exactly as written in textbooks.

The atomic weights are not whole numbers because most elements occur as mixtures of isotopes. Chlorine, for example, is about three-quarters chlorine-35 and one-quarter chlorine-37, so its average atomic weight is 35.45. The values used here are the standard atomic weights published by IUPAC, which is why this calculator's answers match a modern periodic table to three decimal places.

The breakdown table under the result shows each element's count, atomic weight, total contribution, and percentage of the whole mass. The percentage column is genuinely useful in the lab: it tells you, for instance, that oxygen makes up about 53.3% of the mass of glucose, which is the starting point for percent-composition and empirical-formula problems.

Worked example

Find the molecular weight of glucose, C6H12O6 — the sugar in blood and in a standard IV drip.

Step 1 — count the atoms: 6 carbon, 12 hydrogen, 6 oxygen.
Step 2 — multiply by the atomic weights: carbon 6 × 12.011 = 72.066; hydrogen 12 × 1.008 = 12.096; oxygen 6 × 15.999 = 95.994.
Step 3 — add the products: 72.066 + 12.096 + 95.994 = 180.156 g/mol.

So one mole of glucose weighs 180.156 grams, and oxygen accounts for 95.994 ÷ 180.156, or about 53.3%, of that mass. Type C6H12O6 into the calculator above and you get exactly this result, with the same three rows in the breakdown table.

Common mistakes

Getting the capitalization wrong. Element symbols are case-sensitive: Co is cobalt, CO is carbon and oxygen. A formula typed in all lowercase, like "h2o", cannot be read unambiguously — write H2O.

Forgetting that a subscript after a bracket multiplies everything inside it. In Ca(OH)2 the 2 applies to both the O and the H, giving two of each — not two hydroxides' worth of oxygen and one hydrogen. The calculator applies the multiplier to the whole group automatically.

Leaving the hydrate water out. Epsom salt is MgSO4·7H2O, and the seven waters make up more than half its mass (126.105 of 246.466 g/mol). Weighing out the anhydrous MgSO4 value when your jar contains the hydrate throws a lab preparation off badly.

Rounding atomic weights too early. Using O = 16 and H = 1 gives water as 18.000 instead of 18.015 — fine for a rough check, but the error grows on long formulas. This calculator keeps full IUPAC precision until the final rounding to three decimals.

FAQ

How do you calculate the molecular weight of a compound?

Multiply the atomic weight of each element by the number of atoms of that element in the formula, then add the products together. For water, H2O, that is 2 × 1.008 for the hydrogen plus 1 × 15.999 for the oxygen, which gives 18.015 g/mol.

What is the difference between molecular weight and molar mass?

The two numbers are the same; only the units and the name differ. Molecular weight is the relative mass of one molecule compared with carbon-12, so it has no unit. Molar mass is the mass of one mole of the substance, expressed in grams per mole (g/mol). A molecular weight of 18.015 for water means a molar mass of 18.015 g/mol.

Does this calculator handle parentheses and hydrates?

Yes. Parentheses multiply everything inside them, so Ca(OH)2 is read as one calcium, two oxygens, and two hydrogens, giving 74.092 g/mol. A middle dot adds a hydrate, so MgSO4·7H2O includes seven extra water molecules and gives 246.466 g/mol. You can type the dot as ·, ., or * and use square brackets as well as round ones.

Why does capitalization matter in a chemical formula?

Because element symbols are case-sensitive. CO means one carbon and one oxygen (carbon monoxide), while Co is the single element cobalt. If the calculator cannot read your formula, check that each element starts with a capital letter and that any second letter is lowercase.

Which atomic weights does this calculator use?

It uses the standard atomic weights published by IUPAC, the values printed on most modern periodic tables — for example hydrogen 1.008, carbon 12.011, oxygen 15.999, iron 55.845, and gold 196.967. Small differences in the last decimal place between textbooks come from rounding these same values.

Can I calculate the weight of a formula with brackets, like K4[Fe(CN)6]?

Yes. Square brackets work exactly like parentheses, and groups can be nested. K4[Fe(CN)6] is read as 4 potassium atoms plus an iron, 6 carbons, and 6 nitrogens inside the bracketed group, giving a molar mass of 368.345 g/mol.

Disclaimer: Results are for education and general use. Check important calculations independently before relying on them for exams, lab work, or decisions where accuracy matters.