# Caffeine half-life calculator

> How much caffeine is left in your body from up to three doses, based on its half-life, and when the level drops below an amount you choose.

Interactive version: https://www.calcopenly.com/health/caffeine-half-life-calculator
Subject: Health and fitness calculators

Each dose is assumed to enter the body at once and then halve every half-life: the amount left from a dose is dose × 0.5^(hours since the dose ÷ half-life), and the calculator adds up to three doses. It also works out when the total falls below a level you choose, using time = half-life × log2(level after the last dose ÷ chosen level).

People use it to decide when to stop drinking coffee before bed. With the defaults, 150 mg at 08:00 and a 71 mg black tea at 14:00 leave about 45 mg at 22:00, and the level has been below 50 mg since 21:15.

The default half-life of 5 hours is the average for healthy adults, but it ranges from about 1.5 to 9.5 hours and changes with pregnancy, oral contraceptives and smoking. Blood levels actually peak 15 to 120 minutes after drinking, so the curve overstates the level in the first hour or two after each dose.

## Inputs

- **Dose 1**: FDA: 12 fl oz of brewed coffee has 113–247 mg, black tea 71 mg, green tea 37 mg. Enter 0 to skip a dose.
- **Time of dose 1**: Times are read within the 24 hours that start at the first dose, so 01:00 after a 20:00 dose means the next night.
- **Dose 2**
- **Time of dose 2**
- **Dose 3**
- **Time of dose 3**
- **Check the level at**: Read as the next time this clock time comes round after dose 1.
- **Level to wait for**
- **Half-life**: About 5 h on average in healthy adults, ranging 1.5–9.5 h (Institute of Medicine, 2001); longer in pregnancy and with oral contraceptives, shorter in smokers.

## Results

- Caffeine left at the check time (mg) — main result
- Below your level from
- Time after the last dose
- Total caffeine taken (mg)

## Formula

$$
C(t) = \sum_i D_i \left(\tfrac12\right)^{(t - t_i)/t_{1/2}}\quad (t \ge t_i)
$$

## Worked examples

### 200 mg at 08:00, checked at 18:00 (two half-lives)

- Dose 1: 200 mg
- Time of dose 1: 08:00
- Dose 2: 0 mg
- Dose 3: 0 mg
- Check the level at: 18:00
- Level to wait for: 50 mg
- Half-life: 5 h
- **Caffeine left at the check time: 50 mg**
- **Below your level from: 18:00**
- **Time after the last dose: 10 h**
- Checked against: Python 3.8 decimal: 200 × 0.5^(10/5) = 50; threshold reached at 5 × log2(200/50) = 10 h

### 95 mg at 08:00 and 64 mg at 13:00, checked at 22:00

- Dose 1: 95 mg
- Time of dose 1: 08:00
- Dose 2: 64 mg
- Time of dose 2: 13:00
- Dose 3: 0 mg
- Check the level at: 22:00
- Level to wait for: 50 mg
- Half-life: 5 h
- **Caffeine left at the check time: 32 mg**
- **Below your level from: 18:48**
- **Time after the last dose: 5 h 47 min 6 s**
- **Total caffeine taken: 159 mg**
- Checked against: Python 3.8 decimal: 95·0.5^(14/5) + 64·0.5^(9/5) = 32.01997; 13:00 + 5·log2(111.5/50) h = 18:47:08, rounded up to 18:48

### Evening dose checked after midnight

- Dose 1: 150 mg
- Time of dose 1: 20:00
- Dose 2: 0 mg
- Dose 3: 0 mg
- Check the level at: 02:00
- Level to wait for: 50 mg
- Half-life: 5 h
- **Caffeine left at the check time: 65 mg**
- **Below your level from: 03:56 (+1 day)**
- **Time after the last dose: 7 h 55 min 29 s**
- Checked against: Python 3.8 decimal: 150 × 0.5^(6/5) = 65.2913; 5·log2(3) = 7.9248 h after 20:00 = 03:55:25, rounded up

### Edge: already below the level at the last dose

- Dose 1: 40 mg
- Time of dose 1: 09:00
- Dose 2: 0 mg
- Dose 3: 0 mg
- Check the level at: 12:00
- Level to wait for: 50 mg
- Half-life: 5 h
- **Caffeine left at the check time: 26 mg**
- **Below your level from: 09:00**
- **Time after the last dose: 0 s**
- Checked against: Python 3.8 decimal: 40 × 0.5^(3/5) = 26.3902; 40 mg ≤ 50 mg from the start

### Three doses, 6-hour half-life

- Dose 1: 95 mg
- Time of dose 1: 08:00
- Dose 2: 64 mg
- Time of dose 2: 13:00
- Dose 3: 80 mg
- Time of dose 3: 15:30
- Check the level at: 23:00
- Level to wait for: 50 mg
- Half-life: 6 h
- **Caffeine left at the check time: 71 mg**
- **Below your level from: 02:00 (+1 day)**
- **Time after the last dose: 10 h 29 min 6 s**
- Checked against: Python 3.8 decimal: sum of three decays at 23:00 = 70.5884; 15:30 + 6·log2(167.888/50) h = 01:59:06 next day, rounded up

## Questions

### How long does caffeine stay in your system?

With the average 5-hour half-life, half of a dose is still in your body after 5 hours, a quarter after 10 and about 3% after 25, so 200 mg of coffee at 08:00 leaves 50 mg at 18:00. Half-lives in healthy adults range from about 1.5 to 9.5 hours (Antonio et al., Journal of the International Society of Sports Nutrition, 2024), so the same cup can last several times longer in one person than in another.

### How much caffeine is too much in a day?

For most healthy adults the FDA cites 400 mg a day, about two to three 12 fl oz cups of brewed coffee, as an amount not generally associated with negative effects. The FDA estimates that toxic effects such as seizures can appear after rapidly consuming about 1,200 mg. The calculator warns when the doses you enter add up to more than 400 mg.

### How long before bed should you stop drinking caffeine?

At least 8.8 hours for a 107 mg cup of coffee and 13.2 hours for a 217.5 mg pre-workout drink, according to a 2023 meta-analysis of 24 studies in Sleep Medicine Reviews (Gardiner et al.). Across those studies caffeine cut total sleep by 45 minutes and added 9 minutes to the time taken to fall asleep. In an earlier trial, 400 mg taken 6 hours before bed still disrupted sleep (Drake et al., 2013).

### How much caffeine is in coffee and tea?

The FDA gives 113 to 247 mg for 12 fl oz of brewed coffee, 71 mg for black tea, 37 mg for green tea, 23 to 83 mg for soft drinks and 41 to 246 mg for energy drinks of the same size; 8 fl oz of decaf has 2 to 15 mg. Brewing method and cup size change the dose, so use the label figure where there is one.

### How much caffeine is safe during pregnancy?

Less than 200 mg a day. The American College of Obstetricians and Gynecologists' Committee Opinion 462 states that intake below 200 mg a day does not appear to be a major contributing factor in miscarriage or preterm birth. Caffeine is also cleared more slowly: one study measured a mean half-life of 8.3 hours in pregnant women against 3.4 hours in other adults (Knutti et al., 1981), so a longer half-life gives a more realistic curve.

### How accurate is the caffeine half-life calculator?

Accuracy depends on your inputs and the method's assumptions. Decimal arithmetic uses 50 significant digits, but estimates, numerical methods and source data can be less precise; the displayed rounding does not remove those limits. It is checked against 5 worked examples whose answers come from independent sources; for example, “200 mg at 08:00, checked at 18:00 (two half-lives)” is checked against Python 3.8 decimal: 200 × 0.5^(10/5) = 50; threshold reached at 5 × log2(200/50) = 10 h.

### Where does the method come from?

Institute of Medicine (US) Committee on Military Nutrition Research. Caffeine for the Sustainment of Mental Task Performance (2001) — pharmacology of caffeine; FDA — Spilling the beans: how much caffeine is too much?; Antonio J et al. Common questions and misconceptions about caffeine supplementation. J Int Soc Sports Nutr 2024;21:2323919 (mean half-life about 5 h, range 1.5–9.5 h); Gardiner C et al. The effect of caffeine on subsequent sleep: a systematic review and meta-analysis. Sleep Med Rev 2023;69:101764.

## Sources

- [Institute of Medicine (US) Committee on Military Nutrition Research. Caffeine for the Sustainment of Mental Task Performance (2001) — pharmacology of caffeine](https://www.ncbi.nlm.nih.gov/books/NBK223801/)
- [FDA — Spilling the beans: how much caffeine is too much?](https://www.fda.gov/consumers/consumer-updates/spilling-beans-how-much-caffeine-too-much)
- [Antonio J et al. Common questions and misconceptions about caffeine supplementation. J Int Soc Sports Nutr 2024;21:2323919 (mean half-life about 5 h, range 1.5–9.5 h)](https://doi.org/10.1080/15502783.2024.2323919)
- [Gardiner C et al. The effect of caffeine on subsequent sleep: a systematic review and meta-analysis. Sleep Med Rev 2023;69:101764](https://doi.org/10.1016/j.smrv.2023.101764)

_Note: medical information, not professional advice._
