How it works
Because caffeine has a 5-6 hour half-life, the rule of thumb is to stop about 8-10 hours before bed. This page works the math backwards from your bedtime, so you get a clear number instead of a guess.
The calculator uses two marks: a standard cutoff (about 8 hours before bed) and a safer one (about 10 hours) for sensitive sleepers. If you sleep at 23:00, that lands your last coffee around 15:00, or 13:00 if you want more margin.
A morning coffee is usually fine — it is mostly gone by night. The cutoff mostly matters for afternoon and evening caffeine.
For the full picture, combine this with the half-life calculator, which shows how much caffeine is still present at bedtime.
Questions people actually ask
When should I stop drinking coffee for good sleep?
About 8-10 hours before bed. Bedtime 23:00 means a cutoff around 13:00-15:00.
Does an afternoon coffee affect sleep?
Yes. Because the half-life is 5-6 hours, a 4 pm coffee still leaves meaningful caffeine near bedtime.
What if I'm sensitive to caffeine?
Move your cutoff earlier and switch to decaf or herbal tea after it.
Can I have one cup in the morning?
Usually fine. Morning caffeine is mostly gone by night for most people.
What about decaf at night?
Decaf has 2-15 mg per cup. Most sleepers are fine; very sensitive ones may want to avoid it late.