Caffeine works by blocking adenosine, the molecule that builds up while you are awake and creates sleep pressure. Blocking it does not remove the pressure; it hides it. That is why a late coffee can let you fall asleep and still leave you with a lighter, more fragmented night. The half-life of caffeine in most adults is roughly five hours, which makes the timing of the last cup a simple calculation.
What half-life means in practice
Half-life is the time it takes for the body to clear half of a substance. With a five-hour half-life, a coffee containing a hundred milligrams of caffeine leaves about fifty milligrams at five hours, twenty-five at ten hours, and roughly twelve at fifteen hours. That last figure is not zero, and twelve milligrams is enough to affect sleep in sensitive people.
If you drink that coffee at three in the afternoon, you still have around twenty-five milligrams at eight in the evening and twelve at one in the morning. The number is small, but it is arriving exactly when adenosine should be doing its most useful work.
Why you can fall asleep anyway
Regular caffeine users develop tolerance, so the same dose produces less alertness and less sleep disruption than it would in a new user. Falling asleep quickly after an evening coffee therefore proves less than it seems. Studies measuring sleep architecture find reduced deep sleep and more awakenings even when subjective sleep quality looks normal.
That is the trap: the effect is invisible from the inside. You wake up after seven hours and feel fine, while the deep sleep that supports physical recovery was thinner than it should have been.
Choosing a cut-off time
A common recommendation is to stop caffeine eight to ten hours before bed. For a bedtime of eleven, that means a last cup around one or two in the afternoon. People who are slow metabolisers, which includes many people on oral contraceptives and some genetic variants, may need a longer window.
A practical approach: move the cut-off one hour earlier each week and note how you sleep. Most people find a natural point where the change stops mattering, and that is their personal cut-off.
Where the caffeine hides
Coffee is the obvious source, but tea, cola, energy drinks, chocolate, and some painkillers also contain caffeine. A large energy drink can carry more than a double espresso, and a strong afternoon tea can match a small coffee. If you are cutting off coffee but drinking cola at nine, the calculation is unchanged.
Decaf is not zero, but it is low enough that timing rarely matters. Herbal teas are caffeine-free, which makes them the simplest evening substitute.
What to do if you need the afternoon cup
If the afternoon coffee exists to fight a slump, the slump itself is worth addressing. A short walk, daylight, and a glass of water often do more than caffeine for early-afternoon drowsiness. A twenty-minute nap, if your schedule allows it, is more effective and does not affect the night.
If you are using caffeine to compensate for short sleep, the caffeine is treating a symptom. Our guide to caffeine cut-off covers the timing side of the same problem.
When caffeine is not the issue
Cutting caffeine does not fix insomnia on its own. If you have stopped caffeine early and still lie awake, look at light exposure, schedule consistency, and stress before blaming coffee. Persistent sleep problems deserve clinical assessment.
This is general information, not medical advice. Sleep Foundation on caffeine and sleep reviews caffeine's effects on sleep in more detail.
Frequently asked questions
How long does caffeine stay in your system?
The half-life is about five hours for most adults, so a quarter of the dose is still present ten hours later. Slow metabolisers may take considerably longer.
What time should I stop drinking coffee?
Eight to ten hours before bed is a safe default, which means early to mid afternoon for most people. Adjust earlier if you are sensitive or sleep poorly.
Can I drink coffee and still sleep well?
You may fall asleep, but deep sleep and continuity are often reduced even when you do not notice. Tolerance hides the effect rather than removing it.
Does decaf affect sleep?
Decaf contains small amounts of caffeine but rarely enough to matter for most people. Herbal tea is the safer evening choice.
Read next
Sleep and Obesity: Breaking the Shared Cycle
Short sleep makes weight loss harder, not just less likely.