For most people, a sensible cut-off for caffeine is early afternoon: roughly eight hours before bed, so around 2pm if you sleep at 10. That is a starting point, not a rule. Caffeine clears from the body at very different speeds in different people, and the only reliable way to find your own limit is to move your last cup earlier for a fortnight and see what happens.
Caffeine works by blocking adenosine, the chemical that builds up while you are awake and produces the feeling of sleep pressure. It does not remove the tiredness; it hides it. When the caffeine wears off, the adenosine is still there, which is why a late coffee can leave you both wired and exhausted.
This guide explains how long it lasts, where it hides, and a simple experiment for working out how late is too late for you.
The half-life, in plain terms
The half-life of a substance is the time it takes for half of it to leave your body. For caffeine, the average is often given as about five hours. So if you have a coffee containing 100mg at 3pm, roughly 50mg is still in your system at 8pm, and about 25mg at 1am. That is a quarter of a coffee circulating in the small hours.
The word "average" is doing a lot of work. Studies put the range of caffeine half-lives at something like two to ten hours, depending partly on genetics, partly on liver enzymes, and partly on other things you take. Pregnancy roughly doubles it. The contraceptive pill and some antidepressants slow it. Smoking speeds it up, which is one reason people who quit sometimes find their usual coffee suddenly hits harder.
So one friend can have an espresso after dinner and sleep like a log, and another finds a 3pm latte keeps them awake. Neither is imagining it.
In short: Half of a coffee is still with you about five hours later, and a quarter after ten. Whether that matters depends on your own chemistry, which is why a personal cut-off beats a general rule.
What caffeine actually does to a night
The obvious effect is taking longer to fall asleep. A well-known 2013 study by Drake and colleagues in the Journal of Clinical Sleep Medicine gave people a 400mg dose (about four cups of coffee) at bedtime, three hours before, and six hours before, and measured their sleep. Even the dose taken six hours before bed cut total sleep by more than an hour on the sleep recordings, though the participants themselves did not notice it as clearly. Those were large doses, but the point stands: caffeine can be shortening your sleep without you feeling it happen.
The less obvious effect is on the quality of the sleep you do get. Caffeine reduces deep sleep and makes the night lighter and more broken, particularly in the second half. If you fall asleep easily but wake around 3 or 4am, or feel unrefreshed after what seemed like enough hours, afternoon caffeine is one of the first things to check. Our guide to waking up in the middle of the night covers the other common causes.
There is a loop here too: poor sleep makes you reach for more caffeine, and more caffeine worsens the sleep. Breaking it usually means a rough week while you shift the intake earlier, then mornings that need less propping up.
Where caffeine hides
Coffee is the obvious source, but people who "only have one coffee" are often having far more caffeine than they think. Approximate amounts, which vary a lot by brand and brew:
- Filter or barista coffee: 80 to 150mg per cup, sometimes considerably more in large chain sizes.
- Instant coffee: around 60 to 80mg.
- Espresso: around 60 to 80mg per shot; a double is two.
- Black tea: 40 to 60mg; green tea around 30 to 50mg.
- Cola: about 30 to 40mg per can. Energy drinks: 80mg or more per can, and some large cans hold two servings.
- Dark chocolate: a large bar can hold 50mg or more; milk chocolate far less.
- Some painkillers and cold remedies: several over-the-counter products combine paracetamol or aspirin with caffeine, sometimes 60mg or more per dose. Check the label if you take something for a headache in the evening.
- Pre-workout powders and some "energy" supplements: often very high, and easy to take late if you train in the evening.
The afternoon tea habit deserves a mention because it is so British. Three or four mugs of tea between lunch and dinner is the caffeine equivalent of two coffees, spread across exactly the hours where it does the most harm.
Finding your own cut-off
Rather than guess, run a two-week experiment.
- Note your baseline. For a few days, write down every caffeinated drink and its time, and roughly how the nights go: how long to drop off, whether you woke, how you felt in the morning.
- Move the last one to 2pm. Keep everything else the same. Do this for a week. If you normally have several late cups, expect a mild headache and some sluggishness for two or three days; that is withdrawal and it passes.
- Judge by the week, not the night. Any single night can be bad for other reasons. Compare the week's average with your baseline.
- Then adjust. If the nights improved, you can try nudging the cut-off later again until you find where the benefit disappears. If they did not change, caffeine timing is probably not your main problem, and you can look elsewhere without giving up something you enjoy.
Morning caffeine is fine, and even useful
None of this is an argument against coffee. In the morning it does no harm to the night ahead for almost everyone. There is a case for waiting an hour or so after waking before the first cup, so that it lands after the body's natural morning alertness rather than on top of it, but the evidence for that is thinner than the internet suggests. Our guide to how your morning routine shapes tonight's sleep covers the things that do matter in the first hour.
The afternoon dip is where the trouble starts. A short nap, a walk outside, or a glass of water handles a 3pm slump better than a coffee that is still working at midnight. If a nap appeals, how to nap without paying for it at night explains the timing.
A note on decaf and switching down
Decaffeinated coffee contains a small amount of caffeine, typically a few milligrams per cup, which is trivial for most people. Switching to decaf after your cut-off keeps the ritual without the chemistry. If you want to reduce overall, halving each cup (mixing regular and decaf) for a week or two avoids the withdrawal headache.
If the coffee is standing in for sleep
Sometimes the problem is not the caffeine but what it is covering for. If you need several coffees to get through an ordinary day despite what seems like enough hours in bed, it is worth asking why the sleep is not doing its job. Our guide to why you feel tired but can't sleep looks at the common reasons, and if daytime sleepiness is persistent it is worth mentioning to a GP, since conditions such as sleep apnoea are often first noticed as unexplained tiredness.
Tonight's version
Have your last caffeinated drink before 2pm today, and swap the afternoon tea for decaf or a herbal one. Keep it up for a fortnight and see how the nights compare. It is one of the simplest changes in the sleep habits guides, and for some people it is the whole answer.
Frequently asked questions
How long does caffeine stay in your system?
On average, about half of a dose is gone after roughly five hours, and a quarter remains after about ten. But the range is wide: for some people the half-life is closer to two hours, for others eight or more. Pregnancy, some medicines and the contraceptive pill slow it down; smoking speeds it up.
Does decaf have caffeine in it?
A little. Decaffeinated coffee typically contains a few milligrams per cup, compared with around 80 to 100 in a regular cup. For most people that is not enough to matter, but if you are very sensitive, several cups of decaf in the evening can add up.
Can caffeine make you wake up at 3am rather than stop you falling asleep?
Yes. Caffeine taken in the afternoon can make the second half of the night lighter and more broken even when you fall asleep fine, because it reduces deep sleep. If you drop off easily but wake in the small hours, an earlier cut-off is worth testing.
Is tea better than coffee for sleep?
A cup of black tea contains roughly half the caffeine of a cup of coffee, so it is gentler, but four cups of tea through the afternoon add up to the same as two coffees. Green tea also contains caffeine. Most herbal teas do not, apart from yerba mate.
Sources and further reading
- NHS: Sleep and tiredness
- Sleep Foundation: Caffeine and sleep
- NHS Every Mind Matters: How to fall asleep faster and sleep better
Written and reviewed by the Quiet Mind Sleep editorial team in line with our editorial policy. Spotted an error? Let us know.