Molarity Calculator
Calculate molarity from grams and volume, or the grams of any solute (with brackets and hydrates) needed to make a solution of a target molarity.
Enter the solute and solution
Show the Larzscript program that just ran
Run a calculation to see the exact program.
This is the real program the page sent to the Larzscript interpreter (compiled to WebAssembly) in your browser. The library it imports is the same code the automated tests check.
The formulas
Worked examples, computed above
- Molarity from grams: 4.0 g NaOH in 0.1 L → 0.1 mol → 1 M.
- Grams for a target: 0.15 M NaCl, 1 L → 8.766 g.
- Glucose: 90 g in 500 mL is 0.9991 M (180.0000 g/L); a fresh 0.5 L batch at the 0.1 M target needs 9.008 g.
- One mole: 36.46 g of HCl in 1 L is 1 M.
What is verified
Molar masses come from the formula parser that is compared against an independent parser on 67 formulas; the molarity relations are exact rearrangements, checked to 15 digits, and round trips (grams → molarity → grams) must return the input.
Limits: ideal behaviour and standard atomic weights. Concentrated commercial reagents are quoted as mass percent and density — convert with the mass-percent and density on the label. Hydrates: enter the full formula (CuSO4.5H2O).
Frequently asked questions
What is molarity?
Moles of solute per litre of solution, written M or mol/L: M = n / V. A 1 M solution holds one mole of solute in each litre.
How do I calculate molarity from grams?
Convert the mass to moles with the molar mass, then divide by the volume in litres. 4.0 g of NaOH (40.00 g/mol) in 100 mL: 4.0 ÷ 39.9968 = 0.1 mol ÷ 0.1 L = 1 M.
How many grams do I need to make a solution of a given molarity?
grams = M × V × molar mass. For 1 L of 0.15 M NaCl (normal-saline strength) you need 8.766 g. The last panel of the calculator gives this for any formula.
Is the volume the solvent volume or the solution volume?
The final solution volume. Dissolve the solute in less water, then add water up to the mark in a volumetric flask; adding solute to exactly 1 L of water gives a slightly larger volume and a slightly weaker solution.
What is the difference between molarity and molality?
Molarity is per litre of solution and changes with temperature because volumes expand; molality is per kilogram of solvent and does not. Use molality for freezing-point and boiling-point calculations.
How do I dilute a solution?
Use C₁V₁ = C₂V₂ — the dilution calculator solves for any of the four quantities.
Every number on this page is computed by the open-source larzscript-chem library (chemistry, elements, physconst, physmath), written in Larzscript, and checked against independent references in its test suite. How it is verified →