Science
How caffeine actually works.
Caffeine is one of the few everyday molecules that you can actually feel entering your system.
After you drink coffee, caffeine is absorbed through the stomach and small intestine, then passes into the bloodstream. Within roughly 15 to 120 minutes, blood caffeine levels usually peak, depending on the person, the drink, food, digestion speed, and genetics. From there, caffeine travels easily through the body and crosses into the brain.
In the brain, caffeine does not create energy directly. Its main trick is that it blocks adenosine receptors. Adenosine is one of the molecules that builds up while you are awake and tells your brain, “you are getting tired.” Caffeine sits on those receptors and temporarily hides that tiredness signal. That is why coffee can make you feel sharper, faster, more focused, and less sleepy.
But the adenosine is not gone. It is just being masked. As caffeine wears off, that tiredness signal can return, sometimes all at once. This is one reason people feel a caffeine “crash,” especially if they are sleep-deprived or if they use coffee to push through real fatigue.
Caffeine also lasts longer than many people think. Its average half-life is around 5 hours, but it can vary widely, from about 1.5 to 9.5 hours depending on metabolism, genetics, pregnancy, smoking, medication, hormones, and liver function. That means a coffee at 3 p.m. may still be biologically active in the evening.
How cafein estimates caffeine in your blood
To turn that into a usable forecast, cafein uses a one-compartment bi-exponential pharmacokinetics model — the standard model used across caffeine pharmacokinetics literature. Each cup is treated as a dose that rises over the first 30–45 minutes (absorption), peaks, then decays exponentially at a rate set by your half-life. The chart below shows what a single 100 mg coffee looks like across 12 hours at the population-default 5 hour half-life. Multiple cups stack the same way: cafein adds each curve. If you metabolise faster or slower than average, you can calibrate your half-life in Settings, and every projection on the home screen updates accordingly.
How this affects sleep
Sleep is not only about feeling tired. It depends on a delicate balance between your circadian rhythm, sleep pressure, body temperature, hormones, and brain chemistry. Because caffeine blocks adenosine, it can make your brain feel less ready for sleep even when your body needs it. For some people, late caffeine delays sleep onset, reduces sleep depth, or makes sleep feel lighter.
The first coffee of the morning
When you wake up, your body naturally increases alertness through the cortisol awakening response and other wake-up signals. Some people prefer delaying coffee by 60–90 minutes so the body gets a chance to wake itself up first, and then caffeine is used more strategically instead of immediately overriding natural hormones. The evidence is mixed, though: delaying coffee is not a universal rule, but it can help people who notice morning dependence, jitters, or afternoon crashes.
The smarter question
So the smarter question is not just “how much coffee did I drink?” It is also: when did I drink it, how strong was it, and how did I sleep after? Tracking coffees during the day helps you connect the dots between caffeine timing, energy, crashes, anxiety, heart rate, and sleep quality. Over time, you can learn your personal caffeine cutoff — the latest time you can drink coffee and still fall asleep well. That turns coffee from a random habit into something you can use with more control: energy when you want it, sleep when you need it.
Sources
- Institute of Medicine / NCBI Bookshelf — Pharmacology of Caffeine. Caffeine absorption, peak blood concentration timing, and half-life range.
- Reichert et al., 2022 — Adenosine, caffeine, and sleep–wake regulation. Mechanism of caffeine blocking adenosine receptors and its role in sleep pressure.
- Temple et al., 2017 — The Safety of Ingested Caffeine: A Comprehensive Review. Caffeine bioavailability, timing, safety context, and adult intake thresholds.
- Gardiner et al., 2023 — The effect of caffeine on subsequent sleep: A systematic review and meta-analysis. Measured effects on sleep duration, sleep efficiency, sleep onset, and deep sleep.
- Lovallo et al., 2005 — Caffeine Stimulation of Cortisol Secretion Across the Waking Hours. Nuance around caffeine and cortisol: caffeine can affect cortisol, but the “delay morning coffee” rule is not fully settled science.
- McLellan et al., 2016 — A review of caffeine’s effects on cognitive, physical and occupational performance. Effects on alertness, attention, performance, and the core mechanism as an adenosine receptor blocker.

