Quick answer: For most adults, the safest plan is to have your last coffee about 8 to 9 hours before bed. A big review found a regular cup of coffee should be finished at least 8.8 hours before bedtime to protect your sleep. If you go to bed at 10pm, that means your last cup around 1pm.
I love a good coffee. Most of us at HealthHQ do. But coffee is sneaky. It can still be working in your body long after the cup is empty. Let's look at how long it lasts, when to stop, and simple swaps that help you sleep better.
How does caffeine keep you awake?
All day, your brain builds up a "sleepy" signal. The longer you are awake, the stronger it gets. Caffeine blocks that signal for a while. So you feel more alert, even though your body still needs rest.
That is great at 8am. It is not so great at 10pm, when you want the sleepy signal to do its job.
How long does caffeine stay in your body?
Longer than most people think. Scientists talk about half-life. That is the time it takes your body to clear half of the caffeine.
- The European Food Safety Authority says the average half-life in healthy adults is about 4 hours, with a range of 2 to 8 hours.
- So if you have a coffee at 3pm, a good chunk of it can still be in your body at bedtime.
- Older adults often clear caffeine more slowly, according to the American Academy of Sleep Medicine's Sleep Education site.
Everyone is different. Some people clear caffeine fast. Others are still buzzing hours later.
How late can you drink coffee and still sleep well?
In 2023, researchers pulled together 24 studies on caffeine and sleep. Here is what they found:
- Caffeine cut total sleep time by about 45 minutes.
- It took people about 9 minutes longer to fall asleep.
- People spent about 12 minutes more awake during the night.
- Deep sleep went down by about 11 minutes.
From this, they suggested a cut-off. A standard cup of coffee (about 107 mg of caffeine) should be finished at least 8.8 hours before bed. A typical pre-workout serve (about 217 mg) should be finished at least 13.2 hours before bed.
NZ's Healthify site keeps it simple: avoid caffeine after 4pm, or earlier.
Does it matter if I can still fall asleep after coffee?
Yes. This surprises a lot of people. You might fall asleep fine and think coffee does not affect you. But the 2023 review found caffeine also reduced deep sleep, the stage many people link with feeling rested and recovered.
The Sleep Education site also describes a study where caffeine taken 6 hours before bed still cut total sleep time by about 1 hour.
So "I sleep fine" might really mean "I fall asleep fine". Those are not the same thing.
How much caffeine is in my drink?
It varies a lot. Here are some rough guides:
- Brewed coffee: 95 to 200 mg per cup (Healthify NZ).
- Instant coffee: 27 to 173 mg per cup (Healthify NZ).
- Espresso shot: about 64 mg (Sleep Education).
- Brewed tea: about 47 mg per cup (Sleep Education).
- Energy drink (250 mL): about 80 mg (Healthify NZ).
Don't forget hidden caffeine. Cola, pre-workout, some chocolate and some "focus" drinks all add up.
How much is too much? Healthify NZ says adults should keep caffeine under 400 mg a day. If you are pregnant or breastfeeding, keep it under 200 mg a day. EFSA also notes that even 100 mg close to bedtime may affect sleep in some adults.
How can I cut back on afternoon coffee without feeling flat?
- Set a coffee curfew. Count back about 9 hours from your bedtime. That is your last-cup time.
- Move your big coffee earlier. Have your strongest cup in the morning, not mid-afternoon.
- Swap to decaf or herbal tea after lunch. You keep the ritual without the buzz.
- Get outside. A walk in daylight is a great afternoon pick-me-up. Light also helps your body clock. Read more in our guide to how light affects sleep.
- Drink water. Sometimes that 3pm slump is just thirst.
- Train earlier if you use pre-workout, or try training without it in the evening.
Cut back slowly. Dropping caffeine overnight can leave some people with headaches or low energy for a few days.
If you have a health condition, are pregnant, or take medication, check with your GP or pharmacist about caffeine.
Key takeaways
- Caffeine can stay in your body for many hours. The average half-life is about 4 hours, but it can be up to 8.
- A 2023 review suggests finishing a regular coffee at least 8.8 hours before bed.
- Pre-workout and energy drinks need an even earlier cut-off.
- Caffeine can reduce deep sleep even if you fall asleep fine.
- Adults should stay under 400 mg a day, and under 200 mg if pregnant or breastfeeding.
Frequently asked questions
Does decaf coffee have caffeine?
Yes, a little. Decaf still has a small amount of caffeine, but far less than regular coffee, so it is a good swap for an afternoon cup.
Can I drink coffee and still fall asleep fine?
Some people can. But research shows caffeine can cut your deep sleep and total sleep even when you do not notice it, so falling asleep is not the only thing that matters.
Is tea better than coffee in the afternoon?
A cup of tea usually has less caffeine than a cup of brewed coffee, so it is a gentler choice. Herbal teas like peppermint or chamomile are naturally caffeine-free.
What about energy drinks and pre-workout?
These can carry a big dose of caffeine. One review suggests a typical pre-workout serve should be taken more than 13 hours before bed, so evening training with pre-workout can hurt your sleep.
How much caffeine is too much in a day?
NZ guidance says healthy adults should stay under 400 mg a day, and under 200 mg a day if pregnant or breastfeeding. If you have a health condition or take medication, check with your GP or pharmacist.
Want to build a better wind-down routine? Have a read of our sleep hygiene guide, see whether a sauna can fit into your evening, or browse our sleep range, including blackout sleep masks. Got a question? Call us on 03 662 9381 or email info@healthhq.co.nz. We're always happy to chat.
Sources: Gardiner et al. (2023), The effect of caffeine on subsequent sleep: a systematic review and meta-analysis, Sleep Medicine Reviews; Healthify NZ: Caffeine; American Academy of Sleep Medicine, Sleep Education: Sleep and caffeine; European Food Safety Authority: Caffeine, EFSA explains risk assessment.