Calculate the molarity of a solution based on mass, molar mass, and volume.
Milliliters (mL)
Liters (L)
Calculated Concentration:
What is Molar Concentration?
Molar concentration, or molarity (M), is a measure of the concentration of a chemical species, in particular of a solute in a solution, in terms of the amount of substance per unit volume of solution. In chemistry, the most commonly used unit for molarity is the number of moles per liter, having the unit symbol mol/L or M.
The Molarity Formula
The standard formula used by this calculator to determine molar concentration is:
M = m / (MW × V)
M = Molarity (mol/L)
m = Mass of the solute (grams)
MW = Molar mass / Molecular weight of the solute (g/mol)
V = Volume of the solution (Liters)
Practical Example: Making a Saline Solution
If you want to create a solution using Sodium Chloride (NaCl):
Variable
Value
Mass of NaCl (m)
5.84 grams
Molar Mass of NaCl (MW)
58.44 g/mol
Volume of water (V)
0.5 Liters (500 mL)
Calculation
5.84 / (58.44 × 0.5) = 0.2 M
Step-by-Step Calculation Guide
Identify the solute: Determine the chemical formula of the substance you are dissolving.
Find the molar mass: Look up the atomic weights on the periodic table for each element in the solute and sum them up.
Measure the mass: Use a precision scale to measure the mass of the solute in grams.
Determine the final volume: Measure the total volume of the solution after the solute has been dissolved.
Input into the calculator: Enter these values into the fields above to get the precise molarity.
Common Molar Masses for Reference
Glucose (C6H12O6): 180.16 g/mol
Sodium Bicarbonate (NaHCO3): 84.01 g/mol
Sucrose (C12H22O11): 342.30 g/mol
Sodium Hydroxide (NaOH): 39.99 g/mol
function calculateMolarity() {
var mass = document.getElementById('soluteMass').value;
var molarMass = document.getElementById('molarMass').value;
var volume = document.getElementById('solventVolume').value;
var unit = document.getElementById('volUnit').value;
var errorColor = "#e74c3c";
var resultBox = document.getElementById('molarResultBox');
var output = document.getElementById('molarOutput');
var details = document.getElementById('molarDetails');
if (!mass || !molarMass || !volume || mass <= 0 || molarMass <= 0 || volume <= 0) {
resultBox.style.display = "block";
resultBox.style.borderColor = errorColor;
output.style.color = errorColor;
output.innerHTML = "Invalid Input";
details.innerHTML = "Please enter positive numeric values for all fields.";
return;
}
var massNum = parseFloat(mass);
var molarMassNum = parseFloat(molarMass);
var volNum = parseFloat(volume);
// Convert volume to Liters if it is in mL
var volumeInLiters = (unit === 'ml') ? (volNum / 1000) : volNum;
// Formula: Molarity = Mass / (Molar Mass * Volume in Liters)
var molarity = massNum / (molarMassNum * volumeInLiters);
var moles = massNum / molarMassNum;
resultBox.style.display = "block";
resultBox.style.borderColor = "#2980b9";
output.style.color = "#2c3e50";
output.innerHTML = molarity.toFixed(4) + " M (mol/L)";
details.innerHTML = "Calculation break down: " + moles.toFixed(4) + " total moles dissolved in " + volumeInLiters.toFixed(4) + " Liters of solvent.";
}