← JournalSleep

How late can you have coffee and still sleep well?

4 min read · Updated November 2026

Caffeine can stay in your body for many hours after your last coffee. Here's how long it lasts, how it changes your sleep, how much is too much and when to stop for the day.

Caffeine lasts much longer than the buzz. For most adults, half of the caffeine from a coffee is still in the body around five hours later, and some people clear it far more slowly. A coffee after lunch can still be in your system at bedtime, making it harder to fall asleep and leaving your sleep lighter, even if you drop off without trouble. For most people, stopping caffeine around eight hours before bed is a good starting point.

How caffeine works

Through the day, a chemical called adenosine slowly builds up in the brain. The more of it there is, the sleepier you feel. Caffeine works by blocking adenosine from doing its job, which is why a coffee makes you feel more awake.

The catch is that the adenosine is still there. Caffeine only masks it. When the caffeine wears off, the tiredness you were holding back can arrive all at once, which is part of why many people reach for a second or third cup.

Why an afternoon coffee affects your night

How long caffeine lasts varies a lot from person to person. Genes, age, pregnancy, some medications and liver health all change how quickly it's cleared. Two people can drink the same coffee at the same time and feel completely different effects that night.

Even when you fall asleep easily, caffeine can still change the quality of your sleep. It tends to reduce deep sleep, the stage when much of the body's overnight repair happens, and it can make sleep lighter and more broken. The hours on the clock look the same, but you wake feeling less rested.

That's one reason the number of hours you sleep only tells part of the story. Our article on sleep quality versus hours explains why how you sleep matters as much as how long.

How much caffeine is in your drinks

Caffeine adds up faster than most people think, and it isn't only in coffee. These are rough amounts, and they vary with the brand, the size and how it's made.

  • A cafe coffee, often about 100 to 200 mg, more with an extra shot
  • A cup of instant coffee, about 60 to 80 mg
  • A cup of black tea, about 30 to 50 mg
  • A 250 ml energy drink, about 80 mg
  • A can of cola, about 30 to 40 mg
  • Dark chocolate and some pre workout powders and pain relievers contain caffeine too

Many health authorities suggest that up to about 400 mg a day is fine for most healthy adults. Pregnant women are usually advised to stay under about 200 mg a day. But for sleep, the time of your last dose matters as much as the total.

Signs caffeine is getting in the way of your sleep

  • Lying awake for a long time after getting into bed
  • Waking often through the night, or feeling like you never sleep deeply
  • Feeling wired at night but flat in the morning
  • Needing caffeine just to feel normal, and getting headaches without it
  • A racing heart or jittery feeling in the evening

If that pattern of being exhausted in the day but alert at night sounds familiar, our article on feeling tired but wired covers the other common reasons.

Small changes that help

You don't have to give up coffee to sleep better. These changes tend to make a real difference.

  • Set a caffeine cut off of about eight hours before bed, and stick to it for two weeks
  • Wait an hour or so after waking before your first coffee, so you're not starting the day already behind
  • Swap afternoon coffees for decaf, herbal tea or water
  • Check labels on energy drinks, pre workout products and some medicines
  • Cut back slowly over a week or two if you drink a lot, to avoid headaches and low energy

Keep a simple note of when you have caffeine and how you sleep. Many people find their worst nights line up closely with a late coffee or an energy drink.

When it's worth a proper look

If you're relying on caffeine to get through the day, it's worth asking why you're so tired in the first place. Poor sleep, stress, training load, blood sugar, iron, thyroid function and breathing problems at night can all leave you running on empty. Caffeine can hide the problem without fixing it.

A doctor can look at your sleep and energy alongside the rest of your health and suggest what to check first, including bloodwork if it's needed. At UHD BioHealth you can start with a free health questionnaire. An AHPRA registered doctor at our partner medical practice reviews your answers, usually within 24 hours, and your written plan lists every cost before you decide anything. You only pay if you choose to go ahead.

If you have chest pain, a very fast or irregular heartbeat, or feel faint, seek medical help straight away or call 000.

Common questions

How long does caffeine stay in your body?

For most adults, half of the caffeine from a drink is still in the body about five hours later, and some people clear it much more slowly. That means a coffee at 3pm can still be working at 9pm or later, even if you don't feel wired.

What time should I stop drinking coffee?

A common rule of thumb is to have your last caffeine at least eight hours before bed. For someone who goes to sleep at 10.30pm, that means finishing coffee, strong tea, cola and energy drinks by around lunchtime or early afternoon.

How much caffeine is too much?

Many health authorities suggest that up to about 400 mg a day is fine for most healthy adults, which is roughly three to four cups of coffee. Pregnant women are usually advised to keep it to about 200 mg a day. For sleep, the timing matters as much as the total.

Talk to a doctor

Lying awake at 3am

An in-depth health questionnaire covering your history, symptoms, medications and lifestyle, read by an AHPRA-registered doctor within 24 hours. Bloodwork where it's needed, and a written plan before you pay anything.

General health information only, not medical advice. Complete our questionnaire and a doctor will assess whether a consult is right for you. Individual needs and outcomes vary. In an emergency, call 000.

Keep reading
How it worksStart assessment →