Caffeine and Sleep: How Many Hours Before Bed to Stop
A doctor explains how many hours before bed you should stop caffeine, how much is still in your body at 3, 6, 9 and 12 hours, and how to cut down safely.
See a doctor promptly if
- Palpitations, chest pain or a fast heartbeat that carries on after the caffeine should have worn off
- Fainting or near fainting after an energy drink or a pre workout powder
- Severe anxiety, tremor, repeated vomiting or panic symptoms after a high caffeine product
- Needing more caffeine every week to stay awake at work or at the wheel
- Loud snoring or choking in sleep with daytime sleepiness that caffeine is covering up
- Insomnia that continues for a month after a proper caffeine cut back
The short version
- Stop caffeine about eight hours before bed. Make it ten to twelve hours if you sleep lightly.
- Caffeine has a half life near five hours. A 2pm coffee still leaves about a quarter in you at midnight.
- Caffeine can cut deep sleep even when you fall asleep normally. Sleeping fine is not proof it wore off.
- Tea, cola, chocolate, energy drinks and some headache tablets all carry caffeine. Count them before blaming coffee.
Check your sleep2 min, free, nothing to install

The question people actually type is a number. How many hours before bed should the last coffee be? There is a good answer, and there is a reason it comes as a range rather than one figure.
The short answer#
For most healthy adults, stop caffeine about eight hours before bed. If you sleep lightly, wake in the night, or already suspect caffeine, move the cut-off to ten or twelve hours.
Turn that into a clock time instead of a feeling. Work back from the hour you usually fall asleep, not the hour you get into bed.
| Your usual sleep time | Standard cut-off, 8 hours | Cautious cut-off, 10 hours | Sensitive sleeper, 12 hours |
|---|---|---|---|
| 9:00 pm | 1:00 pm | 11:00 am | 9:00 am |
| 10:00 pm | 2:00 pm | 12:00 noon | 10:00 am |
| 11:00 pm | 3:00 pm | 1:00 pm | 11:00 am |
| 12:00 midnight | 4:00 pm | 2:00 pm | 12:00 noon |
Eight hours is the floor, not the ideal. It is the point where most people stop losing measurable sleep. Plenty of people need longer.
Half life, and why the honest answer is a range#
Caffeine is cleared by the liver. The half life is the time your body needs to remove half of a dose. In healthy adults it averages about five hours.
Half life stacks up in a way people underestimate. Here is what is left after a single 200 mg dose, which is about two 8 oz (240 mL) mugs of brewed coffee.
| Time since the dose | Share still in your body | Amount left from 200 mg |
|---|---|---|
| 3 hours | about 66 percent | about 130 mg |
| 6 hours | about 44 percent | about 87 mg |
| 9 hours | about 29 percent | about 57 mg |
| 12 hours | about 19 percent | about 38 mg |
Look at the 12 hour row. Nearly 40 mg is still circulating, which is about the caffeine in a cup of black tea. Almost nobody would drink tea at bedtime on purpose.
That table assumes an average five hour half life. Real half lives range from about two hours to more than ten. The range in the advice exists because the range in people is real.
Who clears caffeine slowly#
Several things stretch the half life, sometimes doubling it.
- Genetics. The liver enzyme that breaks caffeine down comes in fast and slow versions. Slow clearers feel an afternoon coffee at midnight.
- Pregnancy. Clearance slows sharply, and the half life in late pregnancy can reach ten hours or more.
- Hormonal contraceptives. These roughly double how long caffeine hangs around in many users.
- Liver disease. A liver under strain clears caffeine more slowly.
- Some medicines. Certain antibiotics, some antidepressants and some heart rhythm drugs slow caffeine clearance.
- Age. Clearance drifts down over the decades, and deep sleep is more fragile to begin with.
Smoking pushes the other way and can nearly halve the half life. That matters when someone quits, because the same coffee habit suddenly hits much harder.
Never stop or change a prescription medicine to test any of this. Ask your own doctor or pharmacist whether one of your medicines is slowing your caffeine clearance.
Where caffeine hides#
People cut coffee and keep the source that was doing the damage. These are typical amounts.
| Source | Usual serving | Caffeine |
|---|---|---|
| Brewed coffee | 8 oz (240 mL) | 80 to 100 mg |
| Espresso | 1 oz (30 mL) shot | 60 to 75 mg |
| Instant coffee | 8 oz (240 mL) | 60 to 80 mg |
| Decaf coffee | 8 oz (240 mL) | 2 to 15 mg |
| Black tea | 8 oz (240 mL) | 40 to 50 mg |
| Green tea | 8 oz (240 mL) | 25 to 45 mg |
| Cola | 12 oz (355 mL) | 30 to 45 mg |
| Energy drink | 8 to 16 oz (240 to 475 mL) | 80 to 300 mg |
| Dark chocolate | 1 oz (28 g) | 12 to 25 mg |
| Headache tablets that list caffeine | 1 to 2 tablets | 30 to 130 mg |
| Pre workout powder | 1 scoop | 150 to 350 mg |
Why caffeine wrecks sleep quality without stopping sleep#
Through the day a molecule called adenosine builds up in the brain and creates the feeling of sleepiness. Caffeine sits on the same receptors and blocks the signal. It hides tiredness rather than removing it. The adenosine is still waiting when the caffeine fades, which is the afternoon crash.
Because the effect is on sleep pressure itself, caffeine damages sleep even when it does not stop you dropping off. In one well known trial, a dose six hours before bed cut about an hour of total sleep. Most people did not notice.
Two other effects matter:
- Less deep sleep. Slow wave sleep is the stage that does most of the physical restoration. It is the stage caffeine cuts first.
- A later body clock. Evening caffeine can delay the body's own melatonin rise by around 40 minutes, so bedtime drifts later.
The most common form of caffeine damage is lighter, thinner sleep in someone who insists coffee has no effect on them.
What a caffeine cut-off cannot fix#
Caffeine is a big lever, and it is not the only one. A cut-off time cannot tell you whether something else is at work.
Poor sleep that survives a proper caffeine experiment is worth a different look. Common alternatives are insomnia in its own right, sleep apnea, restless legs, low mood, pain, alcohol in the evening, menopause symptoms and thyroid problems. Alcohol deserves a special mention. It shortens the time to fall asleep and then fragments the second half of the night, which reads exactly like a caffeine problem.
If you keep waking at 3am despite a clean afternoon, the pattern is pointing somewhere else.
How to cut down without three days of headache#
Stopping suddenly causes headache, irritability, poor concentration and fatigue. Symptoms usually start 12 to 24 hours after the last dose, peak on day one or two, and settle within two to nine days.
A slower path avoids nearly all of it.
- Cut by about a quarter every three or four days. Two weeks of steps beats one bad weekend.
- Keep the morning cup. Move the last one earlier instead of removing the first one.
- Blend down. Mix regular and decaf in the same mug and shift the ratio each week.
- Swap the late drink, do not just delete it. Decaf, herbal tea or sparkling water keeps the habit and drops the drug.
- Drink water and eat properly during the taper. Skipped meals make the headache worse.
- Judge the result at three weeks, not three days. Withdrawal ending and sleep improving are separate events.
What a doctor does next#
If sleep stays broken after a real caffeine experiment, a doctor works through a short list.
They take a sleep history, including bedtime, wake time, naps, alcohol and shift patterns. A two week sleep diary usually reveals more than any test. They ask about snoring, choking in sleep and witnessed pauses in breathing, which point toward sleep apnea and a sleep study.
Blood tests are limited but useful: thyroid function, a full blood count and ferritin, since low iron drives restless legs. Mood and anxiety get screened, because both cause early waking. Your medicine list gets reviewed for stimulating drugs.
For long standing insomnia, the treatment with the strongest evidence is a talking therapy called CBT for insomnia, not a sleeping tablet.
At work#
Shift workers get the hardest version of this problem. Caffeine is a real safety tool on a night shift, and it is also the thing wrecking the daytime sleep that follows.
The useful rule is to keep caffeine in the first half of the shift and stop it by the mid point. On a shift ending at 7am, a 5am coffee is still working at noon, when you are trying to sleep. Bright light late in the shift does some of the same job with no cost to sleep.
Energy drinks are the bigger risk on industrial sites. A single large can can carry 300 mg, and people drink two. That is enough for tremor, palpitations and shaky hands on precision work.
Drowsy driving after a night shift needs caffeine plus a 20 minute nap, not caffeine alone. Needing more caffeine each week to stay safe points to the roster or an untreated sleep disorder. Occupational health should hear about it.
What I see most often in clinic#
Three patterns turn up again and again.
The first is the person who swears they sleep fine after evening coffee. They do fall asleep. They also wake unrefreshed every day and cannot explain why. Cutting the evening dose changes the morning, not the falling asleep.
The second is the hidden source. Someone stops coffee at noon, then drinks four mugs of strong tea after dinner and takes a caffeine containing headache tablet at bedtime.
The third is quitting too fast. Day two brings a bad headache, the person decides caffeine was never the problem, and the coffee comes back stronger than before.
I also see the opposite mistake. People blame caffeine for insomnia that turns out to be untreated sleep apnea or an anxiety disorder. Caffeine is worth fixing first because it is cheap and quick, but a month of no improvement means look further.
When to see a doctor#
Book a routine appointment for any of these:
- Insomnia that lasts a month after a proper caffeine cut back.
- Loud snoring, choking in sleep, or daytime sleepiness that caffeine is masking.
- Tremor, anxiety or a racing heart that continues once the caffeine should have gone.
- Needing more caffeine every week to get through work or a drive.
- Sleep that is broken by pain, low mood, hot flushes or frequent night urination.
Get urgent care for chest pain, fainting, a fast heart that will not settle, or repeated vomiting after a high caffeine product.
The bottom line#
Stop caffeine about eight hours before bed, and ten to twelve hours if your sleep is fragile. Caffeine has a half life near five hours, so an afternoon coffee is still measurable at midnight. It damages deep sleep more reliably than it delays falling asleep, which is why people who sleep after coffee still wake up tired. Count every source, cut down in steps over two weeks, and judge the result three weeks later rather than three days later.
Give your sleep a quick check
Three answers, honest ones.
Before you buy anything for sleep
No gadget fixes sleep apnea. But if your score above suggests a sleep study, a simple pulse oximeter can give your doctor useful overnight numbers for under $30.
Buying through this link supports the free library with a small commission. It never changes a pick.
A question about your own situation?
One question, answered personally by a doctor in writing within 24 hours.
Common questions
How many hours before bed should I stop drinking caffeine?
How long does caffeine actually stay in your body?
I fall asleep fine after coffee. Is it still affecting me?
How much caffeine is too much?
Does decaf coffee have caffeine in it?
Why do I get a headache when I stop caffeine?
Does caffeine affect sleep more as you get older?
People also ask
Not what you were looking for?
Say what you came for and we will take you there.





