ForHosting KIT · Science

mg/L to molarity calculator

5844 mg/L of sodium chloride, at 58.44 g/mol, is 0.1 mol/L. Turn the milligrams per litre on a water-quality sheet or lab assay into the molarity that stoichiometry, titrations and rate laws need. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Mg per liter
5,844
Molar mass
58.44
You get
Molarity
0.1 mol/L
Mass solute g per L
5.844
Moles per L
0.1
Precision
10

This milligrams-per-litre to molarity calculator converts a solute concentration given in milligrams per litre and the solute’s molar mass in grams per mole into molarity in moles per litre. Environmental reports, water-quality sheets, and many lab assays report contaminants or reagents as mg/L, while stoichiometry, titration workups, and rate laws almost always need moles per litre. The conversion is fully deterministic: molarity equals milligrams per litre divided by molar mass times one thousand, when molar mass is in grams per mole. Classic checks include five thousand eight hundred forty-four milligrams per litre of sodium chloride with molar mass fifty-eight point four four yielding zero point one molar, and eighteen thousand fifteen milligrams per litre of glucose with molar mass one hundred eighty point one five also yielding zero point one molar. The engine uses only finite arithmetic with no network calls, no sampling, and no date-dependent shortcuts.

Where mg/L-to-molarity conversion fits in study, lab work, and software

Students meet this conversion when a water-chemistry problem or environmental case study lists a contaminant as milligrams per litre and then asks for molarity before a stoichiometry or equilibrium calculation. Teachers can pre-generate answer keys for ion concentrations and dissolved solids without trusting opaque apps that confuse mg/L with g/L or forget the thousand factor. Lab technicians and environmental analysts use the same formula when a protocol needs moles per litre and the instrument or certificate only reports milligrams per litre.

Developers call the same contract from scripts to seed deterministic test vectors for chemistry tutors, to normalize water-quality exports before a LIMS import, or to satisfy programming-challenge statements that demand mol per L from mg/L and molar mass rather than a hand-waved sketch. Pair it with molar concentration from moles and volume when you already measured amount and flask size, and with other chemistry helpers when you are building a small lab of free, deterministic solution calculators.

Water quality and homework

Convert contaminant or ion concentrations from mg/L into mol/L before stoichiometry, equilibrium, or titration exercises.

Lab and LIMS helpers

Normalize assay reports expressed as mg/L into molarity for preparation sheets, inventory exports, and teaching software.

What does the mg/L to molarity calculator cost?

It is free in your browser on this page.

What happens if molar mass is zero?

Zero or negative molar mass makes the conversion undefined (division by zero).

Is mg/L the same as ppm?

For dilute aqueous solutions, 1 ppm is often treated as 1 mg/L.

Do I need solution density?

No. mg/L is already a mass-per-volume concentration. Density is only needed when converting from mass percent (w/w), which is a different calculator.

How many mol/L is 5844 mg/L of sodium chloride?

It is 0.1 mol/L. The 5844 mg in each litre are 5.844 g, and dividing those grams by the molar mass of 58.44 g/mol gives 0.1 moles per litre.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/chem/mg-per-liter-to-molarity

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/chem/mg-per-liter-to-molarity \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mg_per_liter":5844,"molar_mass":58.44}'
{
  "mg_per_liter": 5844,
  "molar_mass": 58.44
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "chem.mg_per_liter_to_molarity",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_abs_value1000000000000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

What mg/L to molarity means and what the response contains

The standard bridge is to convert milligrams to grams by dividing by one thousand, then divide by the molar mass in grams per mole to obtain moles per litre. Algebraically that collapses to molarity equals milligrams per litre divided by molar mass times one thousand. Zero concentration with positive molar mass is valid and yields zero molarity. Milligrams per litre is a mass concentration: the mass of solute, in milligrams, present in one litre of solution. Molarity is amount concentration: moles of solute per litre of solution. Those two descriptions are not interchangeable without the solute’s molar mass, because a fixed mg/L value maps to different molarities for solutes of different molecular weight. This calculator returns the validated mg per litre and molar mass, the computed molarity, the intermediate solute mass in grams per litre and moles per litre, the precision used, a method tag mg_per_liter_to_molarity, a short formula reminder, and a unit hint mol/L. There is no automatic unit conversion from grams per litre or micrograms per litre, no density path, and no activity or molality path: the engine either evaluates the closed formula inside the supported numeric range or rejects the input with invalid_input. Rejected cases include missing fields, non-finite values, magnitudes above the documented ceiling, negative concentration, and zero or negative molar mass because division by a non-positive molar mass is undefined.

How concentration and molar mass are read and stay reproducible

Concentration must be non-negative; ordinary environmental and lab values fall in a sensible range, but the numeric ceiling is documented separately so extreme bookkeeping values fail loudly rather than overflow silently. Optional leading plus signs and scientific notation on numeric strings are allowed when they parse as finite decimals; embedded spaces and non-numeric tokens are rejected with a clear field-named message. The preferred field for mass concentration is mg_per_liter, but aliases mg_l, mgL, concentration_mg_l, concentration, conc, and ppm are accepted so spreadsheets, query strings, and water-quality forms can reuse the same contract. For dilute aqueous solutions, one part per million by mass is often treated as one milligram per litre; that convention is why the ppm alias is offered, but the engine does not adjust for density or non-aqueous matrices. Molar mass prefers molar_mass with aliases M, mm, molecular_weight, mw, and molarMass, and must be strictly positive in grams per mole: zero molar mass is rejected explicitly because the conversion formula divides by that value. An optional precision field, with aliases decimals and dp, chooses how many decimal places to expose for the numeric outputs, defaulting to ten and capped at fifteen so JSON goldens stay stable. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing the formula yourself.

Where mg/L-to-molarity conversion fits in study, lab work, and software

Product and education tools use the endpoint when a learner types concentration and molar mass and the UI must show molarity with a clear unit and intermediate grams-per-litre check. On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result.

Deterministic test fixtures

Generate reproducible molarity values from mg/L and molar mass for unit tests, tutors, and CI assertions.

What formula does this tool use?

M = (mg_per_liter) / (molar_mass × 1000), with concentration in mg/L, molar mass in g/mol, and M in mol/L.

Read the full KIT documentation →