PK Systems PK Systems
General

Caffeine Calculator — When Can I Sleep?

Add what you drank today and see how much caffeine is still in your system — and the time it drops below the sleep-safe threshold.

Caffeine Calculator — When Can I Sleep?

Add every coffee, tea, or energy drink from the day. The chart updates as you go.

Caffeine in your system right now

mg

Add a drink to see your level.

What is caffeine half-life?

Caffeine has an average half-life of about 5 hours in healthy adults — meaning after five hours, only half of what you drank is still active in your bloodstream. After ten hours, a quarter. After fifteen, an eighth. That's why an afternoon coffee can quietly sabotage bedtime: the dose feels small at the time, but a real fraction of it is still circulating eight hours later. Half-life varies between people. Smokers metabolise caffeine faster (closer to 3 hours), while pregnancy, oral contraceptives, and certain medications can stretch it past 8 hours. Genetics also play a role — slow metabolisers feel a single espresso for most of the evening. Most sleep researchers consider under 30 mg circulating to be a safe baseline for falling asleep without the chemical interfering. This calculator stacks every drink you log, decays each one with the 5-hour half-life curve, and tells you both how much is in your system now and when the total will fall below the sleep-safe threshold. It's a useful estimate, not a medical instrument — sensitivity differs from person to person.

How to use this calculator

Tap Add a drink for each coffee, tea, or energy drink you've had today. Pick the type and the calculator will fill in a typical caffeine amount; switch to Custom if you know the exact mg from the label. Set the time to when you finished the drink. The chart shows the combined caffeine curve for the next 24 hours, and the highlighted card tells you when your level should drop below 30 mg — a common cut-off for falling asleep without interference.

How the math works

Each dose decays exponentially. For a single drink of D mg consumed Δt hours ago, the remaining caffeine is D × 0.5Δt / 5. When you log multiple drinks, the calculator sums the contribution from each one. To find the sleep-safe time, it walks forward in one-minute steps from now and stops at the first moment when the total falls below 30 mg.

C(t) = Σ dose × 0.5(t − tdrink) / 5h

Typical caffeine amounts

Drink Serving Caffeine
Espresso (single shot)30 mL64 mg
Drip coffee240 mL95 mg
Latte / cappuccino240 mL75 mg
Cold brew355 mL200 mg
Energy drink250 mL80 mg
Black tea240 mL47 mg
Green tea240 mL28 mg
Cola / soft drink355 mL34 mg

Frequently asked questions

How accurate is the 5-hour half-life?

It's an average. Most healthy adults fall between 4 and 6 hours, but individual half-life can range from 1.5 to over 9 hours. Pregnancy, liver function, smoking, and some medications all change it. Use the result as a guide, not a guarantee.

Why 30 mg as the sleep-safe threshold?

Below 30 mg, most people no longer feel the alerting effect, and studies of sleep latency don't show consistent disruption. It's a working number, not a hard limit — sensitive sleepers may want to aim lower.

Does decaf coffee count?

Only a little. A typical decaf cup has 2–5 mg of caffeine, which is small enough that it's not worth logging unless you've had several cups very late in the evening.

What about caffeine from chocolate or pre-workout?

Add them as Custom. Dark chocolate has about 12 mg per 30 g, and pre-workout supplements vary wildly — check the label for the exact mg per serving.

Why does the line get higher when I add a drink earlier in the day?

Because caffeine consumed earlier has been decaying longer, but it's still part of the total. Several earlier drinks can stack up to a meaningful residual level even when you stopped hours ago.

Is this safe to use during pregnancy?

The math still works, but pregnancy slows caffeine metabolism — the half-life can stretch past 10 hours. Most health bodies recommend keeping intake under 200 mg per day during pregnancy. Talk to your doctor for personal advice.