More options
25 g of NaCl is 0.428 mol (molar mass 58.44 g/mol)
0.428 mol
Moles
428 mmol
Millimoles
428,000 µmol
Micromoles
58.44 g/mol
Molar mass
from the formula
2.58 × 1023
Particles
formula units, molecules or atoms
25 g
Mass used
Molar mass breakdown
ElementCountAtomic wtg/molMass %
Na Sodium122.9897722.9897739.34
Cl Chlorine135.4535.4560.66
Total258.43977100
Atomic weights are CIAAW 2024 conventional values. Cl (interval elements) vary slightly with the sample source, so the last digit can differ from your textbook.
Show the math
Molar massM = 1 × 22.989769 (Na) + 1 × 35.45 (Cl) = 58.43977 g/mol
Molesn = m / M = 25 g / 58.43977 g/mol = 0.428 mol
Unit checkg / (g/mol) = mol
ParticlesN = n × NA = 0.4277909 mol × 6.02214076×1023 /mol = 2.58 × 1023

Short answer: Divide the mass in grams by the molar mass in g/mol: n = m / M. 25 g of NaCl is 0.428 mol (molar mass 58.44 g/mol). To go the other way, multiply moles by the molar mass: m = n × M.

A mole is 6.022 × 10²³ particles of a substance, and the molar mass is the mass of one mole. Most wrong answers come from a wrong molar mass: a hydrate with its water left out, a bracket that was not multiplied through, or a lowercase letter that turned one element into another. This page covers both directions, with worked examples and a table of common compounds.

0.428 mol
Moles
In 25 g of NaCl.
58.44 g/mol
Molar mass
Sum of the atomic weights in the formula.
427.8 mmol
Millimoles
The same amount, times 1000.
2.58 × 10²³
Particles
Formula units in the sample.

This article contains Amazon affiliate links. 33science earns a commission on qualifying purchases. See our affiliate disclosure.

How to use the grams to moles converter

Pick the direction.
Grams to moles is the default. Switch to moles to grams when you know the amount and need the mass.
Enter the formula.
Type it with correct capitals, such as NaCl, Ca(OH)2 or CuSO4·5H2O, or tap a common compound. If you already know the molar mass, enter it in g/mol instead and the formula is ignored.
Enter the mass or the amount.
Choose mg, g or kg for the mass, and mol or mmol for the amount. The converter changes units for you.
Read the result.
You get moles, the molar mass with a per-element breakdown, the particle count and the working. Set the significant figures to match your problem, then copy or print the steps.

Grams to moles formula

The formula is n = m / M. Here n is the amount in moles, m is the mass in grams and M is the molar mass in g/mol. The molar mass is the sum of the atomic weights of every atom in the formula, and its number in g/mol equals the relative molar mass (IUPAC). Atomic weights come from the CIAAW table.

Rearranged, m = n × M gives the mass. To count particles, multiply moles by the Avogadro constant, N = n × NA, where NA = 6.02214076 × 10²³ per mole, an exact value since the 2019 SI redefinition (BIPM). Large counts like these are easier to read with the scientific notation calculator.

Gloved hand tipping white salt crystals into a weighing boat on a digital lab balance
Weigh in grams first. Convert mg or kg to grams before dividing by the molar mass.

How to convert grams to moles, step by step

Example: how many moles are in 25 g of NaCl?

Write the formula.
Sodium chloride is NaCl: one Na atom and one Cl atom per formula unit.
Find the molar mass.
Add the atomic weights: 22.989769 + 35.45 = 58.43977, which rounds to 58.44 g/mol.
Check the unit.
The mass is already in grams. For mg, divide by 1000. For kg, multiply by 1000.
Divide.
n = 25 g / 58.44 g/mol = 0.4278 mol, or 0.428 mol (427.8 mmol).
Student working a grams to moles problem by hand in a notebook next to a scientific calculator
Keep the units in every line of the working. The grams cancel and leave moles.

Any scientific calculator handles this, and you can check the working against the converter.

Moles to grams

Multiply the amount by the molar mass: m = n × M. For 0.5 mol of NaCl, m = 0.5 mol × 58.44 g/mol = 29.22 g, or 29.2 g (29,220 mg). That sample holds 3.01 × 10²³ formula units. The same rule gives 29.1 g for 0.56 mol of chromium, a standard textbook case (LibreTexts).

Key point
Grams to moles divides by M. Moles to grams multiplies by M. For any compound heavier than 1 g/mol, the number of moles is smaller than the number of grams.

Worked examples: water, a hydrate and brackets

How many moles are in 100 g of water?

The molar mass of H2O is 2 × 1.008 + 15.999 = 18.015 g/mol. Then n = 100 g / 18.015 g/mol = 5.55 mol. For the molecule count, 5.551 mol × 6.022 × 10²³ per mole = 3.343 × 10²⁴ molecules. The page for the molar mass of water lists the element breakdown.

A hydrate: CuSO4·5H2O

A hydrate carries water in its crystal, and that water counts toward the mass. CuSO4·5H2O is 159.602 g/mol for CuSO4 plus 90.075 g/mol for five H2O, a total of 249.677 g/mol. For 10 g: n = 10 g / 249.68 g/mol = 0.0401 mol of the hydrate, which contains 0.2 mol of water. Water makes up 36.1% of the mass.

Blue copper(II) sulfate pentahydrate crystals
Blue copper(II) sulfate crystals keep five water molecules per formula unit. Photo by Kunal Kalra on Unsplash

Using the anhydrous mass (159.6 g/mol) on a weighed hydrate gives 0.0627 mol, which is too high. Match the formula to what was on the balance. Page for the molar mass of copper(II) sulfate pentahydrate.

Brackets: Ca(OH)2

The subscript after a bracket multiplies every atom inside it, so Ca(OH)2 holds 1 Ca, 2 O and 2 H. Its molar mass is 74.092 g/mol. For 7.4 g, n = 7.4 g / 74.092 g/mol = 0.0999 mol. Nested brackets work the same way, from the inside out.

Molar mass and moles of common compounds

Moles in 1 g is 1 / M, so the moles in any other mass scale from these columns. Each name links to its molar mass page.

CompoundFormulaMolar mass (g/mol)Moles in 1 gMoles in 100 g
WaterH2O18.0150.055515.551
Sodium chlorideNaCl58.440.017111.711
GlucoseC6H12O6180.160.0055510.5551
SucroseC12H22O11342.30.0029210.2921
Carbon dioxideCO244.0090.022722.272
Sodium hydroxideNaOH39.9970.0252.5
Sodium bicarbonateNaHCO384.0060.01191.19
Calcium carbonateCaCO3100.090.0099910.9991
Sulfuric acidH2SO498.0720.01021.02
Hydrogen chlorideHCl36.4580.027432.743
AmmoniaNH317.0310.058725.872
EthanolC2H5OH46.0690.021712.171
Potassium permanganateKMnO4158.030.0063280.6328
Copper(II) sulfate pentahydrateCuSO4·5H2O249.680.0040050.4005

Other compounds with their own pages: hydrogen peroxide, acetic acid, nitric acid, aspirin, caffeine. For any formula not listed, use the molar mass calculator.

Why your answer differs from the textbook in the last digit

Textbooks round atomic weights to two decimals, such as Na 22.99, Cl 35.45 and Cu 63.55. The converter uses the full CIAAW conventional values. The molar mass changes by less than 0.1% for the compounds in the table above, and it does not change for NaCl to four digits. A difference in the third or fourth significant figure comes from this rounding, not from a wrong method. Another source is rounding the molar mass before dividing: keep extra digits until the last step.

Report the result to the precision of your least precise input. A mass given as 25 g has two significant figures, and the significant figures calculator shows how to round it. Some elements, such as carbon, hydrogen and oxygen, have atomic weights that vary slightly with the sample source, which is one more reason not to read past the fourth digit.

Common mistakes

Do
Type element symbols with the right capitals: Co is cobalt, CO is carbon monoxide
Include the water of hydration when the sample is a hydrate
Convert mg to g before dividing, or enter the unit in the converter
Keep the unit in every line so grams cancel
Avoid
Type NACL or nacl and expect NaCl
Use the anhydrous molar mass for a hydrated sample
Divide 250 mg by the molar mass as if it were 250 g
Round the molar mass early and carry the error forward

The mg versus g slip is the most expensive: 1.39 mmol of glucose is 250 mg, but entering 250 as grams gives a thousand times too much. In mol that sample is 0.00139 mol. Small samples are easier to get right on a digital scale that reads to 0.01 g, and the converter shows the moles and millimoles side by side.

For ions, use the formula of the ion or its salt. The electron mass is too small to change the result, so Na+ and Na have the same molar mass at this precision. For the full method behind concentration problems, see the guide to calculating molarity, and to prepare a weaker solution, use the dilution calculator.

Sources

Frequently asked questions

How do I calculate the molar mass?

Add the atomic weight of every atom in the formula, counting each atom as many times as its subscript says. For NaCl, 22.989769 + 35.45 gives 58.44 g/mol.

Is molar mass the same as molecular weight?

They have the same number but different units. Molar mass is in g/mol, while molecular weight, or relative molecular mass, has no unit. Ionic compounds such as NaCl use the term formula mass.

Can I enter hydrates, brackets, or subscripts?

Yes. Write the formula with plain digits for subscripts, such as Ca(OH)2 or CuSO4·5H2O. A dot or an asterisk also separates the water of hydration, and nested brackets are read from the inside out.

Why does the formula need capital letters?

Capitals mark where each element symbol starts, so Co is cobalt and CO is carbon monoxide. An element written in the wrong case is read as a different element or rejected as unknown.

What if my sample is a mixture or an impure chemical?

Multiply the sample mass by the purity as a fraction first, then convert the pure mass to moles. A 98 percent pure sample of 10 g holds 9.8 g of the compound.

What is the difference between moles, molecules and formula units?

A mole is a count of 6.022 x 10^23 of any particle. Molecules are the particles of covalent compounds, formula units are the smallest repeating ratio in ionic compounds, and atoms are the particles of elements.

For a hydrate, are moles of hydrate the same as moles of the anhydrous salt?

Yes, one mole of hydrate holds one mole of the anhydrous salt plus the water. The mass is different, so use the hydrate molar mass when you weigh the hydrate.

Do I need the chemical formula?

No. If you know the molar mass in g/mol, enter it as an override and the formula is not needed. The formula is only used to calculate the molar mass.