# Anion Gap Calculator

> Computes the serum anion gap from sodium, chloride and bicarbonate, optionally including potassium, and the albumin-corrected gap (Figge) for hypoalbuminaemia.

- Calculator id: `anion-gap` · Category: Medical & Clinical (`medical`) · Tool name: `calculate_anion_gap`
- Canonical page: https://tttkmbb.com/medical/anion-gap · This document: https://tttkmbb.com/medical/anion-gap.md · JSON definition: https://tttkmbb.com/medical/anion-gap.json

## Purpose

Computes the serum anion gap from sodium, chloride and bicarbonate, optionally including potassium, and the albumin-corrected gap (Figge) for hypoalbuminaemia.

**Use when:** You have a basic metabolic panel and want the anion gap to classify a metabolic acidosis or check for unmeasured anions.

**Do not use when:** Electrolytes come from different samples or times, or you need a full acid-base interpretation (pH, pCO2, delta ratio), which this calculator does not perform.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `sodium_mmol_l` | number | mmol/L | required | Serum sodium (mmol/L = mEq/L). (min 100, max 200) |
| `chloride_mmol_l` | number | mmol/L | required | Serum chloride. (min 50, max 160) |
| `bicarbonate_mmol_l` | number | mmol/L | required | Serum bicarbonate (total CO2). (min 1, max 60) |
| `potassium_mmol_l` | number | mmol/L | optional | Optional serum potassium; adds the gap variant that includes K. (min 1, max 12) |
| `albumin_g_dl` | number | g/dL | optional | Optional serum albumin in g/dL (g/L ÷ 10); enables the albumin-corrected gap. (> 0, max 7) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `anion_gap` | number | mEq/L | Na − (Cl + HCO3). |
| `anion_gap_with_potassium` | number | mEq/L | Na + K − (Cl + HCO3); only when potassium is given (reference range about 4 mEq/L higher). |
| `albumin_corrected_anion_gap` | number | mEq/L | Gap + 2.5 × (4 − albumin g/dL); only when albumin is given. |
| `interpretation` | string |  | Low / normal / elevated against the traditional 8–16 mEq/L range (corrected gap when albumin is given). |

## Formula

`anion_gap = sodium − (chloride + bicarbonate); with potassium: sodium + potassium − (chloride + bicarbonate); albumin-corrected gap = anion_gap + 2.5 × (4.0 − albumin_g_dl)`

Reference ranges depend on the analyser (traditional 8–16 mEq/L; ion-selective electrodes often give 3–11), so compare with the local laboratory range; each 1 g/dL fall in albumin lowers the expected gap by about 2.5 mEq/L (Figge 1998). Results are informational only and not a substitute for clinical judgement or medical advice.

## Data Sources

- Kraut JA, Madias NE (2007) Serum anion gap: its uses and limitations in clinical medicine, Clin J Am Soc Nephrol 2:162-174 — https://pubmed.ncbi.nlm.nih.gov/17699401/ (peer_reviewed, retrieved 2026-09-24)
- Figge J, Jabor A, Kazda A, Fencl V (1998) Anion gap and hypoalbuminemia, Crit Care Med 26:1807-1810 — https://pubmed.ncbi.nlm.nih.gov/9824071/ (peer_reviewed, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/anion-gap?sodium_mmol_l=…&chloride_mmol_l=…&bicarbonate_mmol_l=…`
- `POST https://tttkmbb.com/api/v1/calculate/anion-gap` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/anion-gap · OpenAPI operationId `calculate_anion_gap` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "anion-gap", "inputs": {…}}`

## Example

- Na 140, Cl 104, HCO3 24, K 4.0, albumin 3.0: inputs `{"sodium_mmol_l":140,"chloride_mmol_l":104,"bicarbonate_mmol_l":24,"potassium_mmol_l":4,"albumin_g_dl":3}` → `{"anion_gap":12,"anion_gap_with_potassium":16,"albumin_corrected_anion_gap":14.5,"interpretation":"Normal (8–16 mEq/L, albumin-corrected)"}`
- Na 135, Cl 100, HCO3 10: inputs `{"sodium_mmol_l":135,"chloride_mmol_l":100,"bicarbonate_mmol_l":10}` → `{"anion_gap":25,"interpretation":"Elevated (>16 mEq/L): pattern of a high anion gap metabolic acidosis"}`

```
GET https://tttkmbb.com/api/v1/calculate/anion-gap?sodium_mmol_l=140&chloride_mmol_l=104&bicarbonate_mmol_l=24&potassium_mmol_l=4&albumin_g_dl=3
```

## Limitations

Electrolytes come from different samples or times, or you need a full acid-base interpretation (pH, pCO2, delta ratio), which this calculator does not perform. Reference ranges depend on the analyser (traditional 8–16 mEq/L; ion-selective electrodes often give 3–11), so compare with the local laboratory range; each 1 g/dL fall in albumin lowers the expected gap by about 2.5 mEq/L (Figge 1998). Results are informational only and not a substitute for clinical judgement or medical advice. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Should potassium be included?**

Most laboratories and textbooks omit potassium (normal about 8–16 mEq/L); including it raises the value by roughly 4 mEq/L, so use the matching reference range (about 12–20).

**Why correct for albumin?**

Albumin is the main unmeasured anion; in hypoalbuminaemia a 'normal' gap can hide an excess of other anions such as lactate or ketoacids.

## Related

- [Corrected Sodium Calculator](https://tttkmbb.com/medical/corrected-sodium.md) — Correct sodium for hyperglycaemia before interpreting electrolytes.
- [Corrected Calcium Calculator](https://tttkmbb.com/medical/corrected-calcium.md) — Another albumin-dependent correction.
