Grams to moles calculator
Type a formula and an amount, get moles, grams and molecules.
How do I convert grams to moles?
Divide the mass by the molar mass: 18.015 g of water (H₂O, 18.015 g/mol) is exactly 1 mole.
How do I convert moles to grams?
Multiply by the molar mass: 2 moles of sodium chloride (58.44 g/mol) is 116.88 g.
How many molecules are in a mole?
Avogadro's number: exactly 6.02214076 × 10²³, fixed by the SI definition of the mole since 2019.
Where does the molar mass come from?
From the formula and the IUPAC atomic weights — the calculator works it out as you type, like the molar mass calculator.
Can I use it for elements?
Yes — type a symbol like Fe or Au: 55.845 g of iron is 1 mole of iron atoms.
What is the difference between molar mass, molecular mass and formula mass?
They are numerically equal but carry different units (OpenStax Chemistry 2e, section 3.1). Molecular mass or formula mass is the mass of one molecule or formula unit in atomic mass units (amu); molar mass is the mass of one mole in g/mol. Carbon-12 weighs exactly 12 amu per atom and 12 g per mole. “Formula mass” is the right term for ionic compounds such as NaCl, which have no discrete molecules.
How do I count atoms of one element in a sample?
Convert to moles of the compound, multiply by Avogadro’s number, then by the number of atoms of that element in the formula. One mole of aspirin, C₉H₈O₄, contains 5.42 × 10²⁴ carbon atoms, nine times Avogadro’s number. The calculator’s “particles” line counts molecules or formula units, so scale it by the subscript yourself.
How do I get moles of a gas or of a solution?
Mass is not always what you have. For a solution, moles = molarity × liters (molarity calculator); for a gas, use the ideal gas law n = PV ÷ RT (ideal gas law calculator). Both give the moles you would otherwise get from grams.
The conversions and where the numbers come from
The mole counts particles the way a dozen counts eggs; one mole is exactly 6.02214076 × 10²³ of them, Avogadro’s number, fixed by the SI definition (OpenStax Chemistry 2e, section 3.1). Mass to moles is a division, moles = grams ÷ molar mass, and moles to mass is the multiplication, grams = moles × molar mass. Particles are moles × Avogadro’s number. The molar mass of a formula is the sum of the average atomic masses of every atom in it, so the calculator parses the formula, including parentheses and subscripts, and adds up the IUPAC standard atomic weights. Those weights are averages over the natural mix of isotopes, which is why chlorine is 35.45 and not a whole number. OpenStax rounds atomic masses a little differently, so a last digit may differ from a textbook answer.
Worked examples
Mass to moles (OpenStax Example 3.6): 28.35 g of glycine, C₂H₅O₂N, whose molar mass is 75.067 g/mol, is 28.35 ÷ 75.067 = 0.3777 mol; the book, which rounds the molar mass to 75.07 g/mol, prints 0.3776. Moles to mass (Example 3.7): 1.42 × 10⁻⁴ mol of vitamin C, C₆H₈O₆ (molar mass 176.124 g/mol), weighs 0.0250 g. Mass to atoms (Example 3.5): 5.00 g of copper is 0.0787 mol, and multiplying by Avogadro’s number gives 4.74 × 10²² atoms.
Common mistakes
The commonest error is using the wrong molar mass: reading the atomic number instead of the atomic weight, leaving out a subscript, or forgetting that a parenthesis multiplies everything inside it, as in Al₂(SO₄)₃. Check that the formula matches the substance you weighed, hydrates included. Unit slips come next. The mass field is in grams, so 5 mg must be entered as 0.005; typing 5 for 5 mg of sodium chloride gives 0.086 mol, a thousand times too many. Finally, a mole of molecules is not a mole of atoms: a mole of water, H₂O, holds two moles of hydrogen atoms and one of oxygen atoms.
Sources: OpenStax Chemistry 2e, section 3.1 “Formula Mass and the Mole Concept” (mole, Avogadro’s number, molar mass, Examples 3.5 to 3.7); IUPAC standard atomic weights (CIAAW) for the weights used. Related: molarity calculator, empirical formula calculator, stoichiometry calculator and ideal gas law calculator.