Skip to content

Grams to Moles

Molar mass from

Case matters: Co is cobalt, CO is carbon monoxide. Brackets allowed, e.g. Ca(OH)2.

Amount of substance (mol) —
Molar mass (g/mol)
—
Millimoles (mmol)
—
Number of particles
—
Mass in grams
—

To convert grams to moles, divide the mass by the molar mass: n = m ÷ M. Water has a molar mass of 18.015 g/mol (two hydrogens at 1.008 plus one oxygen at 15.999), so 18 g of water is 18 ÷ 18.015 = 0.9992 mol, about 6.017 × 10^23 molecules.

About this tool

Weighing out a reagent is easy; knowing how many moles you put in the flask is what a balanced equation actually asks for. This calculator takes a mass in milligrams, grams or kilograms and either a chemical formula or a molar mass you already know. From a formula it adds up the standard atomic weights, including groups in brackets such as Ca(OH)2, and shows the sum term by term. The result is the amount in moles, the same amount in millimoles, the number of particles via the Avogadro constant, and the mass converted to grams. One limit: the formula parser covers about fifty common elements and does not read hydrate dots or charges, so for CuSO4·5H2O type the waters out as CuSO4(H2O)5 or enter the molar mass directly.

How to use it

  1. Choose the molar mass source

    Pick Chemical formula to have the molar mass worked out, or Known molar mass if you have it from a label or data sheet.

  2. Type the formula or molar mass

    Write symbols with correct capitals, for example NaCl, C6H12O6 or Mg(NO3)2, or enter the molar mass in g/mol.

  3. Enter the mass

    Type the sample mass and pick mg, g or kg in the unit menu inside the field.

  4. Read the moles and working

    The amount in mol appears at the top, with molar mass, millimoles, particle count and each step of the sum below.

Examples

18 g of water

Molar mass from
Chemical formula
Chemical formula
H2O
Mass of sample
18
Mass unit
g

Result Amount of substance (mol): 0.9992
Molar mass (g/mol): 18.015
Millimoles (mmol): 999.167
Number of particles: 6.017 × 10^23
Mass in grams: 18

  1. Molar mass of H2O = 2 × 1.008 (H) + 1 × 15.999 (O) = 18.015 g/mol
  2. Moles n = m ÷ M = 18 g ÷ 18.015 g/mol = 0.999167 mol
  3. Particles N = n × 6.02214076 × 10^23 = 6.017 × 10^23

Water's molar mass is 18.015 g/mol, so 18 g is just under one mole — the classic textbook approximation of one mole is slightly generous.

58.44 g of table salt

Molar mass from
Chemical formula
Chemical formula
NaCl
Mass of sample
58.44
Mass unit
g

Result Amount of substance (mol): 1
Molar mass (g/mol): 58.44
Millimoles (mmol): 1,000
Number of particles: 6.022 × 10^23
Mass in grams: 58.44

  1. Molar mass of NaCl = 1 × 22.99 (Na) + 1 × 35.45 (Cl) = 58.44 g/mol
  2. Moles n = m ÷ M = 58.44 g ÷ 58.44 g/mol = 1 mol
  3. Particles N = n × 6.02214076 × 10^23 = 6.022 × 10^23

Sodium 22.990 plus chlorine 35.45 gives 58.44 g/mol, so this mass is one mole of formula units.

10 g at 40 g/mol

Molar mass from
Known molar mass
Molar mass
40
Mass of sample
10
Mass unit
g

Result Amount of substance (mol): 0.25
Molar mass (g/mol): 40
Millimoles (mmol): 250
Number of particles: 1.506 × 10^23
Mass in grams: 10

  1. Molar mass given: 40 g/mol
  2. Moles n = m ÷ M = 10 g ÷ 40 g/mol = 0.25 mol
  3. Particles N = n × 6.02214076 × 10^23 = 1.506 × 10^23

Taking sodium hydroxide as 40 g/mol, 10 g is a quarter of a mole, or 250 mmol.

How it is calculated

n = m ÷ M, M = Σ (atom count × atomic weight), N = n × 6.02214076 × 10^23

n
amount of substance in moles
m
mass of the sample in grams
M
molar mass in g/mol
N
number of molecules or formula units

The molar mass is the sum of each element's conventional atomic weight from IUPAC's Commission on Isotopic Abundances and Atomic Weights, multiplied by how many atoms of it the formula contains; a bracket count multiplies everything inside. Dividing the mass in grams by that molar mass gives moles. Multiplying moles by the Avogadro constant, fixed exactly in the 2019 SI redefinition, gives the particle count.

When not to use it

  • For gases measured by volume, use the ideal gas law rather than a mass.
  • For a solution of known concentration, multiply molarity by volume instead.
  • For isotopically labelled compounds, enter the exact molar mass yourself.

Common mistakes

  • Typing co or CO when cobalt (Co) was meant changes the substance entirely.
  • Forgetting the bracket count, so Ca(OH)2 becomes CaOH2 with the wrong mass.
  • Leaving the mass in milligrams while the unit menu still says grams.
  • Ignoring water of crystallisation in a hydrated salt from the bottle.

Frequently asked questions

What formula converts grams to moles?

Divide mass by molar mass: n = m ÷ M. With m in grams and M in grams per mole, the grams cancel and moles remain. For 10 g of sodium hydroxide at 40 g/mol that is 0.25 mol.

Where do the atomic weights come from?

They are the conventional standard atomic weights published by IUPAC's CIAAW, for example 1.008 for hydrogen, 12.011 for carbon and 15.999 for oxygen. These reflect natural isotope mixtures, which is why they are not whole numbers.

How do I enter a hydrate like copper sulfate pentahydrate?

The parser does not read the centred dot, so write the water as a bracketed group: CuSO4(H2O)5. That adds five waters to the copper sulfate and gives a molar mass near 249.68 g/mol.

Why does 18 g of water not give exactly one mole?

Water's molar mass is 18.015 g/mol, not 18. The extra 0.015 g/mol comes from hydrogen being 1.008 and oxygen 15.999, so 18 g is 0.9992 mol. Many textbooks round to 18 for simplicity.

What does the particle count mean for an ionic compound?

For salts such as NaCl there are no discrete molecules, so the count is of formula units. One formula unit of NaCl holds one sodium ion and one chloride ion, so the ion count is twice the figure shown.

Can I convert moles back to grams with this page?

Not directly; this page goes from mass to amount. Multiply moles by the molar mass shown in the results to get grams, or use the moles to grams calculator in the same section.

Does capitalisation in the formula matter?

Yes. Each symbol starts with a capital and any second letter is lower case. CO is carbon plus oxygen at 28.010 g/mol, while Co is cobalt at 58.933 g/mol.

Cite this tool

Using this tool in an assignment, article or report? Copy a citation, or a link for your website.

APA

Tools Directory Editorial Team. (2026, October 23). Grams to Moles. Tools Directory. Retrieved October 27, 2026, from https://tools.milunir.com/chemistry/stoichiometry-and-reactions/grams-to-moles/

MLA

Tools Directory Editorial Team. “Grams to Moles.” Tools Directory, 23 Oct. 2026, https://tools.milunir.com/chemistry/stoichiometry-and-reactions/grams-to-moles/. Accessed 27 Oct. 2026.

Chicago

Tools Directory Editorial Team. “Grams to Moles.” Tools Directory. Last modified October 23, 2026. Accessed October 27, 2026. https://tools.milunir.com/chemistry/stoichiometry-and-reactions/grams-to-moles/.

Link<a href="https://tools.milunir.com/chemistry/stoichiometry-and-reactions/grams-to-moles/">Grams to Moles – Tools Directory</a>