FitHQ

Caffeine Calculator

This caffeine calculator estimates how much caffeine is still in your system at bedtime, using caffeine's ~5-hour half-life, and tells you the latest time to have your last coffee to stay under a sleep-friendly amount.

How it works

Caffeine is cleared with first-order kinetics: the amount in your body halves roughly every 5 hours (its half-life). Starting from your dose in milligrams and the hours between when you had it and your bedtime, the amount left is dose × 0.5^(hours ÷ 5).

To find your cut-off, the calculator works backwards: it solves for how long a dose takes to fall to about 50 mg — a level most people tolerate at bedtime — and subtracts that from your bedtime to give a “last dose by” time.

Worked example

You drink a 200 mg coffee at 3:00 PM and go to bed at 11:00 PM — 8 hours later. Caffeine remaining = 200 × 0.5^(8 ÷ 5) ≈ 66 mg still in your system, which is above the ~50 mg target.

To be under 50 mg by 11 PM, a 200 mg dose needs 10 hours to decay (200 → 100 → 50), so your last 200 mg dose should be by about 1:00 PM.

Typical caffeine by drink

Approximate caffeine content of common sources:

DrinkTypical caffeine
Espresso (1 shot)63 mg
Brewed coffee (8 oz)95 mg
Energy drink (8 oz)80 mg
Black tea (8 oz)47 mg
Cola (12 oz)34 mg
Pre-workout (1 scoop)200 mg

Values are averages; actual content varies by brand, bean, and brew strength.

Frequently asked questions

How long does caffeine stay in your system?

Caffeine has a half-life of about 5 hours, so half is gone in 5 hours, three-quarters in 10, and so on. It usually takes the better part of a day to clear a large dose to negligible levels.

What is caffeine's half-life?

Half-life is the time for the amount in your body to halve. For caffeine it averages roughly 5 hours in healthy adults, though it ranges widely with genetics, liver function, and other factors.

How late can I drink coffee before bed?

A common guideline is to stop caffeine 6 or more hours before bed. This calculator is more precise: it shows the latest time to take your dose and still be under about 50 mg by bedtime.

How much caffeine affects sleep?

Even modest amounts left at bedtime can lengthen the time to fall asleep and reduce deep sleep. Keeping the leftover amount under roughly 50 mg by bed is a reasonable target for most people.

Does caffeine tolerance change this?

Tolerance changes how stimulated you feel, but it does not meaningfully change how fast your body clears caffeine. The half-life and the math here stay about the same regardless of tolerance.

Related calculators

Disclaimer. This is an estimate only. Caffeine metabolism varies widely between people — genetics, pregnancy, liver function, and medication can all speed it up or slow it down considerably. Not medical advice.