Skip to content
The Long ViewFaith, history and everyday life
Health & Mind

Caffeine and sleep

Caffeine has a half-life of 4 to 6 hours and can take 12 hours or more to clear. Learn how dose and timing affect sleep, and when to stop drinking coffee.

Caffeine and sleep
Photo acekreations / Pixabay

Caffeine has a half-life of 4 to 6 hours on average, and it takes 12 hours or more to clear completely. A coffee in the afternoon can therefore still be active in your body after midnight. How much it disturbs sleep depends on the dose, the timing and the person.

At a glance

4 to 6 hours: average half-life of caffeine

12 hours or more: time for full elimination

8 to 10 hours: cutoff before planned bedtime suggested by a sleep guide

2 to 10 hours: the range of half-lives across individuals

How caffeine affects sleep

The mechanism is simple. Through the day, your brain accumulates adenosine, a neurotransmitter that tells it you are getting tired. Caffeine blocks the receptors adenosine would normally use. The signal still exists, but it does not get through.

The result shows up in several ways. Falling asleep becomes harder. Sleep can be broken into pieces. Deep sleep can shrink, even when you drift off at your usual hour. That last point matters, because a person can fall asleep on time and still lose some of the most restorative part of the night.

The size of the effect is not fixed. It depends on how much caffeine you took and how long before bed you took it. The sections below put numbers on both, using a randomized crossover trial published in the journal Sleep in 2024.

Key figuresCaffeine half-life in the body4 to 6hoursTime for complete caffeine elimination12 or morehoursOptimal cutoff time before sleep8 to 10hoursVariation in caffeine half-life among individuals2 to 10hours

How long caffeine stays in your body

The half-life is the time it takes for half of a substance to fade from the body. For caffeine, that is 4 to 6 hours on average. It sounds short, but half is not all. The other half is still there, and it keeps working on the same receptors while it is slowly cleared. Complete elimination takes 12 hours or more.

Also read: Better sleep habits that actually help

A concrete example from Houston Methodist makes this visible. Take 200mg of caffeine in mid-afternoon. By the time you go to bed, a large share has been cleared, yet measurable caffeine remains after midnight.

The 200mg example, step by step

  1. Mid-afternoon: 200mg of caffeine is consumed.
  2. After 4 to 6 hours: on average, half has faded from the body.
  3. After midnight: caffeine is still measurable.
  4. After 12 hours or more: elimination is complete.

There is also a trap in how we judge ourselves. Many people say they sleep fine despite their evening coffee. That feeling does not cancel the effect on sleep quality. Caffeine can change how the night is built without making you feel that anything went wrong. Not noticing a change is different from there being none.

When to stop drinking caffeine

A sleep guide from The Sleep Math puts the optimal cutoff at 8 to 10 hours before your planned bedtime. That is an average guide, not a rule that fits every body. The Sleep journal trial shows why the margin is that wide: the effect grows with the dose.

What the trial observed, by dose and timing

Light 100mg, up to 4 hours before bed: no significant effect on the sleep that follows.

Moderate 200mg, 6 hours before bed: a measurable reduction in deep sleep.

Strong 400mg, within 8 hours of bed: much greater fragmentation of sleep.

Strong 400mg, within 12 hours of bed: a later start of sleep and a changed sleep architecture.

Read together, these results tell a consistent story. A small dose taken early leaves sleep largely intact. A medium dose a few hours before bed starts to take a bite out of deep sleep. A large dose can still reach into the night when it was drunk much earlier in the day than most people expect.

Note what “sleep architecture” means here: the way the night is organized into its different stages. When that structure shifts, the hours in bed may add up the same, but the sleep inside them is not the same.

Why it differs from one person to the next

The 4 to 6 hour half-life is an average. Across individuals, a systematic review of epidemiological studies and randomized controlled trials found it can run from 2 to 10 hours. Two people drinking the same cup at the same time can be in very different situations by evening.

What shifts the clock

Genes: CYP1A2 helps set the half-life, from 2 to 10 hours depending on genotype. Variants in genes tied to adenosine signaling, notably ADORA2A, contribute to individual sensitivity.

Age: the sleep of older adults is more sensitive to caffeine than that of young adults.

Medications: antidepressants and oral contraceptives are among the factors that influence how long caffeine lasts.

Lifestyle and body: smoking, alcohol, obesity and liver function also play a role.

Other factors: ethnicity, sex and weight modulate the effects of caffeine.

Two different layers are at work. Some factors change how fast the body clears caffeine, which is the half-life. Others change how strongly the brain reacts to the caffeine that remains, which is sensitivity. The CYP1A2 gene belongs to the first group. The ADORA2A variants belong to the second. A person can be affected on either level, or both.

This is why a friend who drinks espresso after dinner and sleeps soundly is not proof of anything for you. Their timing and yours can be far apart.

Practical ways to think about your own limit

Because averages hide so much, the most useful tool is observation. Notice how long it takes to fall asleep and how you feel in the morning on days when you drink caffeine later, compared with days when you stop earlier. A simple note kept over a few weeks can reveal a personal pattern that no general guide can supply.

It also helps to count every source of caffeine, not just coffee. Tea, sodas, chocolate and certain medications can all add to the total. A cup of tea after lunch and a soda in the afternoon may together amount to more than the one coffee you were counting.

Age and medication belong in the picture as well. If you are older, or if you take drugs such as antidepressants or oral contraceptives, caffeine may stay longer or act more strongly than the average figures suggest. The cutoff of 8 to 10 hours is a reasonable starting point for many people, not a promise that fits everyone.

Finally, keep the limits of this article in mind. It describes what research has documented about caffeine and sleep. It does not diagnose or treat sleep problems. Persistent trouble sleeping is a question for a doctor or another qualified health professional, who can look at your whole situation.

Sources

Oxford Academic, Sleep journal (2024): “Dose and timing effects of caffeine on subsequent sleep: a randomized clinical crossover trial”. Consulted December 1, 2026.

PubMed: “Coffee, caffeine, and sleep: A systematic review of epidemiological studies and randomized controlled trials”. Consulted December 1, 2026.

The Sleep Math: “Caffeine & Sleep: What Science Says”. Consulted December 1, 2026.

Examine.com: “Coffee timing isn’t one-size-fits-all”. Consulted December 1, 2026.

Houston Methodist: “Caffeine & Sleep: How Long Does Caffeine Last & Keep You Awake?”. Consulted December 1, 2026.

Nora Ellison

Written by

Nora Ellison

Health, science and nature

Nora covers health habits, the night sky and the natural world. She explains research in plain words, cites it, and reminds readers that a doctor who knows them comes before any article.

More from Nora

Keep reading in Health & Mind

The whole section
Health & Mind

Hearing loss: early signs

Asking people to repeat themselves or turning up the TV? Learn the early signs of hearing loss and why a hearing test with an…

Health & Mind

Screen time and sleep

Each extra hour of screen time is linked to 3 to 5 fewer minutes of sleep, and 24 minutes in bed. See how light…