HomeChemistry › Moles to Grams Calculator

Moles to Grams Calculator

Converts between mass in grams and amount in moles using the molar mass (from a formula or given directly), and reports the number of molecules or formula units from the Avogadro constant. Any two of molar mass, mass and moles give the third.

When to use

You need to convert grams to moles or moles to grams for a substance, count the molecules in a sample, or back out a molar mass from a measured mass and amount.

Do not use when: You only need the molar mass of a formula (use molar-mass), or you want a concentration in mol/L (use molarity).

Formula

moles = mass_g / molar_mass_g_mol; mass_g = moles × molar_mass_g_mol; molecules = moles × N_A (N_A = 6.02214076×10²³ mol⁻¹)

Inputs

ParameterTypeUnitRequiredDescription
formulastringnoChemical formula, e.g. NaCl, C6H12O6, Ca(OH)2 or CuSO4·5H2O (case-sensitive element symbols). Alternative to molar_mass_g_mol.
molar_mass_g_molnumberg/molnoMolar mass of the substance; use instead of formula when it is already known. Range: > 0, ≤ 10000000
mass_gnumbergnoMass of the sample in grams. Leave empty to solve for it. Range: > 0
molesnumbermolnoAmount in moles. Leave empty to solve for it. Range: > 0

Outputs

OutputTypeUnitDescription
molar_mass_g_molnumberg/molMolar mass used or derived (mass_g / moles).
mass_gnumbergMass of the sample.
molesnumbermolAmount of substance.
millimolesnumbermmolAmount in millimoles.
moleculesnumbermoles × 6.02214076×10²³ (molecules for molecular substances, formula units for ionic compounds, atoms for elements).
molecules_scientificstringThe same count in scientific notation.
solved_forstringWhich quantity was computed: mass_g, moles or molar_mass_g_mol.

Example

36.03 g of water: {"formula":"H2O","mass_g":36.03}{"molar_mass_g_mol":18.015,"moles":2,"millimoles":2000,"molecules":1.204428152e+24,"solved_for":"moles"}

0.5 mol of CO2: {"formula":"CO2","moles":0.5}{"molar_mass_g_mol":44.009,"mass_g":22.0045,"molecules":3.01107038e+23,"solved_for":"mass_g"}

GET https://tttkmbb.com/api/v1/calculate/moles-mass?formula=H2O&mass_g=36.03

Machine access

Sources

FAQ

How do I get the molar mass without a formula?

Give molar_mass_g_mol directly, or give both mass_g and moles and the calculator returns molar_mass_g_mol = mass_g / moles (useful for identifying an unknown).

Does 'molecules' apply to ionic compounds?

For NaCl or CaCO3 the count is formula units rather than discrete molecules; for a monatomic element it is the number of atoms.

Related calculators