How much caffeine is in your body at bedtime?

Enter what you drank today — see the caffeine curve, what's left at bedtime and the latest safe cup.

{{ __t('intake_section') }}
{{ __t('settings_section') }}
{{ __t('half_life_hint') }}
{{ __t('threshold_hint') }}

{{ __t('caffeine_at_bedtime') }}
{{ result.atBedtimeMg.toFixed(0) }} mg
{{ __t('at_time') }} {{ bedtime }}
{{ __t('peak_today') }}
{{ result.peakMg.toFixed(0) }} mg
{{ __t('total_consumed') }}: {{ result.totalMg }} mg
{{ __t('latest_safe_intake') }}
{{ result.latestSafeTime || '—' }}
{{ __t('for_single_dose') }}: {{ result.singleDose }} mg
⚠ {{ __t('warning_too_high_title') }}
{{ __t('warning_too_high_text') }}
✓ {{ __t('safe_for_sleep') }}
{{ __t('safe_for_sleep_text') }}

How does caffeine half-life work?

Caffeine is metabolized exponentially. Its half-life is the time after which half of a dose remains active. For most adults it's between 4–6 hours — shorter for smokers, much longer during pregnancy or while on the contraceptive pill. Concretely: drinking 100 mg at 3 pm leaves ~50 mg in your body at 8 pm, ~25 mg at 1 am.

How late can you still drink coffee?

Rule of thumb: no caffeine 6–8 hours before bed. A more precise approach uses the half-life: if your threshold is ~100 mg and you drink 200 mg, you need one half-life to get below — i.e., 5 hours before bed at a 5h half-life. For 400 mg you need two half-lives = 10 hours.

Tips for better sleep despite caffeine

  • Espresso tastes strong but often contains less caffeine per cup than filter coffee.
  • Decaf still contains ~2–5 mg per cup — matters for very sensitive people.
  • Caffeine can hurt sleep quality even if you fall asleep fine — deep sleep takes the hit.

How caffeine is actually metabolized

About 95% of caffeine is metabolized in the liver by the enzyme CYP1A2. The average half-life in healthy adults is around 5 hours per pharmacokinetic studies (e.g. Arnaud 2011, Handbook of Experimental Pharmacology) — with an enormous individual range of 1.5 to over 9.5 hours. That means two people drinking the same cup of coffee can have very different plasma levels eight hours later. Half-life means: after that interval, exactly half of the original active substance is still in plasma.

Individual half-life depends on genetics (CYP1A2 polymorphism), lifestyle and medication. Smokers metabolize caffeine roughly twice as fast as non-smokers; women on oral contraceptives need around twice as long. During pregnancy the half-life rises in the third trimester to up to 15 hours — the reason EFSA recommends a maximum of 200 mg caffeine per day for pregnant women. Certain drugs such as ciprofloxacin or fluvoxamine massively inhibit caffeine breakdown as well.

For sleep it matters that caffeine binds to adenosine receptors in the brain and blocks the tiredness signal. A widely cited study by Drake et al. 2013 in the Journal of Clinical Sleep Medicine showed: 400 mg of caffeine taken six hours before bedtime cut total sleep time by more than an hour — even when participants thought they slept fine. Deep-sleep proportions dropped measurably. This calculator helps you keep residual caffeine at bedtime below a self-chosen threshold.

Formula and example

Within the physiologically relevant range, caffeine follows first-order kinetics: the residual amount halves with every half-life. From the general exponential decay equation we can also derive how many hours before bedtime your last dose must fall so that only a chosen residual amount remains in plasma at bedtime.

C(t) = C0 * 0.5^(t / t_half)

t_half  = individual half-life (3 - 8 h, median ~5 h)
C0      = initial dose in mg
t       = hours since intake

Latest safe intake (single dose) for sleep:
hours_before_bed = t_half * log2(C0 / threshold)

Worked examples

Five realistic scenarios with a 5-hour half-life:

  • Filter coffee at 8:00 (95 mg). Residual at 23:00 (15 h later): 95 * 0.5^(15/5) = 11.9 mg. Sleep unaffected.
  • Double espresso at 16:00 (128 mg). Residual at 23:00 (7 h later): 128 * 0.5^(7/5) = 48.6 mg. Borderline for sensitive sleepers.
  • Energy drink 500 ml at 17:00 (160 mg). Residual at 23:00: 160 * 0.5^(6/5) = 69.7 mg — deep-sleep share will measurably drop.
  • Pre-workout supplement 300 mg at 19:00. Residual at 23:00 (4 h): 300 * 0.5^(4/5) = 172.4 mg — sleep onset will likely be significantly delayed.
  • Three filter coffees through the day: 8:00, 11:00, 14:00 (95 mg each, 285 mg total). At 23:00 about 22 mg residual — unproblematic for most sleepers.

When this calculator hits its limits

The model assumes instantaneous absorption, which is a slight simplification: filter coffee peaks in plasma after 30 - 60 minutes, faster after gastric bypass, slower after heavy meals. Individual half-life also varies a lot — adjust the slider to your own experience: 3 - 4 h for smokers and fast metabolizers, 5 h baseline, 6 - 8 h for women on oral contraceptives, pregnant women and slow metabolizers. For cardiac arrhythmias, anxiety disorders, pregnancy or children, additional limits apply that are not represented here. This page is informational and not a substitute for medical advice. EFSA recommends no more than 400 mg caffeine per day for healthy adults and not more than 200 mg in a single dose (EFSA Journal 2015;13(5):4102).

Frequently asked questions about caffeine half-life

How long does caffeine stay in the body?
With an average half-life of 5 hours, 25% of the dose is still in your blood after 10 hours, 12.5% after 15 hours, less than 3% after 25 hours. Caffeine is usually fully cleared after 24 - 36 hours, but can persist much longer in pregnant women or oral-contraceptive users.
When should I have my last coffee?
Rule of thumb: no 95 mg cup later than 6 - 8 hours before bedtime. If you go to bed at 23:00, the last regular filter coffee should be at 15:00 - 17:00. For stronger drinks (energy drinks, double espresso) cut off earlier. The calculator gives you the exact value for your settings.
Why does caffeine barely affect me?
You likely developed tolerance: regular consumption upregulates adenosine receptors, so the same dose has less effect. There are also genetically fast CYP1A2 metabolizers who halve caffeine in 2 - 3 hours. A 7 - 14 day break largely resets tolerance.
What is the maximum daily caffeine dose?
EFSA recommends a maximum of 400 mg per day for healthy adults and not more than 200 mg in a single dose. Pregnant and breastfeeding women should not exceed 200 mg per day. Children and adolescents should keep below 3 mg per kilogram of body weight.
Does cold turkey help?
Quitting abruptly often triggers headache, fatigue and concentration problems 12 - 48 hours after the last dose. Tapering over 1 - 2 weeks is gentler — for example replacing one cup per day with decaf.
Are my entries private?
Yes. The calculation runs entirely in your browser; your drinks and times are not sent to a server. We can see neither what nor when you consume.

Related tools