Caffeine half-life decay calculator
Caffeine fades by half-lives: 100 mg with the usual 5-hour half-life leaves 50 mg after 5 hours. Enter the dose, the hours since and, if you know it, your own half-life to see the milligrams still circulating. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Initial mg
- 100
- Hours
- 5
- Remaining mg
- 50
- Half life hours
- 5
- Fraction remaining
- 0.5
- Percent remaining
- 50
Caffeine does not leave the body at a fixed milligram-per-hour rate. Elimination follows approximate first-order kinetics: each half-life period removes about half of whatever amount is still present. That means a morning coffee can still contribute measurable caffeine late in the afternoon if your personal half-life is long, and a second dose stacks on top of residual caffeine rather than replacing it. This calculator applies the standard exponential half-life formula to an initial milligram amount and an elapsed time in hours, optionally with your own half-life estimate. No network lookup, no randomness, and no dependence on the current date—only arithmetic on the numbers you provide.
How caffeine half-life decay works
Pharmacokinetics models caffeine clearance as roughly first-order under ordinary conditions: the amount eliminated in a short interval is proportional to the amount still circulating. The convenient summary of that model is the half-life—the time for the remaining amount to fall by half. If you start with one hundred milligrams and the half-life is five hours, about fifty milligrams remain after five hours, about twenty-five after ten, and so on.
Algebraically the curve is remaining equals initial times one-half raised to the power of elapsed hours divided by half-life hours. That single expression covers fractional half-lives as well as whole ones: after two and a half hours with a five-hour half-life you still have about seventy-one percent of the dose, not half. Adult population estimates for caffeine half-life commonly center near three to seven hours, with five hours a widely used default when an individual value is unknown.
Pregnancy, liver disease, smoking, oral contraceptives, genetic CYP1A2 variation, and certain drugs can shorten or lengthen clearance substantially. This tool does not diagnose or personalize pharmacokinetics; it only evaluates the exponential formula with the half-life you supply (or the five-hour default) so sleep planning, stacking estimates, and education notebooks share one transparent definition of remaining milligrams.
What you can do with it
Evening sleep cut-off planning
Estimate residual milligrams hours after a morning or afternoon dose so users can compare remaining caffeine against a personal bedtime threshold.
Education and research notebooks
Demonstrate first-order caffeine elimination curves and store reproducible remaining amounts next to half-life and elapsed-time parameters.
FAQ
What default half-life does the tool use?
Provide your own positive half-life if you have a better individual or study value.
How much caffeine is left 10 hours after a coffee?
With the default five-hour half-life, ten hours is two half-lives, so about a quarter of the dose remains. A 100 mg coffee leaves roughly twenty-five milligrams, enough to matter if you are sensitive at bedtime.
Why is more than half left after half a half-life?
Because the decline is exponential, not linear. After two and a half hours with a five-hour half-life, about seventy-one percent of the dose is still there, not three quarters gone and not half.
What can make my caffeine half-life longer or shorter?
Pregnancy, liver disease, smoking, oral contraceptives, genetic differences in how the liver breaks caffeine down and certain drugs can all change it a lot. Adult estimates usually sit between 3 and 7 hours.
Does a second coffee add to what is already in my system?
Yes, a second dose stacks on top of the caffeine still present rather than replacing it. This calculator follows a single dose, with no multi-dose model, absorption delay or body-weight adjustment.
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/caffeine-decay \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"initial_mg":100,"hours":5}'const res = await fetch("https://api.kit.forhosting.com/health/caffeine-decay", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"initial_mg": 100,
"hours": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/health/caffeine-decay",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"initial_mg": 100,
"hours": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/health/caffeine-decay", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"initial_mg":100,"hours":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"initial_mg":100,"hours":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/health/caffeine-decay", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"initial_mg": 100,
"hours": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "health.caffeine_decay",
"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
The free browser tool and the API share the same pure JavaScript library, so interactive checks and automated tasks always agree.
Input contract, outputs, and error behaviour
Failed validation is not billed. There is no cumulative multi-dose model, no absorption lag, and no body-weight adjustment in this capability—those are separate product intents. Pair remaining milligrams with label estimates of your drink or pill if you need to compare residual caffeine against a bedtime threshold you chose yourself. Send a JSON object with two required finite numbers: initial_mg, the non-negative caffeine amount at time zero in milligrams, and hours, the non-negative elapsed time since that dose. Optionally send half_life_hours as a positive finite number; when omitted the service uses five hours as the typical adult estimate. Aliases such as initial, amount, caffeine_mg, dose_mg, elapsed_hours, time, t, half_life, and t_half are accepted so forms and scripts do not need a single field name. Missing required fields, empty strings, non-finite values, negative initial_mg or hours, and non-positive half_life_hours all fail with invalid_input and a message that names the problem. On success the response echoes initial_mg, hours, and half_life_hours, and returns remaining_mg, fraction_remaining, percent_remaining, half_lives_elapsed (hours divided by half-life), and a formula string restating remaining_mg equals initial_mg times one-half to the power of hours over half_life_hours.
Where teams use it and how pricing works
Sleep coaches, wellness apps, and sports nutrition notebooks use a caffeine half-life decay calculator to show residual milligrams before an evening cut-off without reinventing floating-point decay code in every client. The interactive tool above runs free in the browser for exploratory checks. Source inputs and outputs are retained only for the platform retention window and are never used to train models. Research pipelines that log self-reported coffee times can post many independent tasks—one per logged dose and elapsed interval—and store remaining_mg next to the session for later analysis. Classroom and public-health explainers can fix initial_mg and half_life_hours and sweep hours to illustrate how slowly late-day caffeine falls. Programmatic calls use the prepaid KIT balance per successful item; invalid input never consumes balance. Latency is dominated by the task handshake rather than by computation, which makes the endpoint suitable for form validation and batch reprocessing of historical intake tables alike.
Integration use cases
Wellness and nutrition app backends
Convert logged drink times and labeled milligrams into deterministic remaining_mg values without embedding half-life math in every client.
Technical questions
What formula does the caffeine half-life decay calculator use?
remaining_mg = initial_mg × (1/2)^(hours / half_life_hours). That is standard first-order exponential decay expressed with half-life instead of a rate constant.
Which fields are required?
initial_mg and hours are required non-negative finite numbers. half_life_hours is optional but must be positive when supplied. Missing required fields fail with invalid_input.
Does this model multiple cups stacked over the day?
No. Each call evaluates a single initial amount and one elapsed interval. To approximate stacking, run one call per dose with its own age and sum the remaining_mg values yourself.
Is the caffeine decay calculator free?
The browser tool is free. API calls cost $0.002 per successful request from your prepaid KIT balance; failed validation is never charged.