Most people know that coffee and sleep do not mix well late in the day, and the research on caffeine and sleep tries to put numbers on that. What is less clear is how big the effect tends to be in studies, which parts of the night seem to change, and how much of it applies to you personally. This guide walks through what the research on caffeine and sleep suggests, and where it stops being able to tell you anything.
Everything here is an estimate drawn from studies of groups of people. None of it is a prediction for one person.
Does caffeine affect sleep?
In studies, on average, yes. A 2023 systematic review and meta-analysis in Sleep Medicine Reviews pooled 24 studies on caffeine intake and night-time sleep. Compared with no caffeine, caffeine was associated with:
| Sleep measure | Average change with caffeine |
|---|---|
| Total sleep time | about 45 minutes less |
| Sleep efficiency (share of time in bed spent asleep) | about 7 percentage points lower |
| Sleep onset (time to fall asleep) | about 9 minutes longer |
| Time awake after first falling asleep | about 12 minutes more |
These are averages across many people and many designs, so they do not show how any one person responded.
It helps to know what the measures mean. Total sleep time is how long a person actually slept. Sleep efficiency compares that with the time spent in bed, so a lower percentage means more of the night was spent awake. Sleep onset is how long it took to fall asleep. The authors describe most of these changes as clinically meaningful on average, but they are group averages, not predictions for one person.
Common questions about caffeine and sleep
The questions people ask most often have short answers, and each one comes with limits.
Why does caffeine keep you awake at night?
Adenosine is a substance in the body that promotes sleepiness, according to the American Academy of Sleep Medicine, and caffeine blocks its receptors. That is one reason caffeine helps people feel more alert, and a likely reason it can make falling and staying asleep harder when it is still active at night.
The effect is not instant, and it does not switch off at a fixed time. The 2023 review notes that caffeine levels in the blood typically peak between 30 and 120 minutes after intake, and the body then clears it gradually. In the studies, the loss of total sleep time was larger when caffeine was taken closer to bedtime and in larger amounts.
Can caffeine affect deep sleep?
The same 2023 review also looked at sleep stages. Caffeine was associated with more light sleep, about 6 minutes more of stage N1, and with less deep sleep, about 11 minutes less of stages N3 and N4, on average.
That does not mean everyone loses 11 minutes of deep sleep after a coffee. It is an average from studies that often used fixed amounts in controlled settings. It also says nothing on its own about how a change like that feels the next day, or whether it matters for health.
How long does caffeine affect sleep?
The honest answer is a range, because people clear caffeine at different speeds, and clearing speed is not the same thing as how long caffeine can affect sleep. The American Academy of Sleep Medicine gives about 3 to 5 hours for the half-life of caffeine, and the 2023 review notes values of about 2 to 10 hours across healthy adults.
A half-life is the time the body needs to clear half of the caffeine in it. After one half-life about half is left, after two about a quarter, so some caffeine can still be present at bedtime, even when the buzz has faded.
A small home-based study from 2013 suggests that a link with shorter sleep can still appear several hours after caffeine. Twelve healthy adults took 400 mg of caffeine at once (roughly two to three 12 oz cups by the FDA’s figures, and about the daily level the FDA describes as not generally associated with negative effects) at bedtime, 3 hours before, or 6 hours before. Each timing, including 6 hours before bed, was linked to roughly an hour less total sleep on a sleep monitor (1.1 to 1.2 hours). The sleep diaries picked up the effect at bedtime and 3 hours before, but the 6-hour difference people reported was not statistically significant. In other words, the monitor showed less sleep at 6 hours, while the diary difference did not reach the usual threshold for statistical significance (p = 0.08). The sample was small, and the study was supported by a grant from Zeo Inc.
A newer crossover trial from 2025, with 23 young men who had a moderate habitual caffeine intake, tested 100 mg and 400 mg at 4, 8 and 12 hours before bedtime. A 100 mg dose, close to the 107 mg cup in the 2023 model, showed no significant effect on sleep even when taken 4 hours before bedtime. The authors reported that a 400 mg dose may disrupt sleep when taken within 12 hours of bedtime, with greater disruption the closer it is taken. In the polysomnography data, total sleep time dropped by about 51 minutes when 400 mg was taken 4 hours before bed, which was statistically significant, while at 8 and 12 hours the drops were about 30 minutes and did not reach significance. Participants also rated their sleep quality, which dropped when 400 mg was taken 4 hours before bed. It is a small study of one group, so it adds detail to the picture without settling it. One non-significant result does not show that 100 mg never matters: the European Food Safety Authority (EFSA) says single doses of 100 mg may affect sleep duration and patterns in some adults, especially when taken close to bedtime.
For the timing question, see our coffee cutoff guide. For how fast clearance works, see how long caffeine stays in your system.
Is it okay to drink coffee at 5pm?
It depends on lights-out and on the amount. With a 23:00 lights-out, a coffee at 17:00 is 6 hours before bed (our own arithmetic; the authors used a 22:00 example). The 2023 authors suggested at least 8.8 hours for a cup of coffee of about 107 mg per 250 mL, so a 17:00 cup of that size would sit inside that window in the model. That window marks a statistically detectable average drop in sleep time, not necessarily one you would notice. A larger cup would contain more, and the model sets earlier cutoffs for larger amounts. The 2025 trial above found no significant effect for 100 mg, close to this cup size, even at 4 hours, so the two studies do not line up neatly for a cup of about this size, and EFSA notes that 100 mg may still affect sleep in some adults. With a later night or faster clearance the picture could also differ. These are average patterns, not a verdict on any one evening.
What does the research not tell you?
These findings are useful, but they have limits worth keeping in mind:
- They are averages. The review’s authors note that caffeine half-life varies a lot between healthy adults, so the effect on sleep is likely to differ from person to person.
- Amounts and settings differ. Many studies use fixed amounts in controlled conditions. That is not the same as an everyday routine. The FDA lists 113 to 247 mg for a 12 oz cup of brewed coffee, so two “regular coffees” can contain very different amounts.
- Habit and tolerance vary. The studies covered healthy adults who were mostly low to moderate users. The results may not hold for teenagers, older adults, people who rarely have caffeine, or very heavy users.
- Measurement matters. Some of the underlying studies used activity monitors, which can overestimate sleep, and diaries and monitors do not always agree.
- Statistical is not the same as clinical. The authors’ cutoff times mark where a statistically significant drop in sleep length shows up. The authors themselves note that this assumes a statistically significant drop is equivalent to a clinically significant one, so it does not automatically mean a drop you would notice, or one that matters for your health.
- Group comparisons. The studies cannot tell you whether caffeine explains any one bad night, so a poor night after a late coffee does not by itself show the coffee caused it.
So the summary is modest: across the studies, caffeine taken in the hours before bed is linked, on average, with shorter and lighter sleep. Only the loss of total sleep time was reported to grow with larger amounts and shorter gaps before bed. That is the most the research on caffeine and sleep supports with confidence. The research cannot say exactly how much caffeine at which time will affect your own night.
How are these numbers meant to be used?
The authors of the 2023 review describe their cut-off times as a starting point to be adjusted to the effect on one’s own sleep, not as a rule. In that spirit, the numbers here are best read as a way to understand the pattern, not as a verdict on anyone’s habits.
For a rough picture of how much caffeine your usual drinks might leave at night, the caffeine calculator lets you add drinks and move the half-life. If you are pregnant, have a sleep disorder, anxiety or a heart condition, or take medication, a health professional is the right place to ask how caffeine fits in for you.
Sources
- Gardiner C. et al. (2023). The effect of caffeine on subsequent sleep: a systematic review and meta-analysis. Sleep Medicine Reviews 69:101764.
- Drake C. et al. (2013). Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. Journal of Clinical Sleep Medicine 9(11).
- Gardiner C.L. et al. (2025). Dose and timing effects of caffeine on subsequent sleep: a randomized clinical crossover trial. Sleep.
- American Academy of Sleep Medicine, Sleep Education: Sleep and Caffeine.
- U.S. FDA. Spilling the Beans: How Much Caffeine Is Too Much?
- European Food Safety Authority (EFSA). Caffeine (topic page, based on the 2015 Scientific Opinion on the safety of caffeine, EFSA Journal 13(5):4102).



