The quick answer

Caffeine decays exponentially: remaining = dose × 0.5^(hours ÷ half-life). The mean half-life is about 5 hours, and individuals span 1.5 to 9.5 hours. Worked example: 200 mg at 2 PM with a 5-hour half-life leaves about 57 mg circulating at an 11 PM bedtime. Genetics and lifestyle move that number more than the dose does.

The 400 mg dose that cost 41 minutes

In 2013, Christopher Drake and colleagues gave twelve healthy sleepers a 400 mg caffeine dose at 0, 3, and 6 hours before habitual bedtime, on separate nights against placebo, with a validated in-home monitor recording every night. The six-hour dose cut measured total sleep time by 41 minutes while the participants' sleep diaries barely registered the disruption. People under-perceive the caffeine still on board at bedtime.

The mechanism is not mysterious, and it is not psychological. Caffeine blocks the adenosine receptors whose slow accumulation over the waking day is, biologically, what sleepiness is. The blockade holds until the liver clears the caffeine, and then the deferred sleep pressure arrives at once, usually in the small hours. The variable worth managing is how much caffeine is still circulating when your head hits the pillow.

That is this calculator's whole job: enter your dose, the time you drank it, your bedtime, and your best guess at your half-life, and it shows the milligrams still on board at lights-out plus the hour-by-hour decay curve for the 16 hours that follow.

The sections below cover how the math works, why your half-life is probably not the default five hours, what the sleep researchers measured at 0, 3, and 6 hours before bed, and where the model admits it is a model.

What the calculator asks and answers

The inputs are four fields. Dose in milligrams, which opens at 200. The time you finished the drink, which opens at 08:00. Your bedtime, which opens at 22:00. And your half-life in hours, which opens at 5, the ~5-hour population mean, editable the moment you learn yours sits somewhere in the documented 1.5–9.5-hour individual range (the stepper moves in 0.5-hour steps).

The outputs are three cards and a curve. Caffeine left at bedtime shows the milligrams still circulating at your bedtime, with the hours-later count in its label; percent of dose remaining is the same number as a share of what you drank; and the third card checks the 6-hour mark. Underneath, the decay curve draws one bar per hour from now to +16 hours, so the halving pace is visible at a glance. With the defaults loaded, the cards read 28.7 mg left at bedtime, 14.4% of the dose remaining, and 87.1 mg after 6 hours.

A warning bar sits under the results, and it deserves quoting: research links bedtime caffeine as low as ~50 mg to measurable sleep disruption, with the disclaimer that this is an estimate, not medical advice, and that the CYP1A2 gene varies half-life from roughly 2.5 to 10 hours between people. That is the tool hedging honestly; the rest of this page is the fine print behind the hedge.

Everything computes in your browser, which for a health-adjacent tool is not decoration: your sleep habits, your medication notes, and your half-life guesses stay on your device, and there is no account in which to store them.

Running your afternoon through it

One pass with a real afternoon teaches the whole lesson. The steps below use a 16-ounce cold brew at 4 p.m. and an 11 p.m. bedtime, a common and quietly expensive configuration.

  1. Enter the dose

    Type the milligrams directly; the field opens at 200. A 16-ounce cold brew is around 200 mg, a double espresso about 125, and a 12-ounce drip about 140. Serving size is where the surprises live.

  2. Set the time and your half-life

    The consumed-at field opens at 08:00; set it to 16:00 for the cold brew. Leave the half-life at 5 hours unless you know better; the genetics section below explains when to move it.

  3. Set your bedtime

    The real one, not the aspirational one. The field opens at 22:00; set it to 23:00 for this example.

  4. Read the bedtime number

    For the cold brew at 4 p.m. with a 5-hour half-life and an 11 p.m. bedtime, the first card reads 75.8 mg still on board, 7.0 hours later: about the caffeine of a single espresso shot, still circulating at lights-out.

  5. Flip the arithmetic around

    For a 25 mg bedtime target, the cutoff is 5 × log2(200 ÷ 25) = 15 hours before bed, which is 8 a.m. for an 11 p.m. bedtime. The tool answers the forward question; the reverse is this one-line calculation.

  6. Track it against reality

    Compare the model against your sleep tracker for a week. If coffee days keep costing you sleep the model says you should have spent, your half-life is probably longer than 5 hours.

What caffeine is doing in the meantime

Caffeine is absorbed fast: plasma concentration peaks roughly 30 to 60 minutes after ingestion, faster on an empty stomach. From the bloodstream it distributes through total body water, which is why the same cup hits a smaller frame harder. And then it does the only thing it does: it competes for adenosine receptors.

Adenosine is the day's ledger. Every waking hour, the brain produces more of it; receptors register the accumulation; sleepiness is the readout. Caffeine's molecule is close enough to adenosine to occupy the receptor without triggering it, a molecular impostor standing in the doorway. The ledger keeps growing behind the blockade, which is why caffeine defers the invoice rather than canceling it.

Clearance is a liver story. Caffeine is metabolized, about 95% of it by a single enzyme, CYP1A2, through a chain of breakdown products that are themselves mildly active, before the kidneys finish the paperwork. None of it is flushable: the popular idea that water washes caffeine out conflates the kidneys' minor disposal role with the liver's dominant one.

Half-life math you can do at the café

The model is one line: remaining = dose × 0.5^(elapsed hours ÷ half-life). It is exponential decay, the same curve as radioactive isotopes. Every half-life that passes halves the remainder: 200 mg becomes 100 mg after 5 hours (the default), 50 mg after 10, 25 mg after 15, and 12.5 mg after 20, and the calculator draws exactly that curve across your day.

Half-lives elapsedFraction remainingA 200 mg dose is now
150%100 mg
225%50 mg
312.5%25 mg
46.25%12.5 mg
53.1%6.25 mg
3.3210%20 mg, the 90%-cleared moment
The halving ladder with a 200 mg dose and a 5-hour half-life: 3.32 half-lives to 90% gone, five half-lives to effectively zero.
Two real afternoons

Input

Cold brew: 200 mg at 4:00 p.m., half-life 5 hours, bedtime 11:00 p.m. Separately: a morning 12-ounce drip, 140 mg at 7:00 a.m., same bedtime.

Output

Afternoon: 7 hours = 1.4 half-lives; 200 × 0.5^1.4 ≈ 76 mg at bedtime (75.8 on the tool's card). Morning: 16 hours = 3.2 half-lives; 140 × 0.5^3.2 ≈ 15 mg. Same person, same night: one cup is a rounding error and the other is a sleep study.

Two clean facts fall out of the arithmetic. The 90%-cleared moment arrives at 3.32 half-lives, about 16.6 hours on the default setting, and the conventionally fully-cleared moment at five half-lives, about 25 hours. A double espresso at noon is, mathematically, still whispering at breakfast; whether loudly enough to matter is the genetics question.

The bedtime cutoff formula

The question people bring to this page is as often when to stop as how much is left. Solving the decay equation for time gives hours before bed = half-life × log2(dose ÷ target). Pick a target you consider negligible, 25 mg for most people and 10 mg for the sensitive, and the formula hands you your personal last call.

DoseTarget at bedtimeCutoff (5-hour half-life)
200 mg cold brew25 mg15 hours before bed: morning-only territory
200 mg cold brew50 mg10 hours before bed: by 1 p.m. for an 11 p.m. bedtime
140 mg drip25 mg12.4 hours before bed: finish by 10:36 a.m. for an 11 p.m. bedtime
125 mg double espresso10 mg18.2 hours before bed: this is why espresso is a morning sacrament
200 mg, slow metabolizer (7 h)25 mg21 hours: effectively none today
Last-call arithmetic at various doses, targets, and half-lives.

Notice how the slow-metabolizer row behaves. The same formula that gives a typical metabolizer a 3 p.m. cutoff for a modest dose tells a slow one that yesterday was the deadline. If your lived experience matches that bottom row more than the others, the genetics section below is about you, and an afternoon decaf ritual is worth its weight in recovered sleep.

Why your half-life is not five hours

The mean healthy-adult half-life sits near five hours, and the commonly cited healthy range runs roughly four to six. The documented individual spread runs from about 1.5 to 9.5 hours, a six-fold difference between the fastest and slowest metabolizers, and most of it has names. The dominant factor is genetic: the CYP1A2 enzyme that handles nearly all caffeine clearance comes in common faster and slower variants, and people carrying the slow variant hold caffeine longer and report worse sleep at equal doses.

The non-genetic factors are just as dramatic. Smoking roughly doubles clearance speed, so smokers can see half-lives near three hours. Hormonal contraceptives roughly double the half-life in the other direction. Pregnancy stretches it progressively, and by the third trimester a half-life of fifteen hours is documented: one morning cup holding most of its strength into the night. Liver disease slows clearance, and certain common medications, including quinolone antibiotics like ciprofloxacin, inhibit CYP1A2 directly, a prescription you did not know was also a coffee multiplier.

YouTypical half-lifePractical meaning
Average healthy adult~5 hoursThe calculator default
Fast CYP1A2 variant~3–4 hoursEvening coffee is survivable, still not free
Slow CYP1A2 variant~7–8 hoursAfternoon coffee is evening coffee
Smoker~3 hoursClearance the liver pays for elsewhere
On hormonal contraceptives~8–11 hoursHalve your assumptions
Third-trimester pregnancyup to ~15 hoursOne cup is an all-day event
The honest range of human caffeine half-lives, and the reason the field is editable.

The six-hour study everyone should meet

The 2013 experiment deserves its own section. Drake and colleagues recruited twelve healthy normal sleepers and ran a randomized, double-blind, placebo-controlled design: a 400 mg dose at 0, 3, and 6 hours before habitual bedtime, on separate nights, with a portable in-home monitor validated against polysomnography (intraclass correlation above 0.90 for total sleep time). The paper was published in the Journal of Clinical Sleep Medicine.

Every timing disrupted sleep. The bedtime and 3-hour doses did obvious damage to total sleep time and sleep continuity. The six-hour dose cut measured total sleep time by 41 minutes (p = 0.08) and more than doubled the self-reported time it took to fall asleep (p = 0.06), while the participants' own diaries barely registered the six-hour disruption. The monitor disagreed with the people, and the authors flagged exactly that gap, the lack of perceived disruption, as the finding with the most practical weight.

400 milligrams: the ceiling, not a target

The FDA's consumer guidance for healthy adults puts the ceiling at 400 mg per day, about four or five 8-ounce cups of drip coffee, with pregnant people advised to stay at or under 200 mg per day. European food-safety authorities add a per-occasion figure of about 200 mg in a single sitting. The ceiling is a safety boundary, not a target to approach; the functional dose and the twitchy dose are separated by little once serving sizes enter the picture.

SourceTypical caffeineNotes
8 oz drip coffee80–100 mgThe reference dose everyone estimates wrong
1 oz espresso shotabout 63 mgStronger per ounce, weaker per serving
16 oz cold brew~200 mgCold brewing extracts more; sizes have grown
8 oz black tea30–50 mgOften the stealth bedtime offender
12 oz cola22–36 mgThe evening pizza pairing
8.4 oz energy drinkabout 80 mgCans run larger; read the label, not the vibe
8 oz decaf2–7 mgNot zero, just polite
Typical caffeine content by source; brands vary, labels rule.

The pattern worth internalizing is how the day stacks: drip at seven, tea at eleven, cola at two, cold brew at four, individually modest and collectively past 400 mg before dinner, with the last dose's tail crossing your bedtime. The calculator's curve makes the stack visible, and visibility is most of the fix.

Where the model admits it is a model

This calculator implements a single-compartment, first-order decay, the textbook simplification and a genuinely good one. It is not a simulation of you. Real plasma curves have a rise, a peak, and a distribution phase the model smooths away; receptor dynamics are their own story, and regular users develop tolerance to the subjective boost while the kinetics barely move. You feel less; the drug lasts just as long.

Then there is rebound. When clearance completes, the accumulated adenosine arrives at receptors no longer guarded, and the crash that follows a long caffeine day is partly that invoice. Withdrawal runs on its own clock, with headache and irritability typically beginning 12 to 24 hours after the last dose, which is why just-quit-for-a-week experiments have a rough Tuesday built in. The disclaimers that belong in every caffeine paragraph: this is not medical advice; pregnancy and heart conditions deserve a clinician's attention rather than a calculator's; and interactions with real medications are a pharmacist question.

Who runs their day through this math

The core audience is the sleep-curious with a tracker on their wrist: people who have seen the forty-one-minute pattern and want to know which input caused it. Shift workers, new parents, and evening trainers bring the same arithmetic with stranger bedtimes; for heart-rate-guided training, the Heart Rate Zone Calculator is the adjacent tool. Clinicians and pharmacists arrive too, since the model is the first-order decay taught in pharmacokinetics.

ApproachWhat you get
Generic "caffeine lasts 5–6 hours" chartsOne number for all bodies, all doses
Trial and error with your sleep trackerGround truth, three weeks of data, one variable at a time
This calculatorDose- and bedtime-specific arithmetic, editable half-life, the cutoff formula
Three ways to answer when to stop.

Frequently asked questions

How long does caffeine stay in your system?

Caffeine follows first-order elimination: with the average healthy-adult half-life of about five hours, half of any dose is cleared every five hours. A 200 mg dose is down to 50 mg after ten hours, 25 mg after fifteen, 12.5 mg after twenty, and about 7 mg, roughly 96% eliminated, after a full day. Effects on sleep can outlast the arithmetic.

What time should I stop drinking coffee to sleep well?

Work backward from a target you consider negligible. The cutoff is half-life × log2(dose ÷ target): for a 200 mg afternoon dose and a 25 mg bedtime target with a 5-hour half-life, that is 15 hours before bed, around 8 a.m. for an 11 p.m. bedtime, which is an argument for smaller afternoon doses rather than no coffee at all. The Drake study found measurable sleep disruption even from caffeine taken six hours before bed.

Can caffeine hurt my sleep even if I fall asleep fine?

Yes, and this is the trap. In the 2013 Drake study, a 400 mg dose taken six hours before bedtime cut measured total sleep time by 41 minutes and more than doubled self-reported time to fall asleep, while the participants' sleep diaries largely failed to register the disruption. Falling asleep is the wrong scoreboard; total sleep time and continuity are where the cost lands.

How much caffeine is safe per day?

The FDA's consumer guidance puts 400 mg per day as the ceiling for healthy adults, about four or five 8-ounce cups of drip coffee, with pregnant people advised to stay at or under 200 mg per day. European food-safety authorities add a single-dose guidance of about 200 mg at one time. Sensitivity varies enough that the honest ceiling is personal.

Why does caffeine affect my friend differently than me?

Genetics. About 95% of caffeine clearance runs through one liver enzyme, CYP1A2, and its common variants split people into faster and slower metabolizers. Add smoking, which roughly doubles clearance speed, or hormonal contraceptives and pregnancy, which slow it dramatically, and the same latte can be a different drug in two different bodies.

Does drinking water or eating food flush caffeine out faster?

No. Caffeine is metabolized by the liver, not filtered out by the kidneys, so hydration does not accelerate clearance; the water just keeps you hydrated, which is fine but unrelated. Food slows absorption slightly, delaying the peak rather than shortening the half-life. Time is the only thing that clears caffeine.

Does decaf actually contain caffeine?

A little. Decaffeination removes most but not all: a typical 8-ounce cup of decaf carries roughly 2 to 7 mg, compared with 80 to 100 mg for regular drip. A few cups across an evening can add up to the equivalent of half a shot of espresso, usually negligible and occasionally the last straw.

Is this calculator medical advice?

No. It is a pharmacokinetics model, dose, time, and an editable half-life run through standard first-order decay, built for curiosity and self-experimentation. If you are pregnant, managing a heart condition, or taking medications that interact with caffeine such as certain antibiotics, treat the output as a conversation starter with your clinician, not a prescription.

Sources and further reading

Run the afternoon through the curve, take the bedtime number seriously or defiantly, and let the sleep tracker arbitrate. When the evening math is done, the Sleep Cycle Calculator picks the right bedtime, and the Water Intake Calculator handles the other glass-related habit, the one that actually does respond to water.

Sources and further reading

We cite primary sources (standards bodies, government agencies, official documentation) wherever they exist so you can verify every number on this page yourself.