Contoured 3D sleep mask
Best for: blocking light in rooms you cannot fully darken
Find the latest time you can have caffeine and still sleep well.

Have your last caffeine at or before this time and less than ~50 mg will still be in your body at bedtime. Around 50 mg (about half a cup of coffee) is roughly the level where caffeine can start to delay sleep and make it lighter.
At bedtime:
13 mg
✓ Under target, good for sleep
Target:
Under 50 mg
A practical rule of thumb, not a proven safe threshold.
The cutoff combines all entered pre-bed caffeine amounts as one conservative dose. Your actual caffeine total at bedtime also depends on when each drink was consumed and how quickly you clear caffeine.
Pregnancy, oral contraceptives, some medicines and liver disease can slow caffeine clearance.
As an Amazon Associate, Stacking Years earns from qualifying purchases. This does not affect our rankings.
Best for: blocking light in rooms you cannot fully darken
Best for: an evening routine
For each dose before bedtime: dose × 0.5^(hours elapsed / half-life), summed across doses. Doses after bedtime are excluded. A late-evening dose before an after-midnight bedtime is treated as occurring the previous evening.
The overall cutoff combines the entered pre-bed amounts as a single conservative dose and uses bedtime minus max(half-life × log₂(total dose ÷ 50), 0). The separate per-dose cutoff list uses the same rule for each drink. The 50 mg value is a practical rule of thumb, not a proven safe threshold. Drake et al. 2013 found 400 mg six hours before bed reduced sleep by about one hour (PMID 24235903). Gardiner et al. 2023 estimated a 107 mg coffee at least 8.8 hours before bed and a 217 mg pre-workout at least 13.2 hours before bed (PMID 36870101). Typical half-life is 3–7 hours (Institute of Medicine 2001; Nehlig 2018).
Related: Sleep setup guide · Sleep evidence · Caffeine review · Magnesium review
No. It is a practical rule of thumb used here to calculate a cutoff, not a validated threshold for everyone.
Caffeine clearance varies. Pregnancy, oral contraceptives, some medicines and liver disease can slow it; the calculator lets you compare 3-, 5- and 7-hour half-lives.
Only the doses you enter. Check labels for coffee, tea, energy drinks, chocolate, medicines and pre-workout products.
A calculator cannot diagnose insomnia or sleep apnea. Persistent sleep problems are worth discussing with a clinician.
Not medical advice. Talk to your doctor or pharmacist before starting supplements, especially if you take medication, are pregnant or have a health condition.