Home › Chemistry › Molarity Calculator
Molarity Calculator
Computes molar concentration (mol/L) of a solution from the amount of solute (moles, or mass with a formula or molar mass) and the solution volume, or the moles and mass of solute needed to prepare a target molarity.
When to use
You need the molarity of a solution from what was dissolved, or the grams of solute required for a given volume and target concentration.
Do not use when: You are diluting an existing stock solution (use dilution), or you need a mass-based concentration such as % w/w, ppm or ppb (use mass-percent).
Formula
molarity = moles / volume_l, with moles = mass_g / molar_mass_g_mol; for a target: moles = target_molarity × volume_l and mass_g = moles × molar_mass_g_mol
Molarity refers to the final volume of solution, not the volume of solvent added; volume changes with temperature, so molarity is usually stated at 20–25 °C.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
volume_l | number | L | yes | Total volume of the solution in litres (250 mL = 0.25). Range: > 0 |
moles | number | mol | no | Amount of solute in moles. Takes precedence over mass_g. Range: > 0 |
mass_g | number | g | no | Mass of solute in grams; requires formula or molar_mass_g_mol. Range: > 0 |
formula | string | no | Chemical formula, e.g. NaCl, C6H12O6, Ca(OH)2 or CuSO4·5H2O (case-sensitive element symbols). Alternative to molar_mass_g_mol. | |
molar_mass_g_mol | number | g/mol | no | Molar mass of the substance; use instead of formula when it is already known. Range: > 0, ≤ 10000000 |
target_molarity_mol_per_l | number | mol/L | no | Desired concentration; when given, the calculator returns the moles and mass of solute needed for volume_l instead (moles and mass_g are ignored). Range: > 0 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
molarity_mol_per_l | number | mol/L | Moles of solute per litre of solution (M). |
millimolar | number | mmol/L | Same concentration in millimoles per litre (mM). |
moles | number | mol | Amount of solute in the solution. |
mass_g | number | g | Mass of solute (only when the molar mass is known). |
molar_mass_g_mol | number | g/mol | Molar mass used (only when formula or molar_mass_g_mol was given). |
mass_concentration_g_per_l | number | g/L | Grams of solute per litre of solution (only when the molar mass is known). |
volume_ml | number | mL | Solution volume in millilitres. |
solved_for | string | molarity_mol_per_l when computing a concentration, mass_g when computing what to weigh for a target molarity. |
Example
5.844 g NaCl in 0.5 L: {"volume_l":0.5,"mass_g":5.844,"formula":"NaCl"} → {"molarity_mol_per_l":0.2,"millimolar":200,"moles":0.1,"molar_mass_g_mol":58.44,"mass_concentration_g_per_l":11.688,"solved_for":"molarity_mol_per_l"}
Prepare 250 mL of 0.1 M NaOH: {"volume_l":0.25,"target_molarity_mol_per_l":0.1,"formula":"NaOH"} → {"moles":0.025,"mass_g":0.9999,"molar_mass_g_mol":39.997,"molarity_mol_per_l":0.1,"solved_for":"mass_g"}
GET https://tttkmbb.com/api/v1/calculate/molarity?volume_l=0.5&mass_g=5.844&formula=NaCl
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/molarity(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/molarity · Markdown: https://tttkmbb.com/chemistry/molarity.md · JSON definition: https://tttkmbb.com/chemistry/molarity.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="molarity" - OpenAPI operationId:
calculate_molarity - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
FAQ
Is the volume the water added or the final solution?
The final solution volume. Dissolve the solute in less solvent than needed, then make up to the mark in a volumetric flask.
What if I know the mass but not the formula?
Enter molar_mass_g_mol instead of formula. Without either, only moles can be used to compute molarity.
Related calculators
- Dilution Calculator — Dilute the resulting stock to a lower concentration with C1V1 = C2V2.
- Molar Mass Calculator — Check the molar mass used for the mass-to-moles conversion.
- Moles to Grams Calculator — Plain gram/mole conversion without a volume.