Caffeine Half-Life, Explained
After reading this you can estimate how much caffeine is still in your body at any hour, including bedtime, from the drinks you had during the day.
Caffeine leaves your body on a predictable schedule. If you know when you drank it, how much, and roughly how fast you clear it, you can compute what is left at 23:00 to within a few milligrams. That number matters because caffeine near bedtime delays and lightens sleep even when you fall asleep on time.
Here is the hook. A 90 mg coffee at 15:00, with a 5-hour half-life, leaves about 30 mg at 23:00. That is roughly half a cup of black tea sitting in your blood as you try to sleep. Most people never connect that afternoon coffee to a restless night, because the dose feels long gone. The math says otherwise.
What this tool computes
The visualizer takes each caffeine dose you enter, tracks its decay through the day, adds all the doses together, and reports the total at your bedtime. It compares that total against a threshold you set (default 50 mg) so you can see at a glance whether you are likely above or below your own tolerance line.
The output is a curve of total caffeine in milligrams against the time of day, with a marker at bedtime and a horizontal reference at the threshold. Everything rests on one assumption: caffeine clears by first-order elimination, which means a fixed fraction leaves per unit time rather than a fixed amount.
When to use it, and when not to
Use it to compare choices. Should the last coffee be at 14:00 or 16:00? Does swapping the afternoon energy drink for tea actually change your bedtime level? The tool answers those questions with numbers instead of guesses.
Do not treat the output as a clinical measurement. Your true half-life is not 5 hours exactly. It shifts with genetics, liver function, pregnancy, oral contraceptives, and smoking. Absorption is not instant either: peak blood concentration arrives 30 to 60 minutes after you drink. The tool assumes the full dose lands at the moment you enter, which slightly overstates the level in the first hour and is accurate afterward.
This is an educational estimate, not medical advice. If a medication, a health condition, or a pregnancy could be changing how you process caffeine, ask a professional rather than trusting a default half-life.
The formula and why it is exponential
First-order elimination means the rate of removal is proportional to how much is present. Twice as much caffeine, twice the amount cleared per hour. That proportionality produces exponential decay, and the cleanest way to write it uses the half-life directly.
Here C(t) is the caffeine remaining t hours after a single dose, D is the dose in milligrams, and t_{1/2} is the half-life in hours. Every time t increases by one half-life, the exponent grows by 1 and the amount is multiplied by another 0.5.
Check the intuition with a 5-hour half-life. After 5 hours, 0.5^{5/5} = 0.5, so half remains. After 10 hours, 0.5^{10/5} = 0.25, a quarter. After 15 hours, one eighth. The decay never quite reaches zero, which is why a morning coffee still leaves a trace late at night.
When you enter several doses, each one decays on its own clock and the curve is the sum. The total at time t (a clock time, not hours-since-dose) is:
where D_i is the size of dose i, t_i is the time you took it, and only doses with t \ge t_i contribute (a dose has no effect before you drink it).
A worked example you can reproduce
Load the demo data: 08:00 90, 13:30 90, 16:00 45, with a 5-hour half-life and a 23:00 bedtime. Work out each dose's contribution at 23:00.
Caffeine at 23:00 from three doses
- The 08:00 dose has aged 15 hours. 90 \times 0.5^{15/5} = 90 \times 0.125 = 11.25 mg.
- The 13:30 dose has aged 9.5 hours. 90 \times 0.5^{9.5/5} = 90 \times 0.2679 = 24.11 mg.
- The 16:00 dose has aged 7 hours. 45 \times 0.5^{7/5} = 45 \times 0.3789 = 17.05 mg.
- Add them:
11.25 + 24.11 + 17.05 = 52.41mg.
At bedtime you carry about 52 mg, just above the 50 mg threshold. The small 45 mg dose at 16:00 is the deciding factor: without it you would sit near 35 mg, comfortably under the line.
Reading and interpreting the curve
Read three things off the plot. First, the bedtime value: that is the single number the tool exists to give you. Second, the shape between doses, which shows how fast you clear caffeine. A steep drop means a short half-life; a lazy slope means a long one. Third, the gap between the bedtime value and your threshold, which tells you how much room you have.
The threshold is personal. The default 50 mg is roughly half an espresso, but sensitivity varies by an order of magnitude between people. If caffeine barely touches you, set it higher. If a single afternoon cup wrecks your sleep, set it near 20 mg and watch how much earlier your last dose has to be.
To find your personal cutoff time, keep the doses fixed and drag the last one earlier until the bedtime value drops below your threshold. In the demo, moving the 16:00 dose to 13:30 brings the 23:00 total from 52 mg down to about 41 mg.
See the half-life change everything
The half-life is the parameter that reshapes the whole picture, and no single static chart shows it. Two people can drink the same coffees and end the day 30 mg apart purely because one clears caffeine in 4 hours and the other in 7.
Common mistakes
The errors below all push your bedtime estimate in a predictable direction, so knowing them lets you correct in your head.
- Entering the mug, not the caffeine
- A large filter coffee can hold 140 mg, not 90. If you log 90 when it was 140, your 23:00 estimate is low by the same 1.56x ratio. Use the ranges in the field help.
- Assuming a 5-hour half-life fits you
- Pregnancy can stretch it past 10 hours; heavy smoking can pull it below 4. At a 10-hour half-life, the demo bedtime total jumps from 52 mg to roughly 96 mg. The default is a middle guess, not your value.
- Forgetting hidden sources
- Cola (30 to 40 mg), dark chocolate, and some painkillers add caffeine you never logged. Missing a single 35 mg cola at 17:00 understates your bedtime level by about 14 mg on a 5-hour half-life.
- Trusting the first hour of the curve
- Absorption takes 30 to 60 minutes, so the sharp vertical jump at each dose is a simplification. Judgments about bedtime, many hours later, are unaffected.
Related tools
Once you have a bedtime caffeine number you are comfortable with, you can plan the sleep itself. The Sleep Cycle Calculator suggests bedtimes and wake times aligned to 90-minute cycles, so you can pair a low-caffeine evening with a wake time that lands between cycles rather than in the middle of deep sleep.
Frequently asked questions
How long does caffeine really stay in your system?
Longer than most people expect. With a 5-hour half-life, a 100 mg dose leaves 50 mg after 5 hours, 25 mg after 10, and about 6 mg after 20 hours. Full clearance takes most of a day, which is why a late-morning coffee is still faintly present at bedtime.
What half-life should I enter?
Start at 5 hours, the middle of the typical 3 to 7 hour adult range. Lower it toward 4 if you smoke, raise it toward 6 or 7 if you are pregnant or take medication known to slow caffeine clearance. If you are unsure, run the estimate at both 4 and 7 and treat the two bedtime numbers as your range.
Why is my bedtime number higher than I expected?
Two common reasons: your doses were larger than the defaults, or your half-life is longer than 5 hours. Doubling the half-life from 5 to 10 hours nearly doubles the bedtime total. Check both before assuming the tool is wrong.
Is 50 mg at bedtime actually a problem?
It depends entirely on your sensitivity, which is why the threshold is adjustable. 50 mg is about half an espresso. Some people sleep through it; others notice a clear effect below 20 mg. Set the threshold to match your own experience rather than the default.
Does decaf count?
A little. Decaf coffee typically holds 2 to 5 mg per cup, not zero. For one cup it is negligible against a 50 mg threshold, but three cups after dinner add up to roughly 10 mg, which you can log if you want the curve to be exact.