How to convert grams to molecules
Divide mass by molar mass to find moles, then multiply by the Avogadro constant. The first step is the same grams to moles conversion used on the main calculator.
Moles = mass (g) ÷ molar mass (g/mol)
Entity count = moles × 6.02214076 × 10²³
The BIPM definition of the mole fixes the number of specified entities in one mole. “Specified” matters: a mole of water molecules and a mole of hydrogen atoms count different things.
Worked example: water molecules
Using a water molar mass of 18.015 g/mol, a sample containing 18.015 g of H₂O corresponds to 1 mol of water molecules:
- 18.015 g ÷ 18.015 g/mol = 1 mol.
- 1 mol × 6.02214076 × 10²³ entities/mol = 6.02214076 × 10²³ molecules.
The tool displays approximately 6.02214e+23 molecules at six significant figures. The “e+23” notation means “times ten to the power of 23.” This keeps large counts readable on a small screen.
Molecules, formula units and atoms
| Material | Count | Why |
|---|---|---|
| Water, H₂O | Molecules | Each molecule contains two H atoms and one O atom. |
| Sodium chloride solid, NaCl | Formula units | The formula expresses the ratio of ions in the solid. |
| Elemental iron, Fe | Atoms | The element symbol represents one iron atom. |
As OpenStax explains for ionic solids, an NaCl formula does not describe a separate molecule inside the crystal. The arithmetic still uses moles times the Avogadro constant, but the correct entity name is “formula units.”
The formula parser counts element symbols and subscripts; it does not determine a substance's bonding or physical state. Choose the entity type from the identity of your actual material. In atom mode, a parsed formula must represent a single atom, such as Fe rather than Fe₂O₃.
Counting atoms inside a molecule is a second step
A water molecule contains three atoms in total. If you need hydrogen atoms, multiply the number of water molecules by two. If you need all atoms, multiply it by three. Do not call a water molecule a single atom or use the molar mass of elemental hydrogen for a weighed water sample.
For an ionic material, the formula's subscripts similarly describe the ratio represented by each formula unit. This tool does not predict ions after dissolution, reactions or equilibrium composition.
Use the right formula and mass
A hydrate such as CuSO4·5H2O includes water in the weighed formula. Omitting the hydrate water changes the molar mass and therefore the count. An empirical formula also may not be the molecular formula: CH₂O and C₆H₁₂O₆ describe different-sized counted entities.
Enter the mass of the named substance. A mixture or an impure sample cannot be assigned one molecular count without knowing its composition. A known molar mass can be used for an isotope-specific material; it must match the entity you are counting.
Formula masses use the CIAAW 2024 abridged atomic weights. These central values are approximate and their uncertainties are not propagated. The result is an estimate from the supplied mass, not a measurement of individual particles.
Sources and corrections
BIPM: mole definition; CIAAW: abridged standard atomic weights; OpenStax: ionic bonding.
Reviewed September 15, 2026. For a correction, send the formula and inputs to contact@gramstomoles.org.