Convert atoms to grams or grams to atoms: enter an atom count or a mass and pick an element, or use a custom molar mass for molecules.

Element presets count individual atoms, including H and O rather than H₂ or O₂.

Scientific notation is accepted, for example 6.02214076e23.

Result unit and display

Leave empty for one sample; scales the entered mass or count for identical samples.

Calculator Functions

FunctionWhat it doesWhat it requires
Mass from atomsConverts a number of atoms of an element to gramsRequires the number of atoms and an element chosen from the list
Atoms from massConverts a mass of an element to the number of atoms in itRequires the sample mass and an element chosen from the list
Mass from entitiesConverts a count of molecules, formula units or atoms to grams for any substanceRequires the count, the molar mass in g/mol and the entity type
Entities from massConverts a mass of any substance to its number of molecules, formula units or atomsRequires the sample mass, the molar mass in g/mol and the entity type
Molar massFinds the molar mass of a substance from one sampleRequires the sample mass and the number of entities in that same sample

The element list holds 21 elements from hydrogen to uranium, each with its molar mass. Counts accept scientific notation such as 6.02214076e23, and masses go in as g, mg, kg or µg. Optional settings choose the mass unit of the result, show 3, 5 or 7 significant digits, and multiply the entry for several identical samples. Every result also lists the amount in moles and the mass of a single atom or entity.

Atoms to Grams Formulas

m = N × M ÷ NA
mMass of the sample (g)
NNumber of atoms, molecules or formula units
MMolar mass of that atom, molecule or formula unit (g/mol)
NAAvogadro constant, exactly 6.02214076 × 10²³ per mole [1]

The conversion runs through moles. Dividing the count by the Avogadro constant gives the amount in moles, and multiplying moles by the molar mass gives grams. For a single element the molar mass in g/mol has the same number as its standard atomic weight, and the element list uses the abridged values published by the IUPAC atomic weights commission, such as 12.011 for carbon and 15.999 for oxygen [2].

Mass from atoms

The main formula applies with the molar mass of the chosen element. For 2.48 × 10²³ atoms of magnesium, m = 2.48 × 10²³ × 24.305 ÷ (6.02214076 × 10²³) = 10.0 g. One mole of carbon atoms, 6.02214076 × 10²³ of them, has a mass of 12.011 g.

Atoms from mass

N = m × NA ÷ M

A 9.45 g piece of gold holds 9.45 × 6.02214076 × 10²³ ÷ 196.96657 = 2.89 × 10²² atoms. The element list counts single atoms, so hydrogen and oxygen are H and O, not H₂ and O₂ molecules.

Mass from entities

This is the main formula with a molar mass typed in, which covers compounds and any element missing from the list. For 1.204 × 10²⁴ molecules of water at 18.015 g/mol, m = 1.204 × 10²⁴ × 18.015 ÷ (6.02214076 × 10²³) = 36.0 g.

Entities from mass

The formula is N = m × NA ÷ M with a typed molar mass. A 10 g sample of sodium chloride at 58.44 g/mol contains 10 × 6.02214076 × 10²³ ÷ 58.44 = 1.03 × 10²³ formula units. With a compound's molar mass the answer counts whole molecules or formula units, not the atoms inside them: each NaCl unit holds 2 atoms, so that sample has twice as many atoms.

Molar mass

M = m × NA ÷ N

A 4.0 g sample that contains 1.204 × 10²³ atoms has a molar mass of 4.0 × 6.02214076 × 10²³ ÷ (1.204 × 10²³) = 20.0 g/mol. Both the mass and the count must be above zero and must describe the same sample.

Limits of This Estimate

  • The element values are standard atomic weights for normal terrestrial material, rounded to about five significant figures. Some carry a wider spread, such as lead at 207.2 ± 1.1 [2], and an isotopically enriched sample needs its own molar mass.
  • The Avogadro constant is exact, so the precision of a result is set by the molar mass and by the digits in the entered count or mass.
  • A count of molecules or formula units is not a count of atoms. Multiply by the number of atoms in the formula to get total atoms.

Sources

  1. NIST, CODATA Value: Avogadro constant: the exact value 6.02214076 × 10²³ per mole
  2. IUPAC Commission on Isotopic Abundances and Atomic Weights, Abridged Standard Atomic Weights 2024: atomic weights of the listed elements and their uncertainties