Molar Mass Calculator: Build the Compound From Its Elements

Molar mass, built one element at a time

Five element dropdowns and five subscript boxes. There is no box to type H2SO4 into, and this page will not pretend otherwise: it works by picking elements and saying how many atoms of each, which is exactly the sum a molar mass is. In return it shows you where the mass actually sits — in sulfuric acid, two thirds of it is the oxygen.

Molar mass from the formula's elements

Pick the elements, type the subscripts
The first element in your formula. The list is the IUPAC abridged standard atomic weights, and the number in brackets is the one the arithmetic uses — so you can see straight away whether your textbook’s rounded 1, 12, 14, 16 or 32 will change your answer. The order of the slots does not matter: molar mass is a sum, and a sum does not care which term comes first. Writing water as O then H gives 18.015 just as H then O does.
The subscript on the first element. Whole numbers only: a chemical formula has no half atoms. Set it to 0 to switch the slot off without changing the element above it, which is the quickest way to see what one part of a formula was contributing.
The second element. Leave it empty and you have an element rather than a compound, which is a legitimate thing to ask for: picking oxygen with a subscript of 2 gives 31.998 g/mol for O2, the figure a gas-law question wants.
The subscript on the second element. Watch the brackets in your formula: calcium nitrate is Ca(NO3)2, so the nitrogen subscript is 2 and the oxygen subscript is 6, not 3. The bracket multiplies everything inside it, and forgetting that is the commonest way a molar mass comes out too small.
The third element. Three slots cover most of school chemistry: sulfates, nitrates, carbonates, hydroxides, every simple organic compound, and all of the common acids.
The subscript on the third element.
The fourth element, for the ones that need it — potassium permanganate KMnO4, sodium thiosulfate Na2S2O3, calcium hydrogencarbonate, or an organic compound carrying nitrogen as well as carbon, hydrogen and oxygen.
The subscript on the fourth element.
The fifth slot exists for hydrated salts, which are the usual reason a formula runs out of room. Copper(II) sulfate pentahydrate, written CuSO4·5H2O, is copper 1, sulfur 1, oxygen 9 and hydrogen 10 — the four oxygens of the sulfate plus the five from the water molecules, all in one slot, because a sum does not mind where an atom came from. That is 249.677 g/mol, and the anhydrous salt is 159.602.
The subscript on the fifth element. For a hydrate, add the water’s atoms in here or fold them into the slots above — the total is the same either way.
Each circle is one slot of your formula, drawn with its AREA proportional to the mass that slot contributes, labelled with its percentage above and, below it, the grams per mole that slot adds to the total. Empty slots do not draw. At the page defaults the formula is H2SO4, and the point of the picture is immediate: the four oxygens make the biggest circle by a wide margin, the single sulfur is second, and the two hydrogens are nearly invisible at two per cent of the mass.
98.072g/molExample

sulfuric acid, H2SO4 — hydrogen with a subscript of 2, sulfur with 1, oxygen with 4, two slots left empty

Advertisement

A molar mass is a sum, and a sum is something a dropdown can do

M = Σ (Ar × subscript)    M(H2SO4) = 2(1.0080) + 32.06 + 4(15.999) = 98.072 g mol−1
Ar
the relative atomic mass of one element — the number in brackets in each dropdown. It is dimensionless, a ratio against one twelfth of a carbon-12 atom, and it is a weighted mean over the isotopes found in ordinary terrestrial material rather than the mass of any one atom
subscript
how many atoms of that element one formula unit contains. A bracket multiplies everything inside it, so Ca(NO3)2 is calcium 1, nitrogen 2, oxygen 6 — the single most common place a molar mass goes wrong on this page
M
the molar mass, in grams per mole. Numerically it is the same as the relative formula mass, which has no unit at all; they are different quantities that happen to share a number, and the definition of the mole is what arranges that
u
the unified atomic mass unit, used here only in the mean-mass-per-atom row. One formula unit of H2SO4 has a mass of 98.072 u; one mole of them has a mass of 98.072 g. Same number, different scale, and that is the whole trick of the mole
Σ
a sum over the slots, which is why the order of the slots cannot matter and why switching a slot off with a subscript of 0 simply removes its term

Worked example

sulfuric acid, H2SO4 — hydrogen with a subscript of 2, sulfur with 1, oxygen with 4, two slots left empty
SET THE SLOTS. First slot hydrogen, subscript 2. Second slot sulfur, subscript 1. Third slot oxygen, subscript 4. Fourth and fifth left as the empty option with subscript 0. Nothing about this ordering matters; sulfur first would give the same total.
HYDROGEN. 2 × 1.0080 = 2.016 g/mol. Two atoms, and they contribute two grams per mole out of ninety-eight. Hydrogen is almost always the element students over-weight in their heads, because there are usually a lot of atoms of it and they are each almost nothing.
SULFUR. 1 × 32.06 = 32.06 g/mol. One atom, a third of the mass. Note that CIAAW prints sulfur to four significant figures and not five: its atomic weight varies between natural sources by enough that the fifth figure would be a fiction.
OXYGEN. 4 × 15.999 = 63.996 g/mol. Four atoms, and nearly two thirds of the mass of the molecule. This is the number the diagram is built to make obvious.
ADD. 2.016 + 32.06 + 63.996 = 98.072 g/mol. With a textbook's rounded values (1, 32, 16) you would get 98 exactly, which is the same answer to three significant figures and is what a mark scheme expects. The extra decimals matter when you are weighing out a standard solution, not when you are answering question 4(b).
CHECK THE SHARES. 2.06 per cent hydrogen, 32.69 per cent sulfur, 65.25 per cent oxygen. They add to 100, which is the only free self-check this page offers: if your shares do not sum to a hundred you have mistyped a subscript.
Advertisement

Twelve formulae a school question actually asks for, with the slots to type in

CompoundSlots (element and subscript)Molar massWhere the mass sits
Water, H2OH 2, O 118.015O 88.8%, H 11.2%
Carbon dioxide, CO2C 1, O 244.009O 72.7%, C 27.3%
Sulfuric acid, H2SO4H 2, S 1, O 498.072O 65.3%, S 32.7%, H 2.1%
Sodium chloride, NaClNa 1, Cl 158.44Cl 60.7%, Na 39.3%
Calcium carbonate, CaCO3Ca 1, C 1, O 3100.086O 48.0%, Ca 40.0%, C 12.0%
Ammonium nitrate, NH4NO3N 2, H 4, O 380.043O 60.0%, N 35.0%, H 5.0%
Glucose, C6H12O6C 6, H 12, O 6180.156O 53.3%, C 40.0%, H 6.7%
Calcium nitrate, Ca(NO3)2Ca 1, N 2, O 6164.086O 58.5%, Ca 24.4%, N 17.1%
Potassium permanganate, KMnO4K 1, Mn 1, O 4158.032O 40.5%, Mn 34.8%, K 24.7%
Copper(II) sulfate, CuSO4Cu 1, S 1, O 4159.602O 40.1%, Cu 39.8%, S 20.1%
The pentahydrate, CuSO4·5H2OCu 1, S 1, O 9, H 10249.677O 57.7%, Cu 25.5%, S 12.8%, H 4.0%
Sucrose, C12H22O11C 12, H 22, O 11342.297O 51.4%, C 42.1%, H 6.5%
Every molar mass here was produced by this page from the CIAAW abridged atomic weights, so they carry more decimals than a textbook will. Two rows are worth pausing on. Ammonium nitrate needs nitrogen 2, not two separate nitrogen slots, because the formula has one nitrogen in the ammonium and one in the nitrate and a sum does not distinguish them. And copper(II) sulfate pentahydrate needs oxygen 9 and hydrogen 10 — the four oxygens of the sulfate plus five from the water — which is why the hydrated salt is 56 per cent heavier than the anhydrous one and why a titration made up from the wrong one is 56 per cent out.

Why there is no box to type a formula into

The calculator on this page is a numeric engine. It adds, multiplies, divides and takes roots; it has no idea what a letter is. So it cannot be handed the string H2SO4 and asked to work out what you meant. Plenty of sites offer that box, and when it works it is pleasant. What it does when it fails is the problem: a typed formula parser has to guess, and a wrong guess looks exactly like a right one. CO is carbon monoxide; Co is cobalt, five times heavier. Hf is hafnium; HF is hydrogen fluoride. A parser that silently resolves those gives you a confident number that is nine times wrong.

Dropdowns cannot make that mistake. You tell the page which element, it tells you which atomic weight it is using, and the arithmetic is visible. The cost is that you have to read your own formula and split it into elements and subscripts — which, for a reader who is learning this, is the part worth practising anyway. A formula box does the only hard step for you and hides it.

Read the brackets before you type. This is where almost every wrong answer on this page comes from. Calcium nitrate is Ca(NO3)2: the subscript 2 outside the bracket multiplies both the nitrogen and the three oxygens, so you type nitrogen 2 and oxygen 6. Type nitrogen 1 and oxygen 3 and you get 102.082 instead of 164.086 — plausible, wrong, and no part of the page will object, because you asked it a different question and it answered that one correctly.

Hydrates need the water folded in. A dot in a formula is not a multiplication sign and not a bond; it means the crystal contains that many water molecules per formula unit. CuSO4·5H2O has 1 copper, 1 sulfur, 9 oxygens and 10 hydrogens. Because the slots are a plain sum you can put those five waters wherever is convenient. The practical consequence is large: the pentahydrate is 249.677 g/mol against the anhydrous salt’s 159.602, so weighing from the blue crystals when your calculation assumed the white powder leaves you 36 per cent short of the copper you wanted.

Molar mass and relative formula mass are not the same quantity. They share a number, which is why nobody notices. The relative formula mass Mr is a ratio of masses and has no unit; the molar mass M is grams per mole. Sulfuric acid has Mr = 98.072 and M = 98.072 g mol−1, and the definition of the mole is what arranges the agreement.

Where the mass sits is more useful than the total. The diagram draws each slot as a circle whose area is its share of the mass, and the pattern it exposes is consistent: oxygen dominates. Oxygen is light — 15.999 against sulfur’s 32.06 — but it arrives in threes, fours and sixes. In sulfuric acid oxygen is 65 per cent of the mass; in a nitrate, a carbonate or a phosphate it is over half; in glucose it is 53 per cent. Hydrogen does the opposite. Sucrose has 22 hydrogen atoms, nearly half of all its atoms, and they are 6.5 per cent of its mass. Once you expect that, a percentage composition answer that gives hydrogen thirty per cent of a sugar is visibly wrong before you check the arithmetic.

If you want the reverse journey — percentages in, formula out — that is the empirical and molecular formula calculator. If you have the molar mass and want grams, moles or a particle count, use the mole, mass and particle count calculator. For making up a solution of a known concentration from this molar mass, the laboratory side of the site has a molarity calculator and a mass-to-molar unit converter.

One honest limit, stated plainly: this page will not balance an equation, will not give you an electron configuration, will not name a compound from its formula and will not write a net ionic equation. All four need symbolic output, and the engine has none. Nothing elsewhere on this site does them either, so there is no link to follow.

Frequently asked questions

Why can I not just type the formula?

Because the engine behind every calculator on this site works only with numbers — it has no string type at all, so there is no mechanism by which it could read “H2SO4”. Rather than bolt a guessing parser onto the front, the page asks you for the elements and subscripts directly. That is the same information, split the way the arithmetic needs it, and it cannot confuse CO with Co.

Which atomic weights does it use, and will they match my textbook?

The IUPAC abridged standard atomic weights, shown in brackets beside every element so you can see them. They will not match a textbook that rounds, and that is fine: hydrogen 1.0080 against 1, oxygen 15.999 against 16 and sulfur 32.06 against 32 give 98.072 against 98 for sulfuric acid. Identical to three significant figures, which is more than any school mark scheme asks for. Use your syllabus’s values in an exam and these when you are weighing something out.

How do I enter a formula with brackets, like Ca(NO3)2 or (NH4)2SO4?

Multiply out first, then type. The subscript outside a bracket multiplies every subscript inside it. Ca(NO3)2 becomes calcium 1, nitrogen 2, oxygen 6. (NH4)2SO4 becomes nitrogen 2, hydrogen 8, sulfur 1, oxygen 4 — and note the hydrogen is 8, not 4, which is the one almost everybody gets wrong the first time.

What about CuSO4.5H2O and the other hydrates?

Add the water’s atoms into the slots. The dot means the crystal carries that many water molecules per formula unit, so five waters bring 10 hydrogens and 5 oxygens. CuSO4·5H2O is copper 1, sulfur 1, oxygen 9, hydrogen 10, giving 249.677 g/mol. It matters in the laboratory rather than on paper: the blue crystals are 36 per cent water by mass, so weighing them out against an anhydrous calculation gives you far less copper than you intended.

Why does the diagram use circle area rather than circle width?

Because area is what the eye actually reads when it compares round shapes, so a circle drawn with its area proportional to the mass share reads correctly, while one drawn with its diameter proportional exaggerates the big contributor enormously. The radius here is therefore proportional to the square root of the share. The percentages are printed above each circle so the picture never has to be trusted on its own.

Can it do an element on its own, like O2 or S8?

Yes — use one slot and leave the rest empty. Oxygen with a subscript of 2 gives 31.998 g/mol, which is what a gas-law question about oxygen gas wants; oxygen with a subscript of 1 gives 15.999 g/mol, which is what an atom-counting question wants. Sulfur with a subscript of 8 gives 256.48 g/mol for the S8 ring. The difference between those answers is exactly why the SI definition of the mole insists that you specify the entity you are counting.

Related calculators

References

  1. Commission on Isotopic Abundances and Atomic Weights (CIAAW), IUPAC, Abridged Standard Atomic Weights (read 14 November 2026). The source of every atomic weight in this batch’s dropdowns. The table read was the 2024 abridged list, which is the Standard atomic weights of the elements 2021 report (Prohaska and colleagues, IUPAC Technical Report) with 2024 revisions to gadolinium, lutetium and zirconium — none of which appears here. The values are quoted exactly as that table prints them, including the trailing zeros that carry information: hydrogen is 1.0080 ± 0.0002 and neon 20.180 ± 0.001, while lead is 207.2 ± 1.1 and argon 39.95 ± 0.16 because both vary measurably between natural sources. An atomic weight is a weighted mean over the isotopes of normal terrestrial material, not a property of one atom, which is why some elements get five figures and some get four.
  2. Bureau International des Poids et Mesures, SI base unit: mole (mol), bipm.org (read 14 November 2026). The current definition, in its own words: “One mole contains exactly 6.022 140 76 × 1023 elementary entities”, that number being the fixed numerical value of the Avogadro constant NA expressed in mol−1, so the page states the exact relation NA = 6.022 140 76 × 1023 mol−1. Since the 2019 revision the mole is defined by that count and no longer by a mass of carbon-12, so Avogadro’s number is exact by definition and carries no uncertainty at all — a change most school textbooks printed before 2019 do not yet reflect. The brochure also notes that an elementary entity may be an atom, a molecule, an ion, an electron or any other specified particle or group of particles, which is why this site always asks you what you are counting.
  3. IUPAC, Periodic Table of Elements and the accompanying announcement “Time to review your periodic table”, iupac.org (read 14 November 2026). Confirms that the standard atomic weights are revised on a two-year cycle and that the number on a classroom wall chart may be several revisions behind. Worth knowing before you argue with a marker about the third decimal place: for the elements on this page the differences between recent revisions are far smaller than the rounding a school question asks for, so a textbook’s 12, 14, 16, 1 and 32 will reproduce every answer here to the two significant figures a mark scheme wants.
  4. COULD NOT BE READ, and nothing was substituted for it. The intended school-syllabus reference for this batch was NCERT’s own Class XI chemistry Unit 1, Some Basic Concepts of Chemistry — the chapter that introduces the mole, percentage composition, the empirical formula and the limiting reagent to most of this page’s readers. A search on 14 November 2026 returned only commercial coaching mirrors and solution sites, not the NCERT document itself, so no NCERT page, example or numbered exercise is cited anywhere in this batch and no figure here is attributed to it. Where this batch names a syllabus it names it only as context. If your class works from that chapter, its worked examples use the same definitions as these pages; the arithmetic below was derived independently from the atomic weights and the definition of the mole.