Better Sleep

Caffeine and sleep: why timing matters

Caffeine blocks a chemical called adenosine that builds up sleep pressure through the day, and it can remain active in the body for many hours after it is drunk. Cutting off caffeine in the early-to-mid afternoon is a sensible default for most people, though individual sensitivity varies considerably and hidden sources are easy to miss.

6 min read · Published 24 September 2026

A cup of coffee on a desk in the afternoon light

In short

  • Caffeine works by blocking adenosine, a chemical that builds sleep pressure, rather than by adding energy.
  • Its half-life is roughly five to six hours on average, meaning a meaningful amount can still be active at bedtime.
  • An early-to-mid afternoon cut-off is a reasonable default, though sensitive individuals need to stop earlier.
  • Genetics, age, liver function, pregnancy and regular use all affect how quickly someone clears caffeine.
  • Tea, chocolate, cola, energy drinks and some painkillers all contain caffeine and are easy to overlook.

Caffeine is the most widely used stimulant in the world, and for most people a morning cup causes no problems at all. The trouble is timing: caffeine does not clear out of the body as quickly as its short-lived alertness boost might suggest, and a dose taken in the afternoon can still be partly active by the time you go to bed.

Understanding roughly how caffeine works, and how long it lingers, makes it easier to set a sensible personal cut-off rather than following a one-size-fits-all rule.

How caffeine works

Across the day, a molecule called adenosine gradually builds up in the brain, and rising adenosine is one of the main drivers of the sleepiness that increases the longer you have been awake, sometimes called sleep pressure. Caffeine works by blocking the receptors that adenosine would normally bind to, which is why it makes you feel more alert rather than by supplying extra energy. Crucially, caffeine does not stop adenosine building up; it only masks the effect for as long as it remains active in the body.

This matters for sleep because once caffeine wears off, any adenosine that built up in the meantime is still there, which is part of why a late caffeine hit can be followed by a crash. It also means caffeine taken too close to bedtime can directly interfere with falling asleep, independent of anything else going on that evening.

Half-life, explained simply

Half-life is the time it takes for the amount of a substance in the body to fall by half. For caffeine, the average half-life is often quoted at around five to six hours, though it varies a good deal between individuals. That means if you drink a coffee at three in the afternoon, roughly half of its caffeine may still be active in your system at eight or nine in the evening, and a smaller but real amount later still.

  • One half-life: around half the caffeine remains active.
  • Two half-lives: around a quarter remains active.
  • Three half-lives: around an eighth remains active, but this can still be enough to disturb sleep in sensitive people.

Setting a sensible afternoon cut-off

A widely used rule of thumb is to avoid caffeine from roughly early-to-mid afternoon onwards, commonly cited as around 2pm for people who drink caffeine regularly and are moderately sensitive to it. This is a reasonable starting point rather than a fixed rule. Someone who is more sensitive, or who is already struggling with sleep, may need to stop earlier, while someone with high habitual tolerance and no sleep complaints may be able to have a small amount later without noticing an effect.

The most reliable way to find your own cut-off is to experiment: try moving your last caffeine intake progressively earlier over a couple of weeks and notice whether falling asleep, or the amount of night waking, changes. This pairs naturally with keeping other habits steady, as described in An evening routine you can actually maintain, so that caffeine is not the only variable changing.

Diagram illustrating how caffeine levels in the body decline gradually over several hours after being consumed
Caffeine clears gradually rather than switching off, which is why afternoon intake can still be present at bedtime.

Why sensitivity varies so much between people

Genetic differences in how quickly the liver metabolises caffeine mean some people are naturally slow metabolisers and others fast, and this alone can shift a safe cut-off time by several hours. Age also plays a role, as caffeine tends to be cleared more slowly in older adults, which is touched on in Melatonin and sleep in older adults. Pregnancy slows caffeine clearance considerably, smoking speeds it up, and certain medicines can also interact with how caffeine is processed, so general guidance is only ever a starting point.

Regular daily use builds a degree of tolerance to caffeine's alerting effects, but tolerance to its impact on sleep is less complete, meaning long-term coffee drinkers are not necessarily protected from disrupted sleep if they drink it too late.

Hidden sources of caffeine

Coffee is the obvious source, but caffeine turns up in plenty of other places that are easy to underestimate when counting up a day's intake.

  • Tea, including green and white tea, which contain meaningful caffeine even though less than coffee.
  • Cola and other fizzy soft drinks.
  • Energy drinks and some pre-workout products, which can contain very high doses.
  • Chocolate and cocoa-based drinks, particularly dark chocolate.
  • Some over-the-counter painkillers and cold and flu remedies that include caffeine as an ingredient.

Checking labels, particularly for energy drinks and combination painkillers, is worthwhile if evening or night-time sleep problems persist despite avoiding obvious coffee late in the day.

A worked example of moving a cut-off

Take someone who has a coffee at half past three every afternoon and struggles to fall asleep before midnight, despite going to bed around eleven. If caffeine's average half-life is applied loosely, a meaningful amount could still be active at eleven, and a smaller amount later still. Moving that same coffee to just after lunch, say half past twelve, gives the body roughly three extra hours to clear it before the person tries to sleep, which for someone of average sensitivity could be the difference between lying awake and drifting off within a reasonable time.

This kind of small, deliberate shift, tried consistently for a couple of weeks rather than a single night, is a more informative test than simply cutting caffeine out altogether and not knowing which change actually helped.

Caffeine tolerance and withdrawal

Regular caffeine users can develop tolerance to some of its effects, meaning a given amount produces less of an alerting boost over time. This is separate from the question of sleep disruption, and reducing or shifting caffeine intake to protect sleep does not require giving it up altogether. People who do cut back sharply sometimes notice short-term withdrawal symptoms such as headache or low mood for a few days, which is a normal, temporary adjustment rather than a sign that caffeine reduction was the wrong choice.

Tapering caffeine down gradually, rather than stopping abruptly, tends to make this adjustment period more manageable for people who are used to drinking it regularly through the day.

Caffeine, anxiety and racing thoughts at night

Beyond its direct effect on adenosine, caffeine can also heighten feelings of alertness and mild anxiety in some people, which can make racing thoughts at bedtime more likely even once the main stimulant effect has faded. This overlaps with, but is distinct from, the worry management strategies discussed in Daytime habits that influence sleep, and people who notice both wired alertness and racing thoughts at night may find it worth addressing caffeine timing and evening wind-down together rather than treating them as separate problems.

Caffeine, pregnancy and other special circumstances

Pregnancy is one of several circumstances where general caffeine advice does not straightforwardly apply, since caffeine is cleared from the body considerably more slowly, meaning both total intake and timing may need reconsidering. Similarly, some medicines and health conditions affect how caffeine is processed. Rather than relying on general population averages, anyone in one of these situations is better served asking a GP or pharmacist for advice tailored to their own circumstances.

Managing caffeine in social and work situations

Afternoon meetings, social catch-ups over coffee, and workplace habits such as an automatic post-lunch coffee round can make sticking to a personal cut-off harder than it sounds in principle. Simple substitutions, such as choosing a decaffeinated version or an herbal drink in the same format, let you keep the social routine without the late caffeine, and are usually an easier long-term solution than trying to opt out of the ritual altogether.

Common questions

Does decaf coffee still contain caffeine?

Yes, decaffeinated coffee contains small amounts of caffeine, though far less than regular coffee. This is unlikely to matter for most people but is worth bearing in mind if you are highly sensitive.

Will cutting caffeine completely improve my sleep?

For people who currently drink caffeine late in the day, or in large amounts, adjusting timing often helps more than eliminating it altogether. For people with persistent insomnia, caffeine is rarely the only factor, and What is sleep hygiene, and what does it actually do? sets out how it fits alongside other habits.

Can caffeine cause night waking as well as trouble falling asleep?

Yes. Because caffeine remains active for hours, it can contribute to lighter, more fragmented sleep in the first part of the night as well as delaying sleep onset, even if the person does not consciously feel wired.

Sources

Written by The Melatonin UK editorial team.

Published 24 September 2026. This article is general information about sleep and the body clock. It is not medical advice, and it does not replace a conversation with your GP or pharmacist.

Read next