How late can you drink coffee and still sleep?
For most people, the last cup should come at least eight hours before bed. What the research says, and why your own cutoff may be earlier or later.

Key takeaways
Aim for about eight to nine hours. A 2023 review of 24 studies found a regular cup of coffee should be finished at least 8.8 hours before bed, which is around 2pm for an 11pm bedtime.
Six hours is the most familiar rule. The NHS says no tea or coffee within six hours of bed, but a well-known study found a large dose six hours before bed still cut sleep by more than an hour.
You may not notice all of it. In that study, people’s own sleep diaries recorded a smaller loss than the monitor did.
Caffeine lasts longer in some people than others. It takes about five hours on average to clear half of it, and anywhere from about 1.5 to 9.5 hours depending on genes, the pill and smoking, and longer still in pregnancy or with some medicines.
Bigger doses need more time. A large dose, like a pre-workout supplement, should come 13 hours or more before bed.
When to have your last coffee
If you go to bed around 11pm, finish your last regular cup of coffee by about 2pm. That’s the cutoff from a 2023 review of the research, which found that a typical cup should come at least 8.8 hours before bed to avoid cutting into sleep.
The more familiar advice is six hours. That’s the gap the NHS recommends, and it’s better than nothing. But six hours isn’t long enough for everyone, especially after a strong coffee, and the research behind the six-hour rule is where the case for going earlier comes from.
What the six-hour study found
In a 2013 study at the Henry Ford Hospital sleep center, 12 healthy adults took 400 mg of caffeine (roughly two to three cups of coffee) either right at bedtime, three hours before or six hours before, and a placebo at the other times. A monitor worn at home measured their sleep.
Caffeine cut sleep at all three times, including six hours before bed, by more than an hour. The authors advised avoiding a substantial amount of caffeine for at least six hours before bedtime, which backs up the familiar rule. Their own result suggests that even six hours wasn’t enough at that dose.
At the six-hour mark, the participants’ sleep diaries showed a smaller loss than the monitor recorded, about 41 minutes, which wasn’t statistically significant. The caffeine was costing them sleep, and they didn’t notice all of it.
Where the 8.8-hour figure comes from
A 2023 review in Sleep Medicine Reviews pooled 24 studies of caffeine and sleep. On average, caffeine shortened sleep by 45 minutes, added nine minutes to the time it took to fall asleep and 12 minutes of time awake during the night, and reduced deep sleep.
From the dose and timing data, the authors worked out how far before bed a drink needed to be to avoid cutting total sleep time: at least 8.8 hours for a cup of coffee with about 107 mg of caffeine, and at least 13.2 hours for a pre-workout supplement with about 218 mg. They called those figures a starting point, and said they’re meant to be adjusted to each person’s own sleep.
Why caffeine lasts so long
Through the day, a chemical called adenosine builds up in your brain and adds to the pressure to sleep. Caffeine works by blocking the receptors adenosine acts on, so you feel less sleepy than you otherwise would.
Your liver doesn’t clear caffeine quickly. Its half-life, the time it takes your body to get rid of half of it, is about five hours on average. So if you have a cup at 3pm, around half its caffeine is still in your system at 8pm, and a quarter at 1am.
Why your cutoff may be different
That five-hour average hides a wide range. A review of the research put caffeine’s half-life anywhere from about 1.5 to 9.5 hours, depending on the person. A few things shift it:
Genes. Most caffeine is broken down by one liver enzyme, and how active it is runs in families. Some people clear caffeine quickly, and others hold onto it for much longer.
Pregnancy. Caffeine clears more slowly as pregnancy goes on, taking up to about 15 hours late in pregnancy.
Birth control pills. Oral contraceptives can make caffeine last noticeably longer.
Smoking. Smokers clear caffeine faster, so after quitting, the same coffee leaves more caffeine in the blood.
Liver disease. Cirrhosis can slow clearance sharply.
Some medicines. The antidepressant fluvoxamine and certain antibiotics slow how quickly your body clears caffeine. A pharmacist can tell you whether anything you take does this.
Age matters too, though in two directions. In a 2015 study, middle-aged adults lost more sleep than young adults after a large dose of caffeine in the evening. But a 2025 study from the University of Montreal, which gave 40 adults caffeine in the hours before bed, found caffeine changed the brain’s activity during REM sleep more in people aged 20 to 27 than in those aged 41 to 58.
How much caffeine is in your drink
The cutoff depends on how much caffeine you have, not only when. Typical amounts, from Mayo Clinic’s caffeine guide:
Drink | Size | Caffeine |
|---|---|---|
Brewed coffee | 8 oz | 96 mg |
Espresso | 1 oz | 63 mg |
Black tea | 8 oz | 48 mg |
Green tea | 8 oz | 29 mg |
Cola | 8 oz | 33 mg |
Energy drink | 8 oz | 79 mg |
Decaf brewed coffee | 8 oz | 1 mg |
Coffee varies a lot. The FDA puts a 12-ounce cup of brewed coffee at 113 to 247 mg, and decaf at 2 to 15 mg per 8 ounces. Dark chocolate (70% to 85% cacao) has caffeine too, about 23 mg an ounce. A large coffee-shop coffee can carry as much caffeine as the dose that cost people an hour of sleep in the six-hour study.
What if you drink coffee every day?
Regular drinkers may get used to some of caffeine’s effects on sleep, though the evidence is mixed. In a 2021 study, 20 young men who drank caffeine regularly took three doses a day for nine days, the last about eight hours before bed. It didn’t change how long they slept or how much deep sleep they got, though it made small changes to their brain activity during sleep. The 2023 review noted that tolerance to caffeine’s effects on sleep hasn’t been clearly shown in people.
So a daily habit doesn’t make a late coffee safe. It’s better to test your own cutoff than to assume you’re immune.
How to find your own cutoff
Count back eight to nine hours from your usual bedtime and make that your last coffee, then adjust over a couple of weeks.
Move the cutoff earlier for strong drinks, large cups, energy drinks and pre-workout supplements.
Switch to decaf or herbal tea in the afternoon if you want the ritual without most of the caffeine.
Watch for hidden caffeine in tea, cola, some pain relievers and chocolate.
If you’re pregnant, take the pill or use any medicines that slow caffeine clearance, set an earlier cutoff and talk to your doctor about how much caffeine is right for you.
If you’ve cut out afternoon caffeine and still can’t fall asleep or stay asleep, the cause may be something else. Waking in the early hours has its own set of causes, which we cover in why you wake up at 3am.
Frequently asked questions
Is 2pm too late for coffee?
For an 11pm bedtime, 2pm is about the latest a regular cup should come, based on the 8.8-hour figure. If you go to bed earlier, or your coffee is strong, aim for late morning or lunchtime instead.
Can I drink coffee at 4pm and still sleep?
Many people can fall asleep, but they may sleep less or less deeply without knowing it. At 4pm, a cup would be seven hours before an 11pm bedtime, and in the 2013 study caffeine still cut sleep by more than an hour when taken six hours before bed.
Does decaf coffee affect sleep?
Very little for most people. Decaf has 2 to 15 mg of caffeine per 8-ounce cup, compared with around 100 mg in regular coffee. If you’re very sensitive to caffeine, even that may be enough to notice late at night.
How long does caffeine stay in your system?
About five hours to clear half of it, on average, and longer in some people. It takes several half-lives for nearly all of it to leave, so a morning coffee is mostly gone by bedtime and an afternoon one may not be.
Why can some people drink espresso before bed and still sleep?
Some people clear caffeine faster because of their genes, and regular drinkers may adapt to some of its effects. But as the 2013 study found, people often underestimate how much sleep caffeine costs them, so falling asleep easily doesn’t mean caffeine had no effect.









