Caffeine and sleep
Caffeine blocks adenosine, the chemical that builds sleep pressure during the day. On average, your body clears half of the caffeine in about 5 hours, but this ranges from about 2 to 10 hours between people. That is why an afternoon coffee can still be working at bedtime.
This calculator uses a 5 hour half-life to estimate how much caffeine is left when you go to bed.
Frequently asked questions
How long before bed should I stop caffeine?
A common rule is at least 6 to 8 hours. Caffeine's half-life is about 5 hours on average, so half of it is still in your body 5 hours later.
Does decaf have caffeine?
A little, usually 2 to 15 mg per cup. It is unlikely to affect sleep for most people.
Does caffeine affect sleep even if I fall asleep fine?
It can reduce deep sleep even when you fall asleep easily.
Updated October 20, 2026