Sleep Cycle Calculators

A Free Calculator · Editable Half-Life · General Estimate Only

How much caffeine is still in your system at bedtime?

Caffeine doesn't disappear when the buzz wears off — it fades slowly through exponential decay. Enter your dose, your estimated half-life, and how many hours until you plan to sleep, and the calculator shows exactly what the math predicts is still circulating. Half-life varies widely by person; the 5-hour default is an average, and it's deliberately editable.

Caffeine remaining at bedtime · Editable personal half-life · General estimate, not medical advice
Read this first This is a general estimate based on population-average pharmacokinetics — not a clinical measurement of your individual metabolism. Caffeine half-life varies enormously: genetics, pregnancy, smoking status, oral contraceptives, and certain medications all shift it significantly. The 5-hour default is a commonly cited average for healthy, non-pregnant adults on no interacting medications. Change it if you know your metabolism runs faster or slower. This is not medical advice.

The calculator

Caffeine remaining at bedtime

Enter your caffeine dose, your estimated half-life (the default 5 hours is an average — adjust it to match your experience), and how many hours until you plan to sleep.

mg

A typical 8 oz drip coffee is roughly 80–120 mg. See the drink reference table below for approximate values.

hours

Population average is ~5 hours. Smokers may be ~2 h; slow metabolizers or those on certain medications can be 9–11 h or more. Edit this to match what you know about yourself.

hours

How many hours from now until you plan to fall asleep. Increase this to find the timing where remaining caffeine drops to a level you're comfortable with.

The formulas, in full

The math is standard pharmacokinetic exponential decay — the same model used for any substance eliminated at a constant fractional rate. Nothing here is a black box.

How each number is derived

1 — Caffeine remaining (exponential decay)
remaining_mg = dose_mg × Math.pow(0.5, hours_until_bed / half_life_hours)
2 — Percent of original dose still present
percent_remaining = (remaining_mg / dose_mg) × 100
3 — Intuition: what the half-life means
After 1 half-life → 50% remains After 2 half-lives → 25% remains After 3 half-lives → 12.5% remains After 4 half-lives → 6.25% remains Example (default inputs): dose = 100 mg, half-life = 5 h, hours until bed = 5 remaining = 100 × 0.5^(5/5) = 100 × 0.5^1 = 100 × 0.5 = 50 mg (50%)

Approximate caffeine in common drinks

These are approximate midpoint figures based on published ranges. Actual caffeine varies substantially with preparation method, brand, brew time, and serving size. Use them to estimate a starting dose — then check product labels when precision matters.

Drink Typical serving Approx. caffeine Notes
Drip coffee 8 oz (240 mL) ~95 mg Range roughly 70–140 mg; varies by bean, roast, and brew. Darker roasts are not necessarily higher in caffeine by weight.
Espresso 1 shot (~1 oz / 30 mL) ~65 mg Range roughly 60–75 mg per shot. A double (doppio) is approximately 125–130 mg. High caffeine per volume, but small serving size.
Black tea 8 oz (240 mL) ~47 mg Range roughly 25–70 mg; steep time and tea grade affect the final amount substantially. Green tea is typically lower (20–45 mg per 8 oz).
Cola (regular) 12 oz can (355 mL) ~35 mg Range roughly 30–45 mg per 12 oz can. Diet versions are similar in caffeine content. Significantly less than coffee per serving.
Energy drink 8–16 oz can ~80–200 mg Highly variable — some standard 8 oz cans contain ~80 mg; some 16 oz cans exceed 200 mg. Always check the label, especially for "extra strength" formulations.

All figures are approximate and represent typical midpoints. Caffeine content varies by brand, preparation, and serving size. Sources: FDA caffeine guidance, USDA FoodData Central, published product labels. Use these as starting estimates only — check labels for precision.

Why your half-life is personal — and why it matters

The 5-hour average masks a range from under 2 hours to over 10 — and in pregnancy, even longer. The factors below explain why the default is a starting point, not a personal fact.

Genetics: the CYP1A2 enzyme determines your baseline speed

Caffeine is metabolized primarily by the liver enzyme CYP1A2. Genetic variants in the CYP1A2 gene create a spectrum of activity — "fast metabolizers" clear caffeine significantly more quickly than "slow metabolizers." This explains why two people who drink the same coffee at the same time can feel completely different effects several hours later: one may be nearly clear while the other still has most of the dose circulating. Genetic testing (23andMe, for example) can tell you your likely CYP1A2 variant, though it's not a clinical measurement of actual half-life.

Smoking cuts half-life roughly in half

Cigarette smoking strongly induces CYP1A2 activity, roughly halving caffeine half-life to approximately 2–3 hours in regular smokers. This means smokers metabolize caffeine much faster than the 5-hour average and may tolerate later caffeine intake without the same sleep impact — though this is not a recommendation to smoke. When a smoker quits, their CYP1A2 activity returns toward baseline over weeks, and their caffeine sensitivity typically increases noticeably.

Pregnancy substantially extends half-life

CYP1A2 activity decreases progressively during pregnancy, particularly in the second and third trimesters. Half-life can reach 10–15 hours in the second trimester and 15–35 hours in the third trimester. This is one of the key reasons that standard clinical guidance recommends limiting caffeine intake during pregnancy — the same dose that clears overnight in a non-pregnant adult may still be substantially present the following morning. Anyone who is pregnant should follow their obstetric provider's specific guidance on caffeine, not a general calculator.

Oral contraceptives and certain medications extend it

Oral contraceptives inhibit CYP1A2 and roughly double caffeine half-life — to around 10–12 hours in some studies. Certain antibiotics (notably fluoroquinolones like ciprofloxacin), some antidepressants (particularly fluvoxamine), and other medications can also extend half-life significantly by competing for or inhibiting the same metabolic pathway. If you take any of these and notice that caffeine seems to affect you much longer than it used to, or longer than peers report, this mechanism is the likely explanation.

How to use this calculator to find your cutoff time

The goal is to work backward from a residual amount you're comfortable with to the latest time you should take your last dose. These steps walk through that logic.

Estimate your dose from the drink reference

Use the table above to pick a starting figure for the drink you typically have last. If you always have a 12 oz drip coffee, start with ~140 mg; if it's a single espresso, try 65 mg. You can refine later — the goal is a reasonable starting point, not a lab measurement.

Adjust the half-life if you have evidence

The 5-hour default is an average. If you're a smoker, try 2–3 hours. If you're on oral contraceptives, 9–11 hours is a more realistic starting estimate. If you simply notice that coffee seems to stay with you much longer than it does for most people, try pushing the half-life to 7 or 8 hours and see if the resulting predictions match your experience.

Increase hours until bedtime until you reach a comfortable residual

There's no universal "safe" threshold — individual sensitivity varies too much. A common practical target is under 25–50 mg remaining at bedtime, though some people notice effects at lower amounts and others are relatively unaffected at higher ones. Adjust the hours-until-bed input upward until the remaining-caffeine figure drops into your comfort zone. That number of hours is roughly your personal cutoff.

Test it against your experience

Use the calculated cutoff time for two to three weeks and track whether sleep onset and morning freshness improve. If the predicted cutoff still leaves you wired, your effective half-life is likely longer than you've set — try adding 1–2 hours to the half-life and recalculating. This is iteration, not a one-time answer.

Consider cumulative doses on high-intake days

If you have multiple caffeine sources — morning coffee, an afternoon tea, a post-lunch cola — the doses stack. Each has its own independent decay curve running in parallel; you can run the calculator separately for each dose using the actual hours-until-bedtime for each, then add the remaining amounts together for a total estimate. The calculator handles one dose at a time; multi-dose stacking is additive.

Caffeine and sleep terms glossary

The pharmacology terms that come up when reading about caffeine and sleep — in plain language.

Half-life
The time it takes for the body to eliminate half of a substance from the bloodstream. Caffeine's half-life in healthy adults averages around 5 hours but varies substantially based on genetics, medications, smoking status, and pregnancy. After one half-life, 50% of the original dose remains; after two half-lives, 25%; and so on.
CYP1A2
The primary liver enzyme responsible for metabolizing caffeine. Genetic variants in CYP1A2 create fast and slow metabolizers — a core reason individual caffeine sensitivity varies so much. Smoking induces CYP1A2 activity (faster clearance); oral contraceptives and some medications inhibit it (slower clearance).
Adenosine
A chemical that accumulates in the brain throughout waking hours and promotes sleepiness (sometimes called "sleep pressure"). Caffeine works by binding to adenosine receptors without activating them, blocking adenosine's sleep-promoting signal. As caffeine is metabolized, the blockade lifts and accumulated adenosine can act again — sometimes causing a rebound "crash."
Exponential decay
A mathematical model in which a quantity decreases at a rate proportional to its current amount. Caffeine clearance follows this pattern: each half-life removes half of whatever is currently present, so elimination slows as the amount decreases. The formula is: remaining = initial × 0.5^(time ÷ half_life).
Slow-wave sleep (SWS)
The deepest stage of non-REM sleep, also called N3 or delta sleep. It is the most physically restorative sleep stage and is involved in memory consolidation, immune function, and metabolic waste clearance. Research suggests caffeine can reduce slow-wave sleep even when it doesn't noticeably delay falling asleep — meaning the question isn't only "can I fall asleep?" but "how deep is my sleep?"
Caffeine tolerance
The reduced perceived stimulant effect that develops with regular caffeine use as the brain compensates by upregulating adenosine receptors. Tolerance affects how alerting caffeine feels but does not meaningfully change its metabolic half-life — regular coffee drinkers still have the same amount circulating per their dose and half-life; they just feel it less consciously.
Pharmacokinetics
The study of how the body absorbs, distributes, metabolizes, and eliminates a substance over time. The half-life model used in this calculator is a simplified one-compartment pharmacokinetic model — accurate enough for practical caffeine timing decisions, but a simplification of what is actually a multi-compartment biological process.

Frequently asked

Caffeine half-life is the time it takes your body to eliminate half of the caffeine you consumed. It matters for sleep because caffeine works by blocking adenosine receptors — the receptors that build up "sleep pressure" throughout the day. If you drink a 200 mg coffee and your half-life is 5 hours, about 100 mg is still active 5 hours later. The caffeine remaining at bedtime is a direct estimate of how much receptor-blocking activity your brain is still fighting against when you try to fall asleep. Even amounts that feel small (25–50 mg) can measurably delay sleep onset and reduce slow-wave sleep quality in sensitive individuals.
The 5-hour figure is a commonly cited population average for healthy, non-pregnant adults who are not on caffeine-interacting medications and are not smokers. In reality, half-life varies enormously: roughly 1.5–2 hours in smokers (smoking induces the liver enzyme CYP1A2), roughly 9–11 hours in healthy adults with slow-metabolizer genetics, and up to 15–35 hours during late pregnancy. Oral contraceptives roughly double half-life. The 5-hour default in this calculator is deliberately editable — change it to match what you know about yourself.
Caffeine content varies widely by preparation. Approximate typical values: a standard 8 oz drip coffee contains roughly 80–120 mg; a single shot of espresso (~1 oz) contains roughly 60–75 mg; black and green teas typically range from 25–70 mg per 8 oz serving; a 12 oz can of regular cola contains about 30–45 mg; popular energy drinks (8–16 oz cans) range from about 80 to over 200 mg per container. All values are approximate — actual caffeine depends heavily on bean variety, roast, grind, brew time, water temperature, and serving size. The table on this page lists typical midpoint estimates; always check product labels when precision matters.
Yes. Research suggests caffeine can impair sleep architecture — particularly slow-wave sleep — even at doses and timings that don't noticeably delay falling asleep. A 2013 study by Drake et al. found that 400 mg of caffeine taken 6 hours before bedtime still significantly disrupted sleep, even though subjects reported falling asleep without much trouble. This means the question isn't just "can I fall asleep?" but "how restorative is my sleep?" Sensitivity varies substantially by person; some individuals notice effects at very low remaining doses while others are less affected.
There is no universal threshold — this is a general estimate, not a clinical guideline. Common practical guidance is to aim for under 25–50 mg remaining at bedtime, though individual sensitivity varies so widely that some people sleep fine with more and others are disrupted by less. If 30% remains from a 200 mg dose, that's 60 mg — roughly equivalent to a weak cup of tea still circulating. For people who notice sleep disruption, working backward from a desired residual amount (say, 25 mg) at their planned bedtime is a more useful way to find a cutoff time than guessing.
Set your typical dose and your estimated half-life (start with 5 hours if you're unsure). Then adjust the "hours until bedtime" input upward until the caffeine remaining drops to a level you're comfortable with — many people aim for under 25–50 mg, though your own sensitivity is the real guide. The resulting number of hours is roughly how long before bedtime you should take your last dose. For example, with a 200 mg dose and a 5-hour half-life, you need about 8–9 hours to get below 50 mg remaining. If your bedtime is 10 pm, that puts your cutoff around 1–2 pm. Run the math with your own numbers rather than relying on a generic rule.
Caffeine tolerance affects how stimulating the same dose feels, but it does not meaningfully change the metabolic half-life or the amount remaining in your system at any given time. The exponential decay curve is determined by your liver's enzyme activity, not by how used to caffeine your brain is. A regular coffee drinker who feels no buzz from their morning cup still has roughly the same amount of caffeine blocking adenosine receptors as someone who rarely drinks coffee — they've just built receptor-level tolerance to the stimulant effect. The sleep-disrupting mechanism appears to be more persistent than the perceived energy boost.
No. This is a general educational estimate based on population-average pharmacokinetics. It does not account for your specific health conditions, medications, genetics, pregnancy status, or any other individual factors that influence caffeine metabolism. People with certain heart conditions, anxiety disorders, liver conditions, or those taking specific medications should discuss caffeine intake with their doctor. The calculator is intended to help you understand the basic math of caffeine decay and make more informed choices about timing — not to diagnose or treat any condition. If you have persistent sleep problems, speak with a healthcare provider.

Common mistakes with this calculator

The exponential decay math is exact for the inputs you provide, but the inputs themselves are where most people go wrong.

Forgetting about the afternoon dose

Many people track their morning coffee and declare success — then have a post-lunch tea, an afternoon cola, or a mid-afternoon energy drink without running the numbers. Each dose has its own independent decay curve. With a 5-hour half-life, 100 mg consumed at 3 PM still leaves roughly 50 mg in your system at 8 PM. The calculator handles one dose at a time; for multiple doses, run it separately for each and add the remaining amounts together.

Using the 5-hour default when your half-life is longer

The 5-hour figure is an average for healthy non-pregnant adults not on interacting medications. Oral contraceptives, certain antibiotics, and some other medications can extend the half-life considerably — meaning that 2 PM coffee may still have a meaningful amount circulating at midnight. If caffeine consistently disrupts your sleep even when consumed hours before bed, trying a longer half-life in the calculator often explains the mismatch.

Assuming tolerance means caffeine doesn't affect sleep quality

Caffeine tolerance reduces the alerting effect you consciously feel, but it does not meaningfully change the metabolic half-life or the amount blocking adenosine receptors. Regular coffee drinkers who can still fall asleep after a late cup often report lighter sleep — they fall asleep, but slow-wave sleep depth can still be reduced. Tolerance masks the subjective experience; it does not make the remaining caffeine inert.

Aiming for zero remaining caffeine instead of a practical threshold

With any finite half-life, caffeine never fully disappears — it just decreases exponentially. Waiting until zero is effectively waiting forever. A practical approach is to work backward from a residual amount you're comfortable with, and treat that level as your personal cutoff. Adjust the hours-until-bedtime input until the result reaches that threshold — that's your rule.