How Caffeine Affects Sleep, and How Late Is Too Late

Caffeine works by blocking adenosine, a chemical that builds up in the brain the longer you’re awake and gradually makes you feel sleepy. That’s exactly why the morning cup helps. The trouble starts later, because caffeine doesn’t switch off when you stop noticing it. A dose that wore off hours ago, as far as you can tell, can still be sitting in your bloodstream at bedtime and quietly changing how you sleep.
Caffeine leaves the body slowly
The useful number here is the half-life: the time it takes your body to clear half of the caffeine you consumed. A review published by the National Academies puts the average half-life in healthy adults at about five hours, with a range from roughly 1.5 to 9.5 hours depending on the person. In practical terms, if you drink a strong coffee at 3 p.m. and you’re an average metabolizer, around half of it is still circulating at 8 p.m., and a meaningful share remains when you turn off the light.
The effect also adds up. A second cup in the early afternoon lands on top of whatever is left from the first, so the amount in your system at night depends on your whole day’s intake and its timing, not just the last drink.
What the research says about timing
One of the most cited studies on this question was published in the Journal of Clinical Sleep Medicine in 2013 by researchers at Henry Ford Hospital and Wayne State University. Healthy sleepers took 400 mg of caffeine (a large dose, roughly what you’d find in several cups of brewed coffee) at bedtime, three hours before bed or six hours before bed. Even the dose taken six hours ahead cut their total sleep by more than an hour when sleep was measured objectively at home.
The detail that tends to surprise people is that participants mostly didn’t notice. Their own reports of how they slept didn’t match what the monitoring showed. Based on the results, the authors suggested avoiding substantial caffeine for at least six hours before bedtime. The study was small, and the dose was high, so it’s best read as a sensible floor rather than a precise rule for everyone.
That gap between feeling and measurement matters. Plenty of people say an evening espresso has no effect on them because they fall asleep easily. Falling asleep is only one part of the picture, though. Caffeine can also shorten total sleep and make it lighter, which shows up the next day as grogginess that’s easy to blame on something else.
Why your cutoff may differ from a friend’s
The FDA notes that people vary widely both in how sensitive they are to caffeine and in how quickly they eliminate it. Much of the clearing is done by a liver enzyme called CYP1A2, and several ordinary factors push its speed up or down. According to the Harvard T.H. Chan School of Public Health, smoking speeds up the breakdown of caffeine, while pregnancy and oral contraceptives slow it. Genetics play a part as well, as do some medications and medical conditions, which is one reason two people with identical coffee habits can sleep very differently.
If you’re pregnant, take hormonal contraception, or have recently quit smoking (which removes the speed-up), the same afternoon coffee you’ve always had may now be lingering much longer.
Caffeine you might not be counting
Coffee gets the attention, but a late-day dose often comes from somewhere less obvious. Common culprits include:
- Black, green and oolong tea, including iced tea with dinner
- Cola and other sodas, plus energy drinks and pre-workout powders
- Dark chocolate and chocolate or coffee-flavored desserts
- Decaf coffee, which the FDA says typically contains 2 to 15 mg in an 8-ounce cup
- Some over-the-counter pain relievers and other medicines that list caffeine as an ingredient
Labels help only partly. The FDA requires packaged foods to list caffeine in the ingredients when it’s added on its own, but stating the amount is voluntary, and caffeine that comes naturally from an ingredient such as chocolate isn’t listed separately. Restaurants and coffee shops aren’t required to tell you how much is in a drink at all.
Finding your own cutoff over two weeks
Because the right time varies so much, the most reliable answer comes from testing it on yourself. Start by writing down, for a few ordinary days, everything with caffeine that you eat or drink and the time you have it, along with your bedtime, roughly how long it took to fall asleep and how rested you felt the next morning. That baseline shows you where your last dose actually falls, which is often later than people assume once tea and soda are counted.
Next, set a firm cutoff at least six hours before your usual bedtime, so a 10:30 p.m. bedtime means nothing after about 4:30 p.m. Keep your morning amount the same, so you’re changing one thing at a time. Hold that for a full week and keep the same notes. A few nights aren’t enough, because sleep varies for many other reasons, from stress to a late meal.
If you see no difference, you can try moving the cutoff earlier still, to around noon, for another week. If sleep improves, you’ve found your answer. If it doesn’t change at either cutoff, caffeine timing probably isn’t the main thing affecting your nights, and it’s worth looking at other habits such as screen use, alcohol and an irregular schedule.
When you cut back, do it gradually if you’re a heavy user. Stopping abruptly can bring headaches and tiredness for a few days, which can make the experiment feel like a failure when it’s really withdrawal.
When to talk to a doctor
If you’ve moved your caffeine well into the morning and still struggle to fall or stay asleep most nights for weeks, mention it to a doctor. Ongoing insomnia, loud snoring, gasping during the night or heavy daytime sleepiness can point to conditions that need their own treatment. A doctor or pharmacist is also the right person to ask if you take medication that might contain caffeine or change how you process it, or if you’re pregnant and unsure how much is reasonable for you.