Guide
How to Calculate Molecular Weight from a Chemical Formula: Brackets, Subscripts and Ions
A chemical formula is a counting instruction: it tells you exactly how many atoms of each element are in one molecule or one formula unit. This guide works through every part of that instruction, subscripts, brackets, nested groups, hydrates and charges, with each molecular weight checked against the calculator.
Element symbols and subscripts
Every formula is built from element symbols. A symbol starts with a capital letter, and a second letter, if there is one, is lowercase: H is hydrogen, He is helium, Na is sodium, Cl is chlorine. The small number after a symbol, the subscript, counts the atoms of that element. A symbol with no number after it counts once.
Water, H2O, is 2 hydrogens and 1 oxygen: 2 x 1.008 + 15.999 = 18.015 g/mol. Sulfuric acid, H2SO4, is 2 hydrogens, 1 sulfur and 4 oxygens: 2 x 1.008 + 32.06 + 4 x 15.999 = 2.016 + 32.06 + 63.996 = 98.072 g/mol.
Longer formulas work the same way, one element at a time. Ethanol, C2H5OH, has 2 carbons, 6 hydrogens and 1 oxygen: 2 x 12.011 + 6 x 1.008 + 15.999 = 24.022 + 6.048 + 15.999 = 46.069 g/mol. Acetic acid, CH3COOH, has 2 carbons, 4 hydrogens and 2 oxygens: 2 x 12.011 + 4 x 1.008 + 2 x 15.999 = 24.022 + 4.032 + 31.998 = 60.052 g/mol. The step by step method for simple formulas is covered in the guide How to Calculate Molecular Mass: Step-by-Step Examples.
Brackets: multiply the whole group
A bracket groups atoms together, and the number after the closing bracket multiplies everything inside it. Calcium hydroxide, Ca(OH)2, is 1 calcium plus two OH groups: 40.078 + 2 x (15.999 + 1.008) = 40.078 + 34.014 = 74.092 g/mol.
The same rule works when the group is bigger. Ammonium sulfate, (NH4)2SO4, is two NH4 groups plus one SO4 group. Each NH4 is 14.007 + 4 x 1.008 = 18.039, so the working is: 2 x 18.039 + 32.06 + 4 x 15.999 = 36.078 + 32.06 + 63.996 = 132.134 g/mol.
Aluminium sulfate, Al2(SO4)3, has the subscript 2 on the aluminium outside the bracket and the subscript 3 on the whole sulfate group: 2 x 26.982 + 3 x 32.06 + 12 x 15.999 = 53.964 + 96.180 + 191.988 = 342.132 g/mol. Note how the 3 after the bracket triples both the sulfur and the oxygen, giving 3 sulfurs and 12 oxygens.
Nested brackets: groups inside groups
Brackets can sit inside other brackets, and the calculator accepts both round brackets and square brackets, as long as each opening bracket is closed by the same kind. The outer number multiplies everything inside, including inner groups.
Tetraamminecopper(II), [Cu(NH3)4]2+, has one copper, four ammonia groups, and a 2+ charge. Each NH3 is 14.007 + 3 x 1.008 = 17.031, so the working is: 63.546 + 4 x 17.031 = 63.546 + 68.124 = 131.670 g/mol.
Hexacyanoferrate(III), [Fe(CN)6]3-, has one iron and six cyanide groups. Each CN is 12.011 + 14.007 = 26.018, so the working is: 55.845 + 6 x 26.018 = 55.845 + 156.108 = 211.953 g/mol.
There is one trap with the number after a closing bracket. If a charge sign follows it, the number is the charge, not a multiplier. In [Fe(CN)6]3- the 3 is the charge on the ion, so it is one ion at 211.953 g/mol, not three of them. A number with no sign after it is still a multiplier, which is why Ca(OH)2 and (NH4)2SO4 work as they do.
Hydrates: the dot means add water
Some crystals carry water molecules locked inside them, called water of crystallisation. The formula shows this with a dot: copper sulfate pentahydrate is written CuSO4.5H2O, five waters for each CuSO4. The calculator accepts a full stop, a middle dot or an asterisk as the dot, and a number after the dot counts the waters.
Anhydrous copper sulfate is 63.546 + 32.06 + 4 x 15.999 = 159.602 g/mol. Five waters add 5 x 18.015 = 90.075 g/mol, so the hydrate is 159.602 + 90.075 = 249.677 g/mol. That water is part of the weighed solid, so weighing the wrong form throws a solution out.
A number at the very start of a formula multiplies the whole thing. 2H2O is two water molecules: 2 x 18.015 = 36.030 g/mol. The same leading number works before a bracketed group, so 2(NH4)2SO4 would be two formula units at 2 x 132.134 = 264.268 g/mol.
Ions: charges do not change the mass
A charge is a missing or extra electron, far too light to matter at this precision, so a charge never changes the molecular weight, and the calculator ignores charges when it adds the atoms up. What matters is reading the number next to the charge correctly.
For a single atom, a number followed by a charge sign is the charge, not a count. Fe3+ is one iron(III) ion at 55.845 g/mol, not three irons. Ca2+ is one calcium ion at 40.078 g/mol.
For a group that already has atoms in it, the number is a count and the sign is the charge. NH4+ is one nitrogen and four hydrogens: 14.007 + 4 x 1.008 = 18.039 g/mol. NO3- is one nitrogen and three oxygens: 14.007 + 3 x 15.999 = 62.004 g/mol. A charge on a group of several atoms is written with a caret, as in SO4^2-, which is 32.06 + 4 x 15.999 = 96.056 g/mol.
There is one exception, for the elements that form diatomic molecules: hydrogen, nitrogen, oxygen, fluorine, chlorine, bromine and iodine. For these, the number is a count even when it stands alone with a charge sign, because the charged species is the two-atom molecule. H2+ is the dihydrogen cation at 2 x 1.008 = 2.016 g/mol, O2- is the superoxide ion at 2 x 15.999 = 31.998 g/mol, and N2+ is 2 x 14.007 = 28.014 g/mol.
What the calculator refuses
Some inputs are not valid formulas, and the calculator says so instead of guessing. A count of zero is never valid: H0, C0 and (OH)0 are all rejected, because a group must appear at least once. Brackets must match by type, so Ca(OH]2 is rejected with a mismatched brackets message. An unknown symbol such as Xx is rejected, and a number on its own, with nothing to count, is rejected too. Each rejection comes with a message that names the character where the problem sits, so the fix is usually one keystroke.
Try it yourself: open the Molecular Weight Calculator, type [Fe(CN)6]3-, and check that you get 211.953 g/mol. Then try Fe3+ and confirm it is 55.845 g/mol, one iron, not three.
Last reviewed: November 16, 2026