How to calculate molarity from grams
First divide the solute mass by its molar mass to find the number of moles. Then divide those moles by the final solution volume in liters. This is the next step after a grams to moles conversion.
Moles = mass (g) ÷ molar mass (g/mol)
Molarity (mol/L) = moles ÷ solution volume (L)
Molarity is often written as M. For example, 0.2 M means 0.2 mol/L. The term describes amount of substance per volume of the mixture, as defined in the IUPAC Gold Book. Here, “molar mass” is always labeled g/mol so it is easy to distinguish from molarity.
Worked example: sodium chloride
Suppose a sample contains 5.844 g of NaCl and its final solution volume is 500 mL. The molar mass of NaCl using the calculator's atomic weights is 58.44 g/mol.
- Find moles: 5.844 g ÷ 58.44 g/mol = 0.1000 mol.
- Convert volume: 500 mL ÷ 1,000 = 0.500 L.
- Divide: 0.1000 mol ÷ 0.500 L = 0.2000 mol/L.
The same concentration is 200 mmol/L, commonly written 200 mM. This example demonstrates arithmetic; choose significant figures that reflect the measurements in your own problem.
The volume must be the final solution volume
The denominator represents the complete solution. Entering 500 mL means the solution occupies 500 mL after the solute is dissolved. If all you know is how much water or another solvent you started with, you still need the resulting solution volume.
This tool does not infer a final volume from the volume of solvent, nor does it assume that separate volumes add perfectly. Use a measured volume or the final volume specified in your problem.
Choose the formula of the material you have
Hydrates include water in their chemical formula. CuSO4 and CuSO4·5H2O therefore have different molar masses. Using the anhydrous formula for a weighed hydrate gives the wrong number of moles.
The formula parser uses central values from the CIAAW 2024 abridged standard atomic weights. Natural isotope composition can vary, and atomic-weight uncertainties are not propagated. Use a known molar mass for an isotope-specific material or when your exercise supplies its own value.
If the weighed sample is impure, enter the mass of the specified solute itself. For example, a 10 g sample that is 90% solute by mass contains 9 g of that solute. The calculator does not identify impurities or predict how much material can dissolve.
Common unit checks
- Milliliters and liters: 1,000 mL = 1 L. The tool converts the volume before dividing.
- M and mM: 1 mol/L = 1,000 mmol/L. Uppercase M and lowercase m in mM have different meanings.
- Molarity and molality: molarity uses solution volume; molality uses solvent mass. They are different quantities.
- Solute and ions: the result describes moles of the formula you enter per liter. It does not calculate equilibrium concentrations of individual ions.
Only need mass and moles? Open the main calculator →
Sources and corrections
IUPAC: amount-of-substance concentration defines the amount-to-volume relationship. CIAAW's abridged table supplies the formula weights. BIPM's SI prefixes supplies the unit factors.
Reviewed September 14, 2026. Found an issue? Send the formula, inputs, and expected result to contact@gramstomoles.org.