Urine anion gap formula: how sodium, potassium and chloride give the gap
The urine anion gap is urine sodium plus urine potassium minus urine chloride, all in mmol/L. Sodium 20, potassium 30 and chloride 90 give a urine anion gap of −40.0 mmol/L, labeled negative.
Not a medical device. Not a diagnosis or dosing recommendation.
What is the urine anion gap?
The urine anion gap comes from Daniel Batlle and colleagues, who described it in the New England Journal of Medicine in 1988. Their abstract looks at the gap in hyperchloremic metabolic acidosis and calls it a rough index of urinary ammonium. It's a stand-in for ammonium, not a measurement of it.
Magent's calculator returns the gap to 1 decimal place and a sign label, uag_band: negative below 0, near_zero at exactly 0, and positive above 0.
This page explains the arithmetic and the label. It doesn't say what a value means for a particular person.
The urine anion gap formula
urine anion gap = urine Na + urine K − urine Cl (all in mmol/L)
rounded to 1 decimal
label: negative below 0 · near_zero at 0 · positive above 0Exact expression the calculator uses:
urine_anion_gap_mmol_l = urine_sodium_mmol_l + urine_potassium_mmol_l - urine_chloride_mmol_lIn words: add urine sodium and urine potassium, then take away urine chloride.
Inputs
| Input | Meaning | Accepted range |
|---|---|---|
urine_sodium_mmol_l | Urine sodium, mmol/L (same as mEq/L) | 1 to 300 |
urine_potassium_mmol_l | Urine potassium, mmol/L (same as mEq/L) | 1 to 200 |
urine_chloride_mmol_l | Urine chloride, mmol/L (same as mEq/L) | 1 to 300 |
How the calculation works
- Add urine sodium and urine potassium.
- Subtract urine chloride.
- Round to 1 decimal place.
- Label the rounded value by its sign: below 0 is
negative, exactly 0 isnear_zero, above 0 ispositive.
Sodium and potassium are the measured cations and chloride the measured anion, so the gap turns negative whenever chloride is larger than sodium and potassium together.
Units
All three inputs are urine concentrations in mmol/L. For these ions, mEq/L and mmol/L are the same number, so a lab report in mEq/L can be entered as is. A missing value or a value outside its range is rejected with an error. The calculator returns the three inputs, the gap in mmol/L and the label.
Worked examples
These use Magent's own expected values for the calculator.
Example 1: Na 20, K 30, Cl 90
- 20 + 30 = 50.
- 50 − 90 = −40.0 mmol/L.
- Below 0 → label
negative.
Example 2: Na 50, K 30, Cl 80
- 50 + 30 = 80.
- 80 − 80 = 0.0 mmol/L.
- Exactly 0 → label
near_zero.
Example 3: Na 80, K 40, Cl 70
- 80 + 40 − 70 = 50.0 mmol/L.
- Above 0 → label
positive.
History of the urine anion gap
The calculator cites Batlle DC, Hizon M, Cohen E, Gutterman C and Gupta R, New England Journal of Medicine, 1988 (volume 318, issue 10, pages 594–599). The abstract describes the gap as sodium plus potassium minus chloride and reports it in three groups: patients with altered distal urinary acidification, patients with diarrhea, and normal subjects given ammonium chloride. When all subjects were pooled, urinary ammonium and the gap moved in opposite directions. The authors suggested a negative gap pointed toward gastrointestinal loss of bicarbonate and a positive gap toward altered distal urinary acidification.
When it's used
The 1988 paper used the gap in the initial evaluation of hyperchloremic metabolic acidosis, as an indirect reading of how much ammonium the kidney is putting into the urine.
Where it's used
The gap needs a spot urine sample with sodium, potassium and chloride measured. No blood values go into it.
Who uses it
The person using the calculator enters the three urine values. The calculator adds, subtracts, rounds and labels the sign.
Limits of the calculation
- The gap is an indirect stand-in for urinary ammonium. The calculator doesn't measure ammonium.
- It doesn't use urine pH or net acid excretion.
- The label reports the sign of the gap. It isn't a finding about the cause of an acidosis, and it doesn't name renal tubular acidosis or diarrhea.
- The label is set from the rounded value.
- This page doesn't say what to do with a result.
Clinical decisions belong to a qualified clinician who knows the patient.
How it differs from related calculators
- Anion gap is the serum anion gap, from blood sodium, chloride and bicarbonate, with or without potassium.
- Stool osmotic gap uses stool sodium and potassium, not urine.
- FENa uses plasma and urine sodium and creatinine.
Glossary
- Urine anion gap (UAG): urine sodium plus potassium minus chloride, in mmol/L.
- Hyperchloremic metabolic acidosis: the setting the 1988 paper studied.
- Urinary ammonium: the quantity the gap stands in for, per the 1988 abstract.
- mEq/L and mmol/L: the same number for sodium, potassium and chloride.
Common mistakes
- Using serum values. All three inputs are urine concentrations.
- Leaving out potassium. The urine gap adds sodium and potassium before subtracting chloride.
- Swapping the sign. Chloride is subtracted; a larger chloride makes the gap more negative.
- Reading the label as a cause.
negativeandpositivedescribe the sign of the gap.
Source
Batlle DC, Hizon M, Cohen E, Gutterman C, Gupta R. N Engl J Med. 1988;318(10):594-599. DOI: 10.1056/NEJM198803103181002. PMID: 3344005
Frequently asked questions
How do you calculate the urine anion gap?
Add urine sodium and urine potassium, then subtract urine chloride. Sodium 80, potassium 40 and chloride 70 give 50.0 mmol/L.
What does a negative urine anion gap mean?
It means chloride is larger than sodium plus potassium in the urine sample, and the calculator labels it negative. The 1988 paper linked a negative gap with gastrointestinal loss of bicarbonate. The label on its own doesn't establish a cause.
Is a gap of exactly 0 negative or positive?
Neither. The calculator labels exactly 0 as near_zero.
Are mEq/L and mmol/L the same here?
Yes. For sodium, potassium and chloride the number is the same in either unit.
How many decimals does the calculator report?
- The label is set from that rounded value.