Calculator · Sleep & recovery
Caffeine half-life calculator: when should you have your last coffee?
The calculator estimates how much caffeine is left at bedtime from the dose, when you took it and a half-life of 5 hours (you can choose 3–7). It also shows the latest time for caffeine if you want less than 50 mg left at bedtime. It only models your last dose, and people break down caffeine at different speeds.
Caffeine lasts a long time. The calculator works out how much caffeine is still in your body when you go to bed, and how late you can have your last cup if you want less than 50 mg left at bedtime. Everything runs in your browser, and nothing you enter is sent anywhere.
How to use the tool
- Enter how much caffeine your last dose contained, in milligrams. Not sure? The caffeine intake checker shows typical amounts in coffee, tea, cola and energy drinks.
- Enter when you had it and when you will go to bed.
- Leave the half-life at 5 hours, or choose between 3 and 7 hours.
- Read off how many milligrams are left at bedtime and the latest time to have less than 50 mg left.
How the calculation works
The calculator uses a simple model in which a fixed share of the caffeine is broken down each hour: after one half-life half is left, after two a quarter, and so on. The formula is: remaining = dose × 0.5^(hours since intake / half-life).
Example: you have 200 mg of caffeine at 15:00 and go to bed at 23:00. With a 5-hour half-life, about 66 mg is left at bedtime. To have less than 50 mg left, you would need to take that dose by about 13:00 – ten hours before bed.
The half-life matters a lot. With 3 hours, about 31 mg would be left in the example; with 7 hours, about 91 mg.
How to read the result
The 50 mg target is the tool's practical goal, not a limit from research. There are good reasons for caution, though. In a small study, 400 mg of caffeine disrupted sleep even when taken six hours before bedtime1. The European Food Safety Authority (EFSA) notes that as little as about 100 mg close to bedtime can make some adults take longer to fall asleep and sleep less2.
If you sleep badly, moving your last cup earlier in the day is a good first step. Try it for two weeks and see whether it makes a difference. The bedtime calculator helps you plan the rest of the evening.
Limitations
- The model only looks at your last dose. If you also had coffee earlier in the day, more caffeine is left. For a cautious estimate, enter the afternoon's total caffeine as one dose at the time of your last intake.
- The half-life varies a lot between people. Smoking speeds up the breakdown of caffeine, while some medicines and reduced liver function can slow it down.
- The same amount can affect sleep differently from one person to the next.
Learn more in the caffeine quiz, and find evening habits that help in the guide to better sleep.
Frequently asked questions
What is the half-life of caffeine?
When should I have my last coffee?
Can I sleep well even if I drink coffee in the evening?
Do smoking or medicines change how long caffeine lasts?
Sources
- Drake C, Roehrs T, Shambroom J, et al.. Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. J Clin Sleep Med 2013.
- EFSA Panel on Dietetic Products, Nutrition and Allergies (NDA). Scientific Opinion on the safety of caffeine. EFSA Journal 2015.
General information, not medical advice. Talk to a doctor about your own situation.