Caffeine outlasts the feeling of caffeine. What the research shows about how long it stays, what it does to a night's sleep, and whether L-theanine changes any of it.
The short answer. Caffeine stays in your body for hours after you stop feeling it, and a large enough dose taken hours before bed can still reduce how long, how deeply and how continuously you sleep. The effect depends heavily on how much you take, and one of the more unsettling findings is that people often don't notice the disruption when it happens. L-theanine, the amino acid in tea, is sometimes described as a way to cancel out caffeine. One small study found a signal in that direction at very low doses. It is not a reason to expect L-theanine to undo an afternoon coffee.
How long does caffeine stay in your body?
Longer than most people assume, and the range between people is wide.
Caffeine half-life — the time it takes your body to clear half of a dose — is typically cited as three to six hours in healthy adults. That average hides a lot of variation. Genetics affects how quickly the liver breaks caffeine down. Oral contraceptives are known to lengthen the half-life. Smoking shortens it.
To make the arithmetic concrete, here is an illustration using a five-hour half-life. It is a round number chosen for the example, not a prediction for your body:
- A coffee at 2 p.m.
- By 7 p.m., about half of that caffeine is still in circulation.
- By 10 p.m., about a third of it is.
The point is not the exact fraction. The point is that caffeine does not leave when the alertness wears off. The feeling fades well before the chemical does.
Does afternoon coffee really affect sleep?
The research on caffeine and sleep is more consistent than most sleep advice, and it points in one direction: yes, it can, and dose matters as much as timing.
What the pooled evidence shows. A 2023 systematic review and meta-analysis in Sleep Medicine Reviews pooled 24 studies of caffeine and nighttime sleep. Across those studies, caffeine reduced total sleep time by an average of 45 minutes and sleep efficiency by 7%. It also lengthened the time taken to fall asleep by about 9 minutes, added about 12 minutes of wakefulness after sleep onset, and reduced time spent in deep sleep.
The same review built a statistical model of when caffeine stops affecting total sleep time. For a standard cup of coffee — about 107 mg of caffeine — the model's estimate was at least 8.8 hours before bed. For a typical pre-workout supplement at around 217 mg, it was 13.2 hours. For a cup of black tea, the model did not find a cutoff at all.
Worth being clear about what that 8.8-hour figure is: a model-derived estimate averaged across studies, not a measured threshold and not a rule. The authors themselves describe their cutoffs as a starting point to adjust from, because people differ.
What a controlled trial added. A randomized, double-blind crossover trial published in Sleep in 2025 tested two doses — 100 mg, roughly one ordinary coffee, and 400 mg — taken 12, 8 or 4 hours before bed, with sleep measured at home using a partial polysomnography device.
The 100 mg dose produced no significant change in sleep at any of the three times, objective or self-reported.
The 400 mg dose did. Taken four hours before bed, it cut measured sleep time by about 50 minutes and deep sleep by about 30 minutes. Taken 12 hours before bed — first thing in the morning for most people — it still delayed the onset of settled sleep and reduced deep sleep by about 20 minutes. The authors' recommendation was to avoid 400 mg as a single dose within 12 hours of bedtime. They note that 400 mg is roughly four standard coffees, and that it is easy to reach in a day with larger café drinks, energy drinks or pre-workout products.
One important limit: the trial enrolled 23 men with an average age of 25. The authors say directly that the results may not carry over to women, whose caffeine metabolism can differ with hormonal contraception, or to adults over 40, who have been shown to be more susceptible to caffeine's effect on sleep.
The earlier study everyone cites. A 2013 study in the Journal of Clinical Sleep Medicine gave 12 healthy adults 400 mg of caffeine at bedtime, three hours before, or six hours before. All three disrupted sleep compared with placebo. Even at six hours, measured total sleep time fell by more than an hour. It is a small study, at a high dose, and it is often quoted without either of those details.
Would you notice if caffeine were affecting your sleep?
Not reliably, and this is the finding worth remembering.
In the 2025 trial, 400 mg taken four or eight hours before bed significantly increased the time participants spent awake during the night, as measured by the device. Participants did not report any increase in waking. When 400 mg was taken eight or twelve hours before bed, their own ratings of sleep quality did not change either, even though the device recorded measurable differences.
When asked the next morning what they had taken and when, fewer than a quarter of participants correctly identified both the dose and the timing.
The 2013 study found the same pattern: at six hours before bed, the disruption appeared on the monitor but not in participants' sleep diaries.
The practical meaning is modest but real. "Coffee doesn't affect my sleep" is a statement about what you notice, which is not quite the same as what happens. You may not reliably notice the effect caffeine is having.
Why can tea feel different from coffee?
Part of the answer is simply the dose. A cup of black tea carries roughly 47 mg of caffeine against about 107 mg in a cup of brewed coffee, which is why the 2023 model found no cutoff time for tea.
Tea also contains L-theanine, an amino acid found almost nowhere else in the diet. (We have written separately about how L-theanine is studied.) Whether the L-theanine in a cup of tea changes how its caffeine affects sleep is a different question, and the next section is about that.
Can L-theanine cancel out caffeine at night?
This is the claim you will find in supplement marketing, so it is worth looking at exactly what has been tested.
The human study. In 2023, researchers published a crossover study in Food & Function in a small group of healthy young women. On separate nights, participants took 50 mg of theanine alone, 30 mg of caffeine alone, both together, or a placebo, and their sleep was measured with EEG.
Caffeine alone significantly increased the time spent awake after first falling asleep, compared with placebo. When caffeine was taken together with theanine, that increase was not seen — the combination did not differ from placebo. Neither caffeine nor the combination changed how long it took to fall asleep or how many times participants woke up. Theanine on its own did not differ from placebo on the measures reported.
Four things matter when reading this:
- The caffeine dose was 30 mg — less than a third of a standard cup of coffee. The study says nothing about what happens at 100, 200 or 400 mg.
- "Not different from placebo" is not the same as "significantly lower than caffeine alone." The reported finding is that the combination was indistinguishable from placebo, which is suggestive, not a demonstration that theanine reversed anything.
- The population was narrow: a small group of healthy young women.
- Two of the three authors work at the central research institute of ITO EN, a major green tea company. That does not make the result wrong. It is context worth having, the same way we note funding on every other study we cite.
The animal study. A 2012 study in rats gave caffeine followed by different doses of L-theanine. L-theanine did not reverse the increase in wakefulness caused by caffeine. At lower doses, it partly restored the deep sleep that caffeine had reduced; at higher doses, it did not. The authors' own conclusion was that the effect on caffeine-induced sleep disturbance was partial.
Read together. There is a signal, it is small, it was found at a dose of caffeine far below what most people drink, and the one human study comes from a company with an interest in tea. There is no good evidence that taking L-theanine in the evening undoes the effect of an afternoon coffee. If caffeine is affecting your sleep, the change that has evidence behind it is the caffeine itself.
What actually helps
Not a universal cutoff time. Every figure above came from a specific dose, in specific people, under specific conditions, and none of them tells you where your own line is.
What the evidence does support is thinking in three variables at once:
- Dose. In the 2025 trial, 100 mg and 400 mg behaved like different substances. A large café coffee, an energy drink or a pre-workout serving can carry far more than one standard cup.
- Timing. The closer to bed, the larger the effect — but at high doses, morning is not automatically safe.
- You. Genetics, age, hormonal contraception and how much caffeine you normally drink all move the numbers.
It also helps to count the caffeine you don't think of as caffeine: tea, cola, energy drinks, pre-workout products, some pain relievers, and chocolate in larger amounts.
And because people don't reliably notice caffeine's effect on their sleep, the most useful experiment may be the simplest one: move your last caffeine earlier, or make it smaller, for a week or two, and see whether anything about your nights or mornings changes.
What this does not tell you
- It does not give you a safe cutoff time. The 8.8-hour figure is a model-based average for one standard cup of coffee, and the 2025 trial's recommendations come from 23 young men.
- It does not show that L-theanine counteracts caffeine at the doses people commonly drink. The one human study used 30 mg of caffeine.
- It does not show that tea is better for sleep than coffee. Tea has less caffeine per cup, and that alone explains most of the difference in the studies above.
- It does not tell you how your own body handles caffeine. Half-life varies several-fold between people.
- It does not apply in the same way during pregnancy, with certain medications, or with medical conditions that affect sleep or caffeine metabolism.
Before you act on any of this
This article is general education. If you are pregnant, take prescription medication, or have a sleep problem that persists, talk to your healthcare provider or pharmacist rather than adjusting things based on a web page.
Sources
- Gardiner C, Weakley J, Burke LM, Roach GD, Sargent C, Maniar N, Townshend A, Halson SL. The effect of caffeine on subsequent sleep: a systematic review and meta-analysis. Sleep Med Rev. 2023;69:101764. https://doi.org/10.1016/j.smrv.2023.101764
- Gardiner CL, Weakley J, Burke LM, Fernandez F, Johnston RD, Leota J, Russell S, Munteanu G, Townshend A, Halson SL. Dose and timing effects of caffeine on subsequent sleep: a randomized clinical crossover trial. Sleep. 2025;48(4):zsae230. https://doi.org/10.1093/sleep/zsae230
- Drake C, Roehrs T, Shambroom J, Roth T. Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. J Clin Sleep Med. 2013;9(11):1195–1200. https://doi.org/10.5664/jcsm.3170
- Baba Y, Takihara T, Okamura N. Theanine maintains sleep quality in healthy young women by suppressing the increase in caffeine-induced wakefulness after sleep onset. Food Funct. 2023;14(15):7109–7116. https://doi.org/10.1039/d3fo01247f
- L-theanine partially counteracts caffeine-induced sleep disturbances in rats. Pharmacol Biochem Behav. 2012. https://pubmed.ncbi.nlm.nih.gov/22285321/