All Categories
😴 Sleep Tools
😴 Sleep Calculator Wake-Up Calculator 💤 Nap Calculator 👶 Baby Sleep Calculator 📉 Sleep Debt Calculator Caffeine & Sleep Calculator ✈️ Jet Lag Calculator 📋 Sleep Quality Quiz

☕ 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.

Not sure? Start with "average." If you sleep fine after a 5pm coffee, you may be a fast metaboliser.

Caffeine Facts

5–7h
Caffeine half-life in average adults
20%
Deep sleep reduction from late-day caffeine (EEG study)
95mg
Caffeine in a standard filter coffee
400mg
Safe daily caffeine limit for healthy adults (FDA)
Caffeine metabolism slowdown during pregnancy

Sources: FDA, NIH, Walker (2017)

Caffeine Content by Drink

Caffeine half-life chart showing how caffeine clears from your system over time
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.

Caffeine Genetics

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

Fast Metaboliser ~40–50% of people
Half-life: 3–4h
Can typically handle coffee until 5–6 PM without sleep impact.
🔄
Average Metaboliser ~30–40% of people
Half-life: 5–7h
Should stop caffeine by 2–3 PM for a 11 PM bedtime.
🐢
Slow Metaboliser ~15–20% of people
Half-life: 8–12h
Even noon coffee can affect deep sleep. Caffeine sensitivity is high.
⚠️
Very Sensitive Hormonal OC, CYP1A2 inhibitors
Half-life: up to 16h
Hormonal birth control can double caffeine half-life. Morning-only caffeine recommended.

Frequently Asked Questions

Caffeine tolerance reduces the stimulant feel of caffeine — the alertness boost becomes less pronounced. However, multiple studies show that tolerance does NOT reduce caffeine's suppressive effect on deep sleep. Regular coffee drinkers lose the same amount of deep sleep from late-day caffeine as non-drinkers, but don't notice the sleep disruption as obviously.

Decaf contains 2–15mg of caffeine per cup (depending on brand and preparation), versus 95–200mg in regular coffee. For most people, decaf has minimal sleep impact, especially when consumed before 7 PM. For those with very slow caffeine metabolism, even decaf in the afternoon could have minor effects.

Caffeine metabolism is primarily controlled by the CYP1A2 gene. Fast metabolisers (roughly 40–50% of the population) process caffeine twice as quickly as slow metabolisers, with a half-life of 3–4 hours versus 6–10 hours. Fast metabolisers genuinely sleep better after late caffeine — but slow metabolisers who think they're tolerant are often simply failing to notice the deep sleep reduction.

Most pre-workout supplements contain 150–400mg of caffeine — equivalent to 2–4 espressos. If you train in the evening, your pre-workout could be delivering significant caffeine within hours of bedtime. Switch to a stimulant-free pre-workout for evening sessions, or train before 4 PM.

Taper gradually — reduce by 25% per week to avoid withdrawal headaches. Replace afternoon coffees with decaf or herbal tea. Drink a large glass of water first thing in the morning (dehydration worsens fatigue). Get outdoor light within 1 hour of waking — it's more effective than coffee at setting your circadian clock.

Even when caffeine doesn't prevent you from falling asleep, it silently suppresses Stage 3 deep sleep (slow-wave sleep). A 2023 double-blind EEG study found that caffeine consumed 6 hours before bed reduced deep sleep by ~20% — with no subjective awareness of the disruption. Over weeks, this accumulates into significant sleep debt and cognitive impairment despite what feels like adequate sleep.

If your caffeine half-life is 6 hours and you drink a 200mg coffee at 2 PM: at 8 PM you still have 100mg active; at 2 AM 50mg remains. The threshold for sleep disruption is roughly 25–50mg. This is why even afternoon coffee affects the quality of overnight deep sleep — not just how easily you fall asleep.

For the average adult, stopping caffeine 6 hours before bedtime is the minimum. For sensitive individuals or slow metabolisers, 8–10 hours is safer. If you go to bed at 11:00 pm, your latest coffee should be around 3:00–5:00 pm. The calculator on this page gives you your exact cut-off based on your metabolism type and bedtime.

Yes — green tea contains 25–50 mg of caffeine per cup (versus 80–120 mg in coffee) and also contains L-theanine, an amino acid that promotes calm alertness and partially counteracts caffeine's stimulating effects. However, green tea still contains enough caffeine to disrupt sleep for sensitive individuals. For sleep-safe evening drinks, choose chamomile, peppermint, or rooibos tea — all naturally caffeine-free.

Yes — caffeine is one of the most common reversible causes of insomnia. It works by blocking adenosine receptors (adenosine is the chemical that makes you feel sleepy). Even when you feel tired, caffeine in your system prevents the normal sleep pressure from translating into deep sleep. People who struggle to fall asleep or wake frequently during the night should eliminate all caffeine for 2 weeks as a diagnostic test before exploring other causes.

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.