ForHosting KIT · Health & fitness

Anion gap calculator

Get the serum anion gap and its albumin-corrected value in one step: sodium 140, chloride 104 and bicarbonate 24 mEq/L give a gap of 12. Add albumin in g/dL and the corrected gap appears beside it. 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
Serum sodium
140
Serum chloride
104
Serum bicarbonate
24
You get
Albumin
4
Normal albumin
4
Unit electrolytes
mEq/L
Unit albumin
g/dL

The serum anion gap estimates unmeasured anions in blood by subtracting the major measured anions chloride and bicarbonate from sodium. Clinicians, students, and health-software teams use that simple difference every day when teaching acid-base balance, reviewing basic metabolic panels, or wiring educational calculators into apps. This capability returns both the classical anion gap without potassium and the albumin-corrected gap that adjusts for hypoalbuminemia with the widely taught two-point-five milliequivalent correction per gram per decilitre of albumin below a normal reference. Negative electrolytes fail with a clear invalid input error and are never charged.

What the serum anion gap measures and which inputs you need

The anion gap is an accounting identity from electroneutrality: the sum of measured cations should roughly balance measured anions plus unmeasured anions. In the common teaching form without potassium, anion gap equals sodium minus the sum of chloride and bicarbonate, all in milliequivalents per litre or millimoles per litre for monovalent ions.

A typical adult reference band is often taught near eight to twelve or twelve to sixteen depending on analyser chloride methods, but this product does not diagnose disease—it only computes the arithmetic and the albumin correction so every client gets the same numbers. Optional albumin in grams per decilitre drives the correction; if you omit it, the engine uses the normal reference albumin so the corrected gap equals the uncorrected gap and the correction term is zero.

Practical bounds keep classroom and consumer inputs sane: sodium and chloride zero through two hundred, bicarbonate zero through eighty, albumin zero through eight.

Health education apps and worksheets

Apps show learners how hypoalbuminemia changes the gap without re-coding the 2.5 mEq correction on every client.

How is the serum anion gap calculated?

Anion gap = sodium − (chloride + bicarbonate), all in mEq/L.

What happens if an electrolyte is negative?

Negative sodium, chloride, bicarbonate, or albumin values are rejected and not charged.

Is the anion gap calculator free?

The browser tool runs free on your device.

Does this include potassium in the gap?

No. This product uses the common Na − (Cl + HCO3) form without potassium. K-inclusive anion gap is a different teaching variant and is not computed here.

Why is the anion gap corrected for albumin?

Albumin is itself an unmeasured anion, so when it is low the plain gap looks smaller than it would at normal albumin. The correction adds 2.5 mEq/L for every g/dL of albumin below the 4.0 reference.

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/health/anion-gap

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/health/anion-gap \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sodium":140,"chloride":104,"bicarbonate":24}'
{
  "sodium": 140,
  "chloride": 104,
  "bicarbonate": 24
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "health.anion_gap",
  "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.

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 the serum anion gap measures and which inputs you need

Send required fields sodium, chloride, and bicarbonate as finite numbers; aliases such as na, cl, hco3, bicarb, and total_co2 are accepted when documented. Optional normal_albumin defaults to four point zero grams per decilitre. Any negative electrolyte or negative albumin fails with invalid_input because negative serum values are not a valid panel for this calculator. Identical inputs always yield identical JSON because the path is pure arithmetic with no network, no model, no random seed, and no wall clock.

Reading anion_gap, albumin correction, and response fields

On success the response echoes sodium, chloride, bicarbonate, albumin, and normal_albumin with stable rounding, sets unit_electrolytes to mEq/L and unit_albumin to g/dL, and reports albumin_provided so you know whether the client sent albumin or the default was applied. The anion_gap field is sodium minus chloride minus bicarbonate. The albumin_correction field is two point five times normal_albumin minus albumin, the additive term in milliequivalents per litre. The anion_gap_corrected field is anion_gap plus that correction, so hypoalbuminemia raises the corrected gap toward what it would have been at normal albumin. correction_factor is always two point five, formula restates both equations as a single teaching string, and method is always serum_anion_gap_albumin_corrected so downstream code can branch without sniffing shapes. Use anion_gap alone when you only need the classical panel math; use anion_gap_corrected and albumin_correction when reviewing low-albumin patients or teaching why uncorrected gaps look smaller in that setting. Missing required electrolytes, non-finite values, out-of-range readings, and any negative sodium, chloride, bicarbonate, or albumin all fail with invalid_input and are not charged. Do not confuse this endpoint with osmolar gap calculators, strong ion difference tools, urine anion gap products, or full acid-base interpretation engines—those are different search intents and different contracts.

API usage, pricing, product workflows, and practical limits

Call the free in-browser anion gap calculator for classroom demos, nursing homework checks, and quick personal learning without reimplementing the formulas in every spreadsheet. Prefer consistent milliequivalent units for monovalent ions; if your UI only collects whole numbers, send integers and the engine still accepts numeric strings. Keep expectations educational: this is a calculation and learning tool, not a diagnostic medical device, and people with symptoms, known acid-base disorders, kidney disease, or medication changes should follow professional medical advice rather than any single automated number alone. Send a JSON body with required sodium, chloride, and bicarbonate values and optional albumin and normal_albumin when you want an explicit albumin correction. Use the prepaid API when a health SaaS, electronic worksheet, simulation lab, tutoring platform, or school LMS needs a stable contract under KIT balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. Pair this endpoint with your own laboratory units and clinical workflow—confirm analyser methods for chloride and how your lab reports total carbon dioxide versus bicarbonate—then store both gaps alongside the raw electrolytes for dashboards and export columns for sodium, chloride, bicarbonate, albumin, anion_gap, and anion_gap_corrected. Authors shipping SDKs can map anion_gap and anion_gap_corrected into tables, colour bands for educational thresholds you define yourself, and step-by-step teaching cards that show the formula string.

Nursing and medical-school homework

Students submit Na, Cl, and HCO3 panels and pin expected anion gap and albumin-corrected JSON in automated checkers with deterministic outputs.

Simulation labs and SaaS backends

Server pipelines that already store basic metabolic panels call a prepaid endpoint for AG fields instead of duplicating formulas in every language.

How does albumin correction work?

Corrected AG = AG + 2.5 × (normal_albumin − albumin), with default normal_albumin 4.0 g/dL. Optional albumin and normal_albumin fields control the correction; if albumin is omitted it defaults to the normal reference so the correction is zero.

Read the full KIT documentation →