TTKG calculator
Urine potassium 40, serum potassium 3, urine osmolality 400 and serum osmolality 300 give a transtubular potassium gradient of 10. The osmolality ratio corrects for water removed after potassium is secreted. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Urine potassium
- 40
- Serum potassium
- 3
- Urine osmolality
- 400
- Serum osmolality
- 300
- Potassium ratio
- 13.3333333333 ratio
- Osmolality ratio
- 1.3333333333
- TTKG
- 10
The transtubular potassium gradient, or TTKG, estimates how strongly the cortical collecting duct is secreting potassium after water reabsorption in the medullary collecting duct is taken into account. Students, nephrology tutors, and health-software teams reach for this number when they study hypokalemia, hyperkalemia, mineralocorticoid effect, and why a raw urine potassium concentration can mislead when the urine is dilute or concentrated. This TTKG calculator applies the West identity: urine potassium over serum potassium, divided by urine osmolality over serum osmolality, which is the same as multiplying the potassium ratio by serum osmolality over urine osmolality. All four values must be finite numbers.
What the transtubular potassium gradient measures and which inputs you need
The TTKG was introduced so that a urine potassium concentration could be interpreted in light of the concurrent serum potassium and the degree of water abstraction distal to the potassium secretory site. In the cortical collecting duct, principal cells secrete potassium under the influence of aldosterone and the lumen-negative potential. Distal to that site, antidiuretic hormone can reabsorb water and raise the urine potassium concentration without any further potassium secretion.
Dividing the urine-to-serum potassium ratio by the urine-to-serum osmolality ratio undoes that water effect and yields a dimensionless gradient. In symbols, TTKG equals urine potassium divided by serum potassium, then divided by urine osmolality over serum osmolality, or equivalently urine potassium times serum osmolality over serum potassium times urine osmolality. Potassium values are milliequivalents per litre, identical to millimoles per litre for monovalent potassium.
Osmolality values are milliosmoles per kilogram of water. Practical bounds keep classroom and consumer inputs sane: urine potassium above zero through four hundred, serum potassium above zero through twenty, urine osmolality above zero through fourteen hundred, and serum osmolality above zero through five hundred.
Reading the gradient and the two ratios
The unit field is ratio because TTKG is dimensionless. Use ttkg alone when you only need the number for a worksheet; use the two ratios when teaching why a dilute urine lowers the apparent potassium concentration or why a concentrated urine inflates it. A typical teaching panel of urine potassium forty, serum potassium three, urine osmolality four hundred, and serum osmolality three hundred yields a potassium ratio of forty over three, an osmolality ratio of four over three, and a TTKG of ten.
TTKG is also not valid as a physiologic index when urine is hypotonic to plasma; this calculator still returns the arithmetic so instructors can show that caveat, but it does not invent a clinical interpretation or apply extra validity flags as hard errors.
What you can do with it
Health education apps and worksheets
Apps show learners how water reabsorption changes urine potassium without recoding the (UK/PK)×(Posm/Uosm) identity on every client.
FAQ
How is the transtubular potassium gradient calculated?
West formula: TTKG = (UK/PK)×(Posm/Uosm), with potassium in mEq/L and osmolality in mOsm/kg.
What units should I send?
Urine and serum potassium in mEq/L (same as mmol/L for K+). Urine and serum osmolality in mOsm/kg. Do not send a calculated osmolarity from sodium and glucose in place of a true osmolality.
What happens if serum osmolality or urine potassium is zero?
Serum osmolality of zero and urine potassium of zero are rejected and not charged, as are zero serum potassium or zero urine osmolality.
Is TTKG the same as a urine potassium-to-creatinine ratio?
No. TTKG adjusts the urine-to-serum potassium ratio for water reabsorption using osmolality. A potassium-to-creatinine ratio is a different search intent and a different contract.
Is the TTKG calculator free?
The browser tool runs free on your device.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/health/ttkg \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"urine_potassium":40,"serum_potassium":3,"urine_osmolality":400,"serum_osmolality":300}'const res = await fetch("https://api.kit.forhosting.com/health/ttkg", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"urine_potassium": 40,
"serum_potassium": 3,
"urine_osmolality": 400,
"serum_osmolality": 300
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/health/ttkg",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"urine_potassium": 40,
"serum_potassium": 3,
"urine_osmolality": 400,
"serum_osmolality": 300
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/health/ttkg", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"urine_potassium":40,"serum_potassium":3,"urine_osmolality":400,"serum_osmolality":300}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"urine_potassium":40,"serum_potassium":3,"urine_osmolality":400,"serum_osmolality":300}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/health/ttkg", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"urine_potassium": 40,
"serum_potassium": 3,
"urine_osmolality": 400,
"serum_osmolality": 300
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "health.ttkg",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Serum osmolality of zero and urine potassium of zero fail with invalid_input and are not billed, because those zeros make the gradient undefined or clinically empty.
What the transtubular potassium gradient measures and which inputs you need
Send required fields urine_potassium, serum_potassium, urine_osmolality, and serum_osmolality as finite numbers; documented aliases such as uk, pk, uosm, and posm are accepted. Serum osmolality of zero and urine potassium of zero fail with invalid_input, as do zero serum potassium or zero urine osmolality, because those zeros would divide by zero or empty the numerator in a way that is not a valid TTKG. 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 the gradient, the two ratios, and the response fields
On success the response echoes the four cleaned inputs with stable rounding, reports potassium_ratio as urine potassium over serum potassium, reports osmolality_ratio as urine osmolality over serum osmolality, and reports ttkg as the West gradient, which is the potassium ratio divided by the osmolality ratio. The formula string restates TTKG equals UK over PK times Posm over Uosm, and method is always west_ttkg so downstream code can branch without sniffing shapes. Missing required fields, non-finite values, out-of-range readings, and any of the four values that is not a positive number all fail with invalid_input and are not charged. Do not confuse this endpoint with a urine potassium-to-creatinine ratio, a fractional excretion of potassium, or a plasma osmolality calculator that estimates Posm from sodium, glucose, and blood urea nitrogen—those are different search intents and different contracts.
API usage, pricing, product workflows, and practical limits
Call the free in-browser TTKG calculator for classroom demos, nursing homework checks, and quick personal learning without reimplementing the West identity in every spreadsheet. Prefer consistent conventional units; if your UI only collects whole numbers, send integers and the engine still accepts numeric strings. Authors shipping SDKs can map ttkg into tables and step-by-step teaching cards that show the formula string and each ratio. Keep expectations educational: this is a calculation and learning tool, not a diagnostic medical device, and people with symptoms, known electrolyte disorders, kidney disease, or suspected mineralocorticoid disorders should follow professional medical advice rather than any single automated number alone. Send a JSON body with required urine_potassium, serum_potassium, urine_osmolality, and serum_osmolality values. 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 teaching workflow—confirm that potassium is in milliequivalents per litre and osmolality is in milliosmoles per kilogram, not a calculated osmolarity from van’t Hoff factors—then store ttkg alongside the raw panel for dashboards and export columns for the four inputs and the gradient. The engine rejects serum osmolality of zero and urine potassium of zero as invalid_input, matching the product contract, and likewise rejects the other two zeros that would divide by zero.
Integration use cases
Nephrology and medical-school homework
Students submit paired urine and serum potassium and osmolality panels and pin expected TTKG JSON in automated checkers with deterministic West ratios.
Simulation labs and SaaS backends
Server pipelines that already store electrolyte and osmolality panels call a prepaid endpoint for a TTKG field instead of duplicating the formula in every language.