Caffeine and sleep: how your coffee affects your night
Caffeine disrupts sleep even when you don't feel it. See how it works, caffeine's half-life, when to stop before bed, and how to check what's left at bedtime.

Caffeine can disrupt your sleep even when you fall asleep fine. It has a half-life of about 5 hours, so an afternoon coffee is still working at bedtime. In one study, 400 mg of caffeine taken 6 hours before bed cut total sleep by more than an hour, and people did not notice. A good rule is to stop caffeine at least 6 hours before bed, or 8 to 10 hours if you are sensitive or a slow metabolizer.
How caffeine affects sleep
Caffeine works by blocking adenosine, the chemical that builds up while you are awake and makes you feel sleepy. Caffeine does not remove that sleep pressure, it just masks it. When the caffeine wears off, the backlog is still there.
Even when caffeine does not keep you awake, it changes the quality of your sleep. A review of 24 studies found caffeine cut total sleep time by about 45 minutes, lowered sleep efficiency, increased light sleep, and reduced deep sleep (the slow-wave stage that does most of the physical restoration). So you can sleep a full night on caffeine and still wake up feeling like you did not rest, which sends you back to the coffee. That loop is the trap.
Caffeine's half-life (why an afternoon coffee follows you to bed)
Half-life is how long it takes your body to clear half a dose. For caffeine it is about 5 hours on average. That means if you drink a coffee with about 95 mg at 3pm, roughly 48 mg is still in you at 8pm, and about 30 mg at 11pm.
| Hours after your coffee | Caffeine left (from ~95 mg) |
|---|---|
| 0 hours (just drank it) | ~95 mg |
| 5 hours | ~48 mg |
| 10 hours | ~24 mg |
Your own half-life can range from about 2 to 10 hours. It is slower if you are pregnant, take oral contraceptives, have liver conditions, or take certain medications, and faster if you smoke. That is why the same afternoon coffee wrecks one person's sleep and not another's. More in how long caffeine stays in your system. Bigger doses, like a strong energy drink, leave even more behind.
When should you stop drinking caffeine before bed?
- The research-backed minimum: 6 hours. In the main study (Drake et al., 2013), every timing tested, including 6 hours before bed, measurably reduced sleep. So 6 hours is the latest defensible cutoff, not a guaranteed safe one.
- If you are sensitive or a slow metabolizer: 8 to 10 hours. For a typical 11pm bedtime, that means a cutoff somewhere between early and mid afternoon.
- A simple rule of thumb: no caffeine after about 2pm, and see how your sleep responds.
For a step-by-step way to set your own cutoff, see when to stop drinking caffeine before bed.
Don't want to guess? See exactly how much caffeine is still in your system at bedtime, and the latest time to have your last cup, with the free Caffeine and Sleep Calculator.
Signs caffeine is hurting your sleep
- You lie awake even though you feel tired.
- You fall asleep fine but wake at 2 or 3am.
- You sleep a full night and still wake up groggy.
- You need coffee to function, which pushes caffeine later into the day, which disrupts sleep more. The loop feeds itself.
Not sure how much you drink in a day? Add it up with the Caffeine Calculator.
How to fix it without quitting cold turkey
You do not have to give up coffee to sleep better. Start by moving your last cup earlier, or cutting just the afternoon one. Swap a late coffee for decaf so you keep the ritual without the caffeine. If you want to come down further, a gradual taper lets you reduce the total without the withdrawal headache, and the Withdrawal Calculator shows what to expect. The free Knuckle app turns what you drink now into a day-by-day plan for exactly this.
Sources
- Drake et al., 2013: Caffeine Effects on Sleep Taken 0, 3, or 6 Hours before Going to Bed (Journal of Clinical Sleep Medicine)
- Gardiner et al., 2023: The effect of caffeine on subsequent sleep: A systematic review and meta-analysis (Sleep Medicine Reviews)
- FDA: Spilling the Beans: How Much Caffeine is Too Much?
Written by Mike Zagare · Published · Updated
Mike Zagare is the founder of Knuckle. He tapered off a 500 to 600mg-a-day habit and built Knuckle from that protocol. Reviewed against FDA, EFSA, and ACOG guidance.
Common questions
How long before bed should I stop drinking caffeine?
At least 6 hours, which is what research supports. If you are sensitive or clear caffeine slowly, aim for 8 to 10 hours.
Does caffeine affect sleep even if I fall asleep fine?
Yes. It reduces deep sleep and lowers sleep quality even when it does not keep you awake, and most people do not notice.
How long does caffeine stay in your system?
It has a half-life of about 5 hours, so a meaningful amount can linger 8 to 10 hours, longer for slow metabolizers.
Does afternoon coffee affect sleep?
Often yes. A 3pm coffee can still have around a third of its caffeine in you at bedtime.
Can I drink coffee and still sleep well?
Many people can, if they stop early enough. Use the Caffeine and Sleep Calculator to find your cutoff.
Related tools
Related articles
Join the waitlist and get the free quit guide
The Knuckle app opens in Q4 2026. Sign up and we'll send the day-by-day quit guide now, plus one note the day the app is ready.