If you're reading this in bed with the afternoon coffee on your mind, it may help to know that it's leaving you even now. The body clears caffeine steadily, about half of it every three to six hours5 in most healthy adults, so there's a little less of it with every hour you lie here. Worry about sleep can stir up a wakefulness of its own6, just when your body is ready to drop off. There's nothing you need to work out tonight. The coffee question can wait for tomorrow afternoon, when you can do something with it.

Enjoy the honey-heavy dew of slumber. Thou hast no figures nor no fantasies Which busy care draws in the brains of men. Therefore thou sleep’st so sound.
Julius Caesar, by William Shakespeare Act 2, Scene 1, lines 249–252 (Brutus, to the sleeping boy Lucius)

What does caffeine do to make me feel awake?

From the moment you wake, a substance called adenosine gathers in the brain57, and the more of it there is, the sleepier you get. This slow build through the day is what researchers call sleep pressure, and a night's sleep clears it away again. Caffeine blocks the places where adenosine would act57, so the brain stops hearing how tired it is.

That's why the first cup can feel like getting yourself back more than gaining something extra. In people sleeping their usual amount, caffeine mostly restores the alertness that sleepiness had taken away8, and does little to lift anyone above their ordinary best. The adenosine is still there all the while, so when the caffeine fades, the tiredness it was covering is waiting to be felt.

How long does caffeine stay in my system?

Caffeine leaves the body by halves, a little at a time. Its half-life is the time it takes to clear half of what you had. In healthy adults that is typically three to six hours5. Small studies of healthy volunteers have measured averages of about five hours129. Worked out from that average, a coffee at 4pm still has a little more than a third of its caffeine in you at 11pm. A coffee at 8am is down to about an eighth by then.

Around those averages, people vary so widely that published advice on when to stop has ranged from four to eleven hours before bed10. The measured figures come from small groups of healthy volunteers, eight or ten at a time, and your own body may clear caffeine a good deal faster or slower than theirs did.

Why does coffee keep some people up and not others?

Perhaps you know someone who can drink an espresso after dinner and sleep soundly, while a cup at three keeps you awake. Part of the difference is that bodies clear caffeine at very different speeds. The liver's main caffeine enzyme works five to six times harder in some people than in others11, and much of that difference is inherited. Which genes matter is still uncertain512, and a gene test doesn't yet predict your sleep. Paying attention to how you wake will tell you more.

The birth control pill slows caffeine down too. In one small study, women on the pill took about eight hours to clear half their caffeine, against five and a half9 in women not taking it. Fifty years of studies find the same slowing11, so if you take the pill, an afternoon cup is likely to stay with you longer.

Pregnancy stretches it further still, and the slowing begins early311. In the last four weeks, one study measured a half-life of about ten and a half hours3. If you're pregnant, the NHS advises no more than 200 milligrams a day13, about two cups of instant coffee, because more has been linked to a higher chance of miscarriage and stillbirth. Liver disease slows caffeine as well, most of all cirrhosis11, so if you live with it, your cups will last longer too.

Smoking works the other way, speeding caffeine through the body11, which is why stopping can bring a surprise. Researchers followed twelve people who smoked twenty or more cigarettes a day as they stopped all at once. Their clearance of caffeine fell by about a third14. Most of that change came in the first few days, and from then on the same coffee stayed in them longer. If you've recently quit and your usual cup seems stronger, this may be part of the reason.

A new prescription can change what your afternoon cup does, because a few medicines keep caffeine in the body far longer. The clearest case is the antidepressant fluvoxamine. Researchers gave it to eight healthy volunteers for twelve days and watched caffeine's half-life stretch from five hours to thirty-one1. That was long enough for them to warn of caffeine intoxication. Fluvoxamine was the only antidepressant they tested, so the finding says nothing either way about others.

Three antibiotics are worth checking your medicine against too. A review of many medicines singled out pipemidic acid and norfloxacin11 alongside fluvoxamine. Ciprofloxacin slows caffeine by less: in ten healthy men it took the half-life from about five hours to about eight2. If you take any of these, a pharmacist can help you judge how much caffeine is sensible alongside it.

How much of a 4pm coffee is still there at 11pm

Each cup is the same 4pm coffee, filled to the share of its caffeine still there at 11pm, worked out from average half-lives measured in small groups: about five hours in healthy volunteers12, about eight on the pill9 or on ciprofloxacin2, about ten and a half in the last weeks of pregnancy3 and thirty-one on fluvoxamine1. It assumes steady clearance from the moment of drinking, and real people clear caffeine faster or slower than these averages.

Worked out from the figures in the studies cited

See this as a table
The caffeine in a 4pm coffee
Who or when Still there at 11pm Note
Healthy volunteers 38% Half-life about 5 hours
On the pill or ciprofloxacin 55% About 8 hours
Late pregnancy 63% About 10½ hours
On fluvoxamine 86% About 31 hours

If I fall asleep fine after coffee, does it still matter?

It’s often said

Coffee doesn't affect me. I can have an espresso after dinner and fall asleep fine.

Why it can feel that way

Falling asleep is the only part of the night you're awake to watch. If you drop off easily after an evening espresso, that's the evidence you have. Whatever happens after you've gone under, you don't get to see.

What’s going on underneath

Falling asleep easily is real, and across twenty-four studies4 it was the part caffeine changed least, adding only about nine minutes to the time it took to drop off. Across the whole night, the same studies found it took about forty-five minutes of sleep away. The sleep that remained was lighter, with less of it deep415. People in later studies often didn't notice the loss510.

In a 2013 study, twelve healthy adults slept in their own beds after swallowing a pill that held either caffeine or nothing, without knowing which. On one of the nights the pill held 400 milligrams, a large dose and more than most coffee-shop coffees hold16, and they took it six hours before bed. A headband measured more than an hour less sleep10 that night. The sleepers' own diaries didn't register the disruption10.

In 2025 a larger trial followed twenty-three young men at home. One ordinary cup's worth, 100 milligrams, made no measurable difference to their sleep even four hours before bed5. The large dose of 400 milligrams was another matter: it thinned deep sleep even when it was taken with breakfast, twelve hours before bed5. The men felt their sleep was worse only when that dose came four hours before bed, so the breakfast dose did its work unfelt. When the researchers asked, fewer than one in four5 could say both how much they'd been given and when. It was the same blind spot the 2013 sleepers had. Women, older adults and people with insomnia have scarcely been studied1015 in trials like these, and older people's sleep may be more sensitive15.

So both things can be true at once: you fall asleep easily, and the caffeine is still taking some of the deepest part of your night without your noticing. It can feel as though the tiredness and the coffee feed each other, a thinner night leading to a groggier morning and a stronger urge for the afternoon cup. In one lab study, young men taking caffeine every day woke feeling more tired and found waking harder17 than on placebo. A cycle like that is plausible, though it hasn't yet been shown517.

A closer look How were the studies done, and what else did they find?

The 2023 analysis pooled twenty-four studies4 with many doses and timings, most of them in laboratories, so its figures are best read as averages across many kinds of night. The 2013 study followed twelve healthy adults aged 19 to 4810 who slept normally. They wore a single-channel headband made by Zeo, the company that funded the study, and the researchers treated its results for the separate stages of sleep as exploratory.

The 2025 trial's twenty-three men were about 25 years old5 and usually had less than 300 milligrams of caffeine a day. They slept at home with a small device on the forehead, one night for each dose and timing, the caffeine given in capsules. The 400-milligram dose thinned deep sleep by about thirty minutes when taken four hours before bed, fifteen at eight hours and twenty-one at twelve5. At four hours it also cut total sleep by about fifty minutes, and at four and eight hours it added twenty-six to twenty-nine minutes of waking in the night.

Whether daily drinkers grow used to caffeine's effect on sleep isn't agreed. The men in that trial were moderate daily drinkers and still lost deep sleep to the large dose5. A lab study of men used to about 450 milligrams a day found little difference in sleep on its test night17, though on their days at home, falling asleep had taken about twenty-five minutes longer5 on caffeine.

A survey of about 37,000 US adults pointed the same way in ordinary lives. People having 400 milligrams or more a day had one and a half times the odds of sleeping under six hours18, yet once the researchers accounted for other factors, caffeine wasn't linked to saying they had trouble sleeping. A snapshot like this can't tell which came first.

So how late can I have my last cup?

If there's a cup in your hand in the middle of the afternoon, tonight is probably what you're wondering about. For one ordinary cup, the evidence points to somewhere between about four and nine hours before bed. A large dose needs longer510.

What's odd is that the same research group came up with both ends. First they pooled many studies, most of them lab work with doses and timings all over the place, and estimated that a standard coffee of about 107 milligrams would need almost nine hours4 to leave sleep untouched. Then they gave twenty-three young men one ordinary cup at home, and at four hours it made no measurable difference5. So which do you believe? The fairest reading is that the real cut-off for one cup is somewhere in that span and moves from person to person, which is why a time tried against your own mornings tells you where yours falls.

The familiar advice to stop about six hours before bed is older. It goes back to the 2013 home study, whose authors suggested finishing substantial caffeine before 5pm at the latest10.

You may have seen 400 milligrams a day given as a safe amount. The FDA cites it, about two to three 12-ounce cups of coffee19, as an amount not generally linked to harm in healthy adults, while noting how widely people differ. The figure comes from a 2017 review20 sponsored by an industry-funded nutrition science body21, whose authors weighed effects on the heart, bones, pregnancy and more. Sleep wasn't among them. In the 2025 trial, 400 milligrams taken in one dose with breakfast still thinned deep sleep twelve hours later5.

Across your own day, the caffeine adds up from more than the coffee. Tea, cola and chocolate all count. A coffee-shop cup can hold several times what an instant one does: where a cup of instant coffee holds about 100 milligrams13, one 16-ounce coffee-shop drink bought on six different days ranged from 259 to 56416.

Caffeine is also added to some painkillers, which is easy to miss. Trials of these combinations used about 100 to 130 milligrams a dose22, about a cup of coffee, so a headache tablet late in the afternoon is worth counting, and its label will tell you what's in yours. It turns up, too, in gum, energy bars, supplements and pre-workout products1319.

A closer look How much caffeine is in my usual drinks?

The FDA and the NHS each give amounts in their own servings, so the two lists are best read separately.

In the FDA's 12-ounce servings, brewed coffee holds 113 to 247 milligrams19, black tea 71, green tea 37, a caffeinated soft drink 23 to 83 and an energy drink 41 to 246.

In the NHS's UK servings, a cup of instant coffee holds about 100 milligrams13, a cup of tea 75, a can of cola 40 and a 50-gram bar of dark chocolate under 25.

What if I'd like to have less, or move my cut-off earlier?

You can make this change at your own pace. Two medicines are the exception, and with them it's worth planning with someone first. If you take lithium, please talk to your prescriber before changing how much caffeine you have, because case reports suggest that cutting it sharply may raise lithium levels2324 and bring on tremor. If you take clozapine, which shares caffeine's enzyme, the same conversation with your prescriber is worth having first: in seven patients, five caffeine-free days lowered clozapine levels by about a third to a half25, and they rose again when caffeine came back.

If you've tried stopping before and had a miserable few days, that was real. Caffeine withdrawal brings a headache to about half of people26 in experiments, along with tiredness, low energy, poor concentration and low mood, and it can follow stopping as little as 100 milligrams a day. It usually begins twelve to twenty-four hours after the last cup26, is at its worst within a day or two and has passed within two to nine days. The FDA suggests cutting back gradually19: withdrawal isn't dangerous, though it can be unpleasant. You might swap one cup at a time for decaf. That way you keep the warm cup and the pause in the afternoon, while the caffeine in it grows smaller.

Is it different if I'm short on time, or working nights?

  • If you have the time to sleep but lie awake or sleep lightly

    Caffeine is worth testing as one of the things that may be keeping your nights shallow, and an earlier cut-off with a smaller last cup is an easy place to begin. If your sleep doesn't change once caffeine is well out of the picture, the trouble is probably coming from somewhere else, and CBT for insomnia is made for exactly that.

  • If you're short on time, and caffeine is how the day gets done

    Perhaps you start early, work long days or are up in the night with a baby, a child or someone you care for, and your nights are already short. Keeping your cups smaller and earlier in the day is likely to protect the sleep you do get. An ordinary morning cup has mostly cleared by bedtime12 for most people. It lingers longer if your body clears caffeine slowly. On the day after a bad night, an afternoon coffee is still partly there5 at the next bedtime, and there's more on getting through that day.

  • If you work nights

    Caffeine can get you through the small hours, and the cost comes when you try to sleep in daylight. In a Montreal lab study, people sleeping in the morning after a night awake lost more to 200 milligrams of caffeine than night sleepers did, with shorter sleep and less REM sleep27 only in the daytime group. In another small simulation, researchers gave ten people about 200 milligrams, two espressos, in the early hours. It raised their alertness and then disturbed the daytime sleep that came five hours later28. These were volunteers after one night awake rather than seasoned shift workers, and no study yet says exactly when to stop. Still, it may help to have your caffeine early in the shift and let the last several hours before home run without it.

What the research says

  • Caffeine keeps you alert by blocking adenosine, part of the brain's build-up of sleep pressure. Well established
  • Caffeine shortens and lightens sleep, taking about forty-five minutes off a night on average, while adding only about nine minutes to falling asleep. Well established
  • In healthy adults caffeine's half-life is usually about five hours, with a wide spread between people. Good evidence
  • The birth control pill slows caffeine's clearance. Well established
  • Late pregnancy and the medicine fluvoxamine slow it a great deal. Good evidence
  • People often don't notice caffeine's effect on their sleep, especially when they had it earlier in the day. Good evidence
  • A large dose of caffeine can still thin deep sleep when taken with breakfast, twelve hours before bed. Good evidence
  • Studies differ on whether regular drinkers become tolerant to caffeine's effects on sleep, and it isn't clear yet. Still debated
  • In one small lab study, daily caffeine left young men feeling more tired on waking; whether that leads people to drink more hasn't been shown. Early evidence
  • A handful of case reports suggest that cutting caffeine sharply may raise lithium levels. Early evidence

Most sleep studies of caffeine were small and done in healthy young or middle-aged men, so how well their numbers fit women, older adults and people with insomnia is less certain. Gene tests for caffeine don't yet predict how your sleep will respond.

Questions people ask

Is decaf really caffeine-free?

Nearly, though not quite. A cup of decaf typically holds 2 to 15 milligrams1619, a small fraction of an ordinary coffee. So an evening decaf still gives you a hot drink after dinner, with very little caffeine in it.

What about energy drinks and pre-workout?

Quite a lot, sometimes. An energy drink holds anywhere from 41 to 246 milligrams19. For a standard pre-workout serving of about 218 milligrams, the researchers who pooled the sleep studies estimated you'd need just over thirteen hours4 before bed to leave sleep untouched. A drink before an evening workout reaches well into the night.

Where does that leave this afternoon's cup?

What a cup does tonight comes down to its size, the hour you drank it and your own body. A cup of instant coffee at lunchtime is mostly gone by bedtime. A large coffee-shop cup at four still has a good share left in you at 11pm. The cut-off that suits you is personal, and it can move: a pregnancy, a new prescription or your last cigarette would each call for an earlier one. For today, it's enough to notice the size and the hour of the cup in your hand, and see how you wake tomorrow.