Almost every chemistry calculation starts with the same quiet question: how much does one mole of this substance weigh? Weigh out the wrong mass and a solution comes out too strong, a reaction runs short of one ingredient, or a homework answer misses by just enough to lose the mark. The molecular weight calculator above answers that question from the chemical formula alone. Type the formula exactly as you would write it — H2O, NaCl, Ca(OH)2, even a hydrate such as CuSO4·5H2O — and it adds up the atomic weights of every atom in the formula, shows the total molar mass in grams per mole, and breaks the result down element by element.
This page explains what that number means, how it is calculated step by step, and how to check it by hand. It also covers the two points that trip people up most often: why capital letters in a formula can change the answer completely, and why a hydrate must include its water molecules in the total.

What molecular weight and molar mass mean
A chemical formula is a recipe written in symbols. H2O says that one molecule of water contains two hydrogen atoms joined to one oxygen atom. Each kind of atom has its own standard atomic weight, published by IUPAC: hydrogen is 1.008, oxygen is 15.999, carbon is 12.011. The molecular weight of a compound is simply the sum of the atomic weights of all the atoms in one molecule of it. Water, for example, is 2 × 1.008 + 15.999 = 18.015.
Molar mass takes the same sum and gives it a practical job. One mole of any substance contains 6.022 × 10^23 particles — Avogadro's number — and the molar mass is the mass of that mole in grams. Because the atomic weight scale and the mole are defined to fit together, the molar mass in grams per mole is numerically the same as the molecular weight. Water's molecular weight is 18.015 and its molar mass is 18.015 g/mol. That single number is the bridge between the scale in the laboratory and the particle counts in equations: divide a mass in grams by the molar mass and you have moles; multiply moles by the molar mass and you have grams.
The calculator uses the standard IUPAC atomic weights, so its results match textbooks and periodic tables.
Molecular weight vs molar mass
The two terms are often used as if they were identical, and for everyday calculations they give the same number, but they are not quite the same quantity. Molecular weight, more precisely called relative molecular mass, is a ratio: it compares the mass of one molecule with one twelfth of the mass of a carbon-12 atom, so strictly it has no unit. Molar mass is the mass of one mole of a substance, and it carries the unit grams per mole (g/mol).
There is one more distinction worth knowing. Molecular weight only really applies to substances that exist as molecules, such as water, glucose or carbon dioxide. Ionic compounds such as sodium chloride form crystal lattices rather than single molecules; for those, chemists talk about the formula mass of one formula unit, but the arithmetic is identical. This calculator reports everything in g/mol, the form you need for laboratory work.
How to calculate molecular weight step by step
The method never changes, however complicated the formula looks. It has four steps.
Step 1: Count the atoms of each element. Read the formula and tally every element. Numbers after a symbol multiply only that symbol, so H2O has 2 hydrogen and 1 oxygen. Brackets multiply everything inside them: in Ca(OH)2, the 2 outside the bracket applies to both the oxygen and the hydrogen, giving 1 calcium, 2 oxygen and 2 hydrogen.
Step 2: Look up each element's atomic weight. Use a periodic table or the values built into the calculator. A few values cover a large share of everyday compounds: hydrogen 1.008, carbon 12.011, nitrogen 14.007, oxygen 15.999, sodium 22.990, magnesium 24.305, sulfur 32.06, chlorine 35.45, calcium 40.078 and iron 55.845.
Step 3: Multiply each count by its atomic weight. This gives the mass contribution of each element — exactly what the breakdown table under the calculator shows.
Step 4: Add the contributions. The sum is the molar mass in g/mol. Do not round the contributions before adding them; round only the final answer, normally to three decimal places.
Worked examples
Water, H2O = 18.015 g/mol. Hydrogen contributes 2 × 1.008 = 2.016, and oxygen contributes 1 × 15.999 = 15.999. Adding them gives 2.016 + 15.999 = 18.015 g/mol.
Sodium chloride, NaCl = 58.44 g/mol. There is one atom of each element, so the calculation is a single addition: 22.990 + 35.45 = 58.440 g/mol, written as 58.44 g/mol.
Calcium hydroxide, Ca(OH)2 = 74.092 g/mol. The bracket doubles the hydroxide group: 1 calcium, 2 oxygen and 2 hydrogen. The contributions are 40.078 + (2 × 15.999) + (2 × 1.008) = 40.078 + 31.998 + 2.016 = 74.092 g/mol. Forgetting the bracket multiplier is the most common hand-calculation error.
Glucose, C6H12O6 = 180.156 g/mol. Carbon contributes 6 × 12.011 = 72.066, hydrogen 12 × 1.008 = 12.096, and oxygen 6 × 15.999 = 95.994. The total is 72.066 + 12.096 + 95.994 = 180.156 g/mol.
Copper(II) sulfate pentahydrate, CuSO4·5H2O = 249.677 g/mol. The dot joins two parts, and the 5 multiplies the whole water part that follows it. The anhydrous part contributes 63.546 + 32.06 + (4 × 15.999) = 63.546 + 32.06 + 63.996 = 159.602, and the five waters contribute 5 × 18.015 = 90.075. Together: 159.602 + 90.075 = 249.677 g/mol. The water is part of the crystal and part of its mass.
Percent composition by mass
The breakdown table gives one more useful figure for every element: its percent composition, the share of the compound's total mass that comes from that element. Divide the element's mass contribution by the molar mass and multiply by 100.
Water makes the idea concrete. Hydrogen contributes 2.016 of the 18.015 g/mol, so hydrogen is 2.016 ÷ 18.015 × 100 = 11.19% of water by mass, and oxygen is 15.999 ÷ 18.015 × 100 = 88.81%. The percentages always add to 100%, apart from a hundredth or two lost to rounding. It also explains a surprising result: even though water has twice as many hydrogen atoms as oxygen atoms, it is almost 89% oxygen by mass, because one oxygen atom weighs nearly sixteen times as much as one hydrogen atom.
Percent composition is more than a check. It is how chemists confirm that a sample matches its formula, how fertiliser labels state their nitrogen content, and how unknown compounds are identified from their measured composition.
Molar mass of a single element: magnesium and hydrogen
A formula does not need several elements. If you enter a single symbol, the calculator returns that element's own molar mass, which is simply its atomic weight expressed in g/mol. Two single-element lookups are searched for constantly, so they are worth stating plainly.
The molar mass of Mg (magnesium) is 24.305 g/mol. One mole of magnesium atoms weighs 24.305 grams. Magnesium turns up everywhere in introductory chemistry, so its value is one of the first students need. Enter Mg in the calculator, with a capital M and a lowercase g, and the breakdown shows a single row: one atom, 24.305 g/mol, 100% by mass.
The molar mass of H (hydrogen) is 1.008 g/mol. Hydrogen is the lightest element. Enter H and you get 1.008 g/mol. Be careful with the formula you type: H on its own is the element, while H2 is the hydrogen gas molecule, with a molar mass of 2.016 g/mol. The calculator answers for exactly the formula you give it, so the distinction is yours to make.
Reading formulas correctly: case, brackets and hydrates
Most wrong answers from any molecular weight calculator, including careful hand calculations, come from the formula rather than the maths. Three rules prevent nearly all of them.
Capitalisation is part of the symbol. Element symbols are one capital letter, sometimes followed by one lowercase letter, and the calculator reads them exactly that way. Co is cobalt, a single element with a molar mass of 58.933 g/mol. CO is two elements, carbon and oxygen, and carbon monoxide's molar mass is 12.011 + 15.999 = 28.010 g/mol. Always copy the capitalisation from the formula as written.
Brackets group atoms, and the number after them multiplies the group. Round brackets are standard, and square brackets do the same job in complex ions such as K4[Fe(CN)6], where the inner (CN)6 group sits inside the outer bracket. Groups can nest, and each multiplier applies to everything inside its own pair of brackets.
Hydrates add whole extra formula parts. A dot (written ·, . or *) joins water or another solvent part to the main formula, and a leading number multiplies that whole part. The calculator accepts all three separators, so CuSO4·5H2O, CuSO4*5H2O and CuSO4.5H2O all give 249.677 g/mol.
Where molar mass is used
Molar mass is the conversion factor behind most quantitative chemistry. Preparing a solution of a stated concentration means weighing out molar mass times the moles needed — the job our molarity calculator handles once you know the molar mass from this page. Getting this one number right, with the brackets and hydrate water counted properly, is what makes the rest of the calculation trustworthy.
FAQs
What is the molecular weight of water?
The molecular weight of water (H2O) is 18.015 g/mol. It is calculated as 2 × 1.008 for the two hydrogen atoms plus 1 × 15.999 for the oxygen atom, which gives 2.016 + 15.999 = 18.015 g/mol.
What is the molar mass of Mg?
The molar mass of Mg (magnesium) is 24.305 g/mol. A single element's molar mass is its standard atomic weight expressed in grams per mole.
What is the molar mass of H?
The molar mass of H (hydrogen) is 1.008 g/mol, the lightest of all the elements. Note that H2, the hydrogen gas molecule, is different: its molar mass is 2 × 1.008 = 2.016 g/mol.
What is the difference between molecular weight and molar mass?
Molecular weight (relative molecular mass) is the mass of one molecule compared with one twelfth of a carbon-12 atom, so it has no unit. Molar mass is the mass of one mole of the substance in grams per mole (g/mol). The two have the same numerical value.
How do I calculate the molar mass of a compound with brackets, like Ca(OH)2?
Multiply everything inside the brackets by the number after them, then add up count times atomic weight for each element. Ca(OH)2 contains 1 calcium, 2 oxygen and 2 hydrogen, so its molar mass is 40.078 + (2 × 15.999) + (2 × 1.008) = 74.092 g/mol.
How do I calculate the molar mass of a hydrate like CuSO4·5H2O?
Treat the part after the dot as a separate formula multiplied by its leading number, then add it to the main part. CuSO4 contributes 159.602 g/mol and 5H2O contributes 5 × 18.015 = 90.075 g/mol, giving a total molar mass of 249.677 g/mol.
What is percent composition and how is it calculated?
Percent composition is each element's share of a compound's total mass. Divide the element's mass contribution (atoms times atomic weight) by the molar mass and multiply by 100. In water, hydrogen is 2.016 ÷ 18.015 × 100 = 11.19% and oxygen is 88.81% by mass.
Why does capitalisation matter in a chemical formula?
Because element symbols are case-sensitive: the first letter is always a capital and the second, if there is one, is always lowercase. Co is the single element cobalt (58.933 g/mol), while CO is carbon plus oxygen (28.010 g/mol). Changing the case changes the elements, and so the molar mass.
