Two calculators. The first works out how late you can drink coffee against your own bedtime and your own cup, rather than the flat “nothing after 2pm” rule. The best-evidenced anchor is 8.8 hours before bed for a 107 milligram coffee, and that is a figure produced by a statistical model in one 2023 review rather than a curfew anybody tested. The second calculator adds up a day’s caffeine against the 400 milligrams the FDA actually publishes.
What these numbers are, and are not
There is no measured caffeine curfew in the literature. The most defensible timing figures are two modelled outputs from a single 2023 meta-regression, tied to two specific doses. A meta-regression is a statistical model fitted across the results of many studies, so what comes out of it is an estimate produced by that model rather than a measurement from any single experiment. This tool uses those two points, refuses to answer below the smaller of them, and labels the scaling in between as its own arithmetic. The FDA also states plainly that sensitivity and clearance vary widely between people.
If you are pregnant, trying to conceive or breastfeeding, or you take medication or have a heart or anxiety condition, the FDA asks you to raise caffeine with a clinician rather than work from a number on a page. See the medical disclaimer.
Work out your own cutoff
The flat “nothing after 2pm” rule is not what the research says. The usable version is a subtraction against your own bedtime and your own cup. Timing is one axis of the question; the second tab handles the other, which is how much you have had over the whole day.
Where these come from
The endpoints are the FDA’s own per-12-ounce figures, and most are ranges rather than single values, which is why the strong and weak ends are offered separately. The “our midpoint” option is this tool’s arithmetic on the FDA range, not an FDA figure. Espresso is not listed because the FDA page does not give a figure for it, and inventing one would be guessing.
Latest time to drink it
Set a bedtime and a drink
Why this number
A 2023 meta-regression modelled that “coffee (107 mg per 250 mL) should be consumed at least 8.8 h prior to bedtime and a standard serve of pre-workout supplement (217.5 mg) should be consumed at least 13.2 h prior to bedtime”. Note the 250 mL: the model’s coffee anchor is roughly an 8.5 ounce cup, smaller than the 12 ounce servings in the list above. Those two doses are the only published points. Below 107 mg the model has no anchor and this tool gives no time. Between them it scales, which is its own arithmetic rather than a published result. A meta-regression is a statistical model fitted across the results of many studies, so what comes out of it is an estimate produced by that model, not a measurement from any single experiment.
Share of the dose still circulating at bedtime, on paper
Set a bedtime and a drink
Why this number
Textbook exponential decay run on the only half-lives this project has a source for: 6.0 hours in non-smokers against 3.5 hours in smokers. That is a smoking contrast, not the spread across people, and there is no sourced figure for a typical reader, so no single middle number is offered. The same review reports that the liver enzyme doing the clearing varies up to fifteenfold between individuals, so your own figure could sit well outside this band. It also ignores absorption and treats the whole dose as present the moment you drink it, which it is not. This is arithmetic on published averages, not a measurement of you, and no source gives a level below which caffeine stops affecting sleep.
What this is not. The 8.8 hour figure is a model output for one specific dose, not a tested threshold and not a curfew. Sensitivity and clearance vary widely between people: the FDA says so plainly. If you are pregnant, trying to conceive or breastfeeding, take medication, or have a heart or anxiety condition, raise caffeine with a clinician rather than working from a number on a page. Treat the answer as a starting point to test against your own sleep, not a rule.
Sources: Gardiner et al., Sleep Medicine Reviews 2023, caffeine metabolism review, FDA. Background: How Long Before Bed to Stop Drinking Coffee. Scope and limits: medical disclaimer.
The other axis: how much you have had across the whole day. The answer is a range because the FDA’s own figures are ranges. Brewed coffee alone runs from 113 to 247 mg for the same cup size.
How many 12 ounce servings todayFor anything not listed
Espresso, pre-workout, tablets and so on. The FDA page gives no figure for these, so rather than invent one the tool asks you to read it off the label.
Your total today
Add what you have had
Why this number
Each drink multiplied by the low and high ends of the FDA’s stated range for that drink, added up. The per-drink ranges are the FDA’s. Adding the low ends together and the high ends together is this tool’s own method, and it assumes every drink you had sat at the same end of its range, so a real day is likely nearer the middle than either edge.
Against the FDA figure
Add what you have had first
Why this number
FDA: “For most adults, the FDA has cited 400 milligrams a day, that’s about two to three 12-fluid-ounce cups of coffee, as an amount not generally associated with negative effects.”
400 mg is a reference point, not a target and not a safety cliff. The FDA’s wording is “not generally associated with negative effects” for most adults, and it says plainly that sensitivity and clearance vary widely between people. Nothing here is a suggestion to drink more. The figure is for adults: the FDA notes that medical experts advise against energy drinks for children and teenagers, so this comparison does not apply to them. If you are pregnant, trying to conceive or breastfeeding, take medication, or have a heart or anxiety condition, the FDA asks you to raise it with a clinician rather than work from a number on a page.
Source: FDA, Spilling the Beans. Scope and limits: medical disclaimer.
Worked out in your browser. Nothing you enter is sent anywhere.
Why there is no single caffeine cutoff time
The advice you usually meet is a clock time: nothing after 2pm, or nothing after midday. A clock time cannot be right for everyone, because it ignores the two things that actually matter. The first is when you go to bed, which is the whole point of the exercise and varies by hours between people. The second is how much caffeine is in the cup, which varies by more than you would guess: the FDA puts a 12 ounce brewed coffee anywhere between 113 and 247 milligrams, so two identical-looking cups can differ twofold.
Then there is you. There is no reliable “typical” figure to quote here, which is itself the point. A review of caffeine metabolism reports elimination half-life falling from 6 hours in non-smokers to 3.5 hours in smokers, and rising from an average of 3 hours in women who are not pregnant to as long as 10.5 hours in the final weeks of pregnancy. Each of those belongs to a particular group rather than to a general reader. The same review notes that the liver enzyme doing most of the clearing varies up to fifteenfold between people. That spread is why the same cup ruins one person’s night and does nothing to the person opposite.
Common questions
Where does the 8.8 hours come from?
A 2023 systematic review and meta-analysis in Sleep Medicine Reviews ran a meta-regression across 24 studies and modelled that a 107 milligram coffee, defined per 250 millilitres, should be consumed at least 8.8 hours before bed, and a 217.5 milligram serve of pre-workout supplement at least 13.2 hours before, to avoid reductions in total sleep time. Those are the two published points. Note the 250 millilitres: that is roughly an 8.5 ounce cup, smaller than the 12 ounce servings most caffeine tables use. They are model outputs for specific doses, not thresholds anybody tested directly, and they are not a curfew.
Why is espresso not in the list?
The FDA’s caffeine table does not list espresso, and no other source used here gives a figure for it, so this calculator does not carry one. Putting a number on it would be guessing. If you know what is in your shot, type the milligrams in directly.
Is 400 mg a hard limit?
No. 400 milligrams a day is a reference point, not a safety limit and not a target. The FDA’s wording is that this amount is “not generally associated with negative effects” for most adults, which is a careful sentence rather than a safety cliff, and the same page notes how much people differ. It is guidance for adults: the FDA notes that medical experts advise against energy drinks for children and teenagers.
Does cutting off earlier guarantee better sleep?
No trial has tested moving your caffeine cutoff earlier and measured what happened to your sleep. What the pooled evidence shows is the effect of caffeine itself: across 24 studies it cut total sleep time by about 45 minutes and sleep efficiency by about 7%, added roughly 9 minutes to falling asleep and about 12 minutes of waking afterwards. Those are averages across mixed protocols, and habitual drinkers may show partial tolerance. The useful move is to change one thing, your cutoff, and watch what happens to your own sleep.
Can I caffeinate my way through a bad night?
Partly, and not in the way that matters most for technical work. In one lab study, after a night of total sleep deprivation, caffeine counteracted the impairment in vigilant attention but did not significantly help place-keeping for most participants, though it did cut the number who failed to hold criterion accuracy. Place-keeping is the process that keeps you from losing your spot in a multi-step procedure. That study used total deprivation rather than a short night, so do not over-apply it, but nothing in it supports assuming that feeling alert means your procedural accuracy came back too.