☕ Caffeine & Sleep Calculator — Last Safe Time to Drink Coffee
Find the last safe time to drink coffee or tea so caffeine doesn't wreck your sleep — based on your bedtime and metabolism.
Caffeine Facts
Sources: FDA, NIH, Walker (2017)
Caffeine Content by Drink
| Drink | Caffeine | Half gone by |
|---|---|---|
| Espresso (single) | 63mg | 5–6h later |
| Filter coffee (1 cup) | 95mg | 5–6h later |
| Flat white / latte | 150–180mg | 6–7h later |
| Energy drink (250ml) | 80mg | 5–6h later |
| Large energy drink (500ml) | 160mg | 6–7h later |
| Cold brew (12oz) | 200–300mg | 7–8h later |
| Black tea (1 cup) | 47mg | 4–5h later |
| Green tea (1 cup) | 28mg | 3–4h later |
| Cola (330ml) | 34mg | 3–4h later |
| Dark chocolate (30g) | ~20mg | 3–4h later |
How Caffeine Disrupts Sleep
Caffeine works by blocking adenosine receptors. Adenosine is the brain's sleep-pressure chemical — it builds up throughout the day and drives the urge to sleep. Caffeine doesn't reduce adenosine; it simply blocks the receptors that sense it. When caffeine wears off, all the accumulated adenosine floods the receptors at once — the classic "caffeine crash."
The critical insight: even when caffeine no longer keeps you awake, it continues to reduce slow-wave deep sleep as measured by brain activity monitors. A 2023 double-blind study showed that 400mg of caffeine taken 6 hours before bed caused a 20% reduction in deep sleep without any subjective sleep quality difference reported by participants.
The sleep debt cycle: Caffeine → reduced deep sleep → more daytime fatigue → more caffeine → less deep sleep → compounding debt. Breaking this cycle requires 5–7 days of caffeine restriction while sleep rebuilds.
Why Your Friend Can Drink Coffee at 8 PM and You Can't
Caffeine metabolism is primarily controlled by the CYP1A2 gene. People with the fast-metaboliser variant (roughly 40–50% of the population) process caffeine at nearly twice the rate of slow metabolisers, with a half-life of just 3–4 hours versus 7–10 hours.
For a fast metaboliser who drinks coffee at 5 PM: by 9 PM their caffeine levels are already minimal. For a slow metaboliser drinking the same coffee: significant caffeine remains active at 2 AM — silently suppressing deep sleep even if they fall asleep easily.
You can't get tested cheaply, but your sleep pattern tells you: if afternoon coffee consistently doesn't affect your sleep, you're likely a fast metaboliser. If even morning coffee seems to affect sleep quality, you may be a very slow metaboliser — often linked to hormonal contraceptive use, which inhibits CYP1A2.
Caffeine Metabolism Types
Frequently Asked Questions
How Late Is Too Late to Drink Coffee?
The general rule supported by research (including a 2013 study in the Journal of Clinical Sleep Medicine): avoid caffeine within 6 hours of your intended bedtime. However, this is an average. Fast metabolisers (CYP1A2 fast allele) may tolerate coffee up to 3–4 hours before bed. Slow metabolisers and those with caffeine sensitivity should cut off 8–10 hours before bed. The calculator uses your selected metabolism speed to give you a personalised cut-off time rather than a one-size-fits-all rule.
Caffeine Calculator for Night Shift Workers
Night shift workers face a particular caffeine challenge: they need to stay alert during the shift but must sleep during the day. The key strategy: use caffeine strategically in the first half of the shift only. If your shift runs 10 pm–6 am, limit caffeine to before 2:00 am. A second tactic is the "caffeine nap" — drink a coffee immediately before a 20-minute nap. By the time you wake, the caffeine has been absorbed and you get the combined benefit of both. Avoid caffeine within 6 hours of your planned daytime sleep period.
Does Decaf Coffee Affect Sleep?
Decaffeinated coffee still contains 2–25 mg of caffeine per cup (compared to 80–120 mg in regular coffee). For most people, this small amount is negligible. However, highly sensitive individuals or those with slow caffeine metabolism may notice even decaf disrupts sleep when consumed in the evening. Decaf also contains chlorogenic acids and other compounds that can slightly elevate cortisol. For the best sleep, switch to herbal tea (not green or black tea) after 6 pm.