Skip to main content
Mathovia

Science / Chemistry

Grams to Moles Calculator

Select a compound or element to auto-fill its molar mass, or enter a custom value. Works both ways: grams to moles and moles to grams.

Molar Mass Used
1.000 g/mol
Moles (from grams)
500.000000 mol
Mass (from moles)
1.0000 g
Molecules / Atoms
3.0111e+26
002502505005007507501,0001,000gmol500 g500 mol
Grams divided by the molar mass give moles — the slope is 1 over the molar mass.

Priority: Custom Molar Mass > Compound > Element. The first non-zero value is used as the molar mass for calculations.

Written by
MPhil in Mathematics, Founder of Mathovia
Updated

Mathematics verification: Mathematical formulas, calculations, worked examples and solutions are reviewed for accuracy before publication. How we check our work

Grams to Moles Calculator formula
The Grams to Moles formula

The most-used conversion in chemistry

Weigh a substance and you get grams. Write a reaction and it speaks in moles. Bridging those two is the single most frequent calculation in a chemistry lab — it comes before every stoichiometry problem, every solution you prepare, and every yield you check. The bridge is the molar mass, and the arithmetic is one division.

This calculator carries the molar masses so you don’t have to add them by hand. It has all 118 elements at their 2021 IUPAC atomic weights and 176 common compounds — acids, bases, salts, solvents, sugars — with formula weights computed from their formulas. Choosing your substance from a list removes the mistake that trips people up most: a molar mass that’s off by a hydrogen or a factor of two.

The grams to moles formula

is moles, is mass in grams, is molar mass in g/mol. Reversed, mass is , and the particle count is .

The calculator resolves the molar mass in priority order: a non-zero Custom Molar Mass first, then the Compound selection, then the Element selection. Pick a compound and an element together and the compound wins.

Worked example

Select Sodium chloride [NaCl] (molar mass 58.44 g/mol) and enter 500 g.

As a particle count:

Running it in reverse, 1 mol of NaCl is .

Grams to moles for common lab chemicals

SubstanceMolar mass (g/mol)500 g is1 mol weighs
Sodium chloride (NaCl)58.448.556 mol58.44 g
Sodium hydroxide (NaOH)40.0012.50 mol40.00 g
Glucose (C₆H₁₂O₆)180.162.775 mol180.16 g
Sulfuric acid (H₂SO₄)98.075.098 mol98.07 g
Silver [Ag]107.8684.635 mol107.87 g
Calcium carbonate (CaCO₃)100.094.996 mol100.09 g

Where it’s used

  • Reaction stoichiometry — grams of reactant to moles, apply the equation ratio, moles of product back to grams.
  • Solution preparation — a target molarity and volume become moles, then grams to weigh out.
  • Percent yield — moles of product obtained versus moles predicted.
  • Elemental analysis — grams of each element in a sample to moles, then to the empirical formula ratio.

Common mistakes

  • Diatomic elements. O₂, N₂, H₂, Cl₂ have molar masses twice the atomic weight.
  • Hydrates. Use the hydrate’s molar mass (with the waters) if that’s what you weighed.
  • Wrong parentheses handling — Mg(OH)₂ has two oxygens and two hydrogens.
  • Rounding molar mass early in a multi-step calculation.

For the molar-mass side alone, see the molar mass calculator. For solution concentration, the molarity calculator; for particle counts, atoms to moles.

Finding an empirical formula from grams

Convert each element’s mass to moles, then divide by the smallest. A compound contains 40.0 g carbon, 6.71 g hydrogen and 53.3 g oxygen:

ElementGramsMolesDivide by smallest
C40.01.00
H6.712.00
O53.31.00

The ratio is 1 : 2 : 1, so the empirical formula is CH₂O. Glucose, C₆H₁₂O₆, has exactly this ratio.

Allowing for purity

Reagents aren’t always 100% pure. If a 5.00 g sample is 92% sodium chloride, only the pure part counts:

Entering the full 5.00 g would overstate the moles by about 9%.

About the formula: Priority: Custom Molar Mass > Compound > Element. The first non-zero value is used as the molar mass for calculations.

Frequently Asked Questions

How do I convert grams to moles?+

Divide the mass in grams by the substance's molar mass in g/mol. 500 g of NaCl (58.44 g/mol) is 500 ÷ 58.44 ≈ 8.556 mol.

How do I use this calculator?+

Pick a compound or element from the dropdown and its molar mass fills in automatically, then enter grams to get moles — or enter moles to get grams back. Type a value in the Custom Molar Mass field for anything not listed.

What if I select both a compound and an element?+

Compound wins. The order of priority is Custom Molar Mass, then Compound, then Element — the first non-zero one is used. Reset the compound to [Select Compound] to fall through to the element.

Where do the molar mass values come from?+

Elements use the 2021 IUPAC standard atomic weights; compounds are computed from their molecular formulas. Using the built-in value removes the most common error in these problems — a mis-added molar mass.

How do I convert moles back to grams?+

Enter your mole amount in the Moles field; the Mass (from moles) result shows the equivalent grams at the same molar mass. It's mass = moles × molar mass.

My compound isn't in the list. What do I do?+

Use Custom Molar Mass. Sum the atomic masses for every atom in the formula, counting subscripts and parenthesis multipliers, and enter that number. It overrides both dropdowns while it's non-zero.

Related calculators