Latest Sip Time
{{ cutoff_time_short || '—' }}
Stay under {{ ST.formatNumber(Number(threshold_mg) || 0, 1) }} mg by {{ bedtime_short || '—' }}. Day total {{ ST.formatNumber(projectedDailyTotal, 0) }}/{{ ST.formatNumber(safetyProfile.dailyLimit, 0) }} mg.
{{ cutoff_lead_display }} lead {{ metabolismBadgeText }} {{ thresholdBadgeText }} {{ candidate_status_label }} Cap {{ candidate_time_short || 'now' }}: {{ candidate_safe_dose_display }} {{ window_status_display }}
{{ cutoffVisualAriaLabel }} Sip Peak Bed {{ cutoffVisualMarker }}
Pick a serving preset, then edit the dose if your drink label or cafe listing differs.
Enter milligrams for one serving, e.g. 95 for brewed coffee or 160 for an energy drink.
mg
Use 24-hour local time; Auto rolls a passed clock time to tomorrow.
{{ statusAlertText }}
Choose a preset half-life, or select Custom and type hours below.
Use hours; typical adult planning often starts near 4-6, while conservative plans may use 7-8.
h
Pick a 10-40 mg preset, or choose Custom and enter your target below.
Enter milligrams allowed at lights-out, e.g. 20 for sleep-sensitive planning.
mg
Use current time, or choose Check a clock time and enter a local HH:MM.
Enter minutes from first sip to peak effect; 30-60 is a common planning range.
min
Enter extra no-caffeine minutes before bedtime, such as 30 or 60.
min
Compare projected total against adult 400 mg, pregnancy 200 mg, or sensitivity-aware 300 mg.
Enter caffeine already consumed today in mg; leave 0 when checking only this drink.
mg
Choose a 3-8 hour guardrail; the result table shows whether it is stricter than the model.
Metric Value Copy
{{ row.label }} {{ row.value }}
Scenario Time Lead Before Bed Residual @ Bed Safe Max Dose Status Copy
{{ row.label }} {{ row.time }} {{ row.lead }} {{ row.residual }} {{ row.safeDose }} {{ row.status }}

                
Customize
Advanced
:

Introduction

Caffeine timing is a dose-and-clock problem, not just a question of whether a drink counts as coffee. A small tea at lunch, a large cold brew after work, and a pre-workout drink before an evening session can leave very different amounts of caffeine in the body at bedtime. The drink name gives a rough clue, but the milligrams, the clock time, and the person's clearance rate decide most of the sleep risk.

Caffeine blocks adenosine signaling, which is one reason it can make alertness feel easier. That same effect can become inconvenient at night because sleep pressure is supposed to build as the day goes on. People often focus on total daily caffeine, yet the last serving can matter even when the daily total stays inside a general guideline. A late 80 mg dose can be more disruptive than an earlier 160 mg dose if too little clearance time remains before lights-out.

Timeline showing latest sip, absorption, caffeine decay, and bedtime residual target

The useful planning question is usually backward: how early must the last serving happen for a chosen bedtime target? That answer changes when the dose changes, when the assumed half-life changes, or when the residual target becomes stricter. A person trying to keep bedtime residual caffeine near 10 mg needs a much earlier cut-off than someone using a 40 mg planning target.

Half-life
The time required for the modeled active amount to fall by half after absorption. It is a planning assumption, not a personal lab result.
Residual target
The amount of caffeine the plan allows to remain at bedtime. Lower targets are more conservative for sleep-sensitive planning.
Lead time
The time between the last sip and bedtime after adding absorption, decay, and any personal buffer.

Daily limits and sleep timing answer different questions. General adult guidance often discusses total daily intake, while sleep timing depends on what remains near bedtime. A person can stay under a daily guide and still drink too late. The reverse can also happen: a late tiny dose may fit a residual target but still deserves caution for someone who reacts strongly to caffeine.

No single cut-off is a universal safety line. Pregnancy, liver disease, medicines, smoking status, genetics, age, anxiety, heart rhythm concerns, insomnia, alcohol, nicotine, and sleep debt can all change how caffeine feels or clears. A calculated cut-off is best read as a transparent planning estimate, with conservative settings for anyone who has noticed caffeine-related sleep trouble.

How to Use This Tool:

Start with the drink and bedtime, then adjust the clearance assumptions until the result reflects the kind of night you are planning for.

  1. Choose a Drink preset for a common serving, or choose Custom and enter the exact Caffeine dose from a label, cafe listing, or supplement panel.
  2. Set Target bedtime. Auto rolls a past clock time to tomorrow; use Tonight or Tomorrow when the date should stay fixed.
  3. Select a Metabolism profile. The presets use fast, typical, slow, or pregnancy-focused half-life assumptions, and editing Half-life turns the profile into a custom value.
  4. Pick a Threshold profile. The 10 mg and 20 mg targets are stricter sleep-sensitive checks, while 30 mg and 40 mg allow more modeled caffeine at bedtime.
  5. Open Advanced to test a specific Candidate drink time, adjust Absorption time, add an Extra buffer, compare a fixed sleep guardrail, or include Consumed earlier today for the daily total check.
  6. Read the summary before the charts. Latest Sip Time, lead time, candidate status, safe dose cap, daily allowance, and window status tell you whether the current plan fits.
  7. Use Latest Sip Plan for the row-by-row timing values, Residual Curves for the modeled decay trace, Dose-at-Time Map for dose and lead-time tradeoffs, and Timing Scenarios for candidate, guardrail, and drink-now comparisons.

Fix any missing bedtime or non-positive dose warning before relying on the output. If a candidate drink is late, compare Safe max dose at candidate time with the planned dose before deciding whether to lower the caffeine amount or move the serving earlier.

Interpreting Results:

Latest sip time is the main cut-off for the selected dose, bedtime, half-life, absorption time, buffer, and residual target. Drinking at that boundary lands on the modeled bedtime threshold. Drinking later requires a smaller dose, a looser threshold, a later bedtime, or acceptance that the candidate is outside the selected plan.

  • Lead time to bedtime combines absorption, modeled decay, and any extra buffer.
  • Candidate residual @ bedtime compares a proposed drink time with the selected target. The comparison sign shows whether the residual is at or below the target.
  • Safe max dose at candidate time reverses the same decay model to show the largest dose that would fit that time window.
  • Projected daily total and Remaining allowance compare earlier intake plus the planned dose against the selected daily guide.
  • Model vs guardrail shows whether the half-life model or a simple no-caffeine-before-bed rule is stricter.

A candidate that fits the target is not a promise of unaffected sleep. It means the modeled residual amount is at or below the selected threshold. Use a lower threshold, a longer half-life, or an extra buffer when your own sleep history suggests that the default settings are too permissive.

Daily-limit warnings should be read separately from the bedtime residual. Consumed earlier today affects the daily total and allowance, but the residual curve models the single planned serving rather than a full caffeine diary.

Technical Details:

Caffeine clearance is modeled with first-order elimination after an absorption period. First-order elimination means the remaining amount falls by the same fraction over each half-life. The absolute milligrams removed per hour are larger soon after a big dose and smaller later, but the halving pattern stays constant under the selected assumption.

The model separates three clocks. Absorption time is added before the decay target is evaluated, half-life controls the exponential decline, and the optional buffer moves the practical cut-off earlier without changing the chemistry. The residual target is a planning threshold in milligrams, not a medical sleep threshold.

Formula Core:

For a planned dose larger than the bedtime target, the cut-off is solved by finding how many half-lives are needed to reduce the dose to the target:

n = ln(D/T)ln(2) tdecay = n×thalf tlead = tabsorb+tdecay+tbuffer tcutoff = tbedtime-tlead R(t) = D×0.5t/thalf

D is the planned caffeine dose, T is the bedtime residual target, n is the required number of half-lives, and R(t) is the remaining amount after t hours of decay. When D ≤ T, required decay time is zero, so lead time comes only from absorption and buffer.

A 95 mg coffee with a 30 mg bedtime target needs ln(95 / 30) / ln(2) = 1.66 half-lives. With a 5 hour half-life, that is about 8 h 19 m of decay. Adding 45 minutes of absorption makes the total lead time about 9 h 4 m.

Preset and Boundary Rules:

Caffeine planning presets and calculation effects
Profile area Built-in value Effect
Half-life 3.5 h, 5 h, 7 h, or 8 h Longer half-life assumptions move the cut-off earlier for the same dose and target.
Bedtime target 10 mg, 20 mg, 30 mg, or 40 mg Lower residual targets require more lead time.
Daily guide 400 mg, 300 mg, or 200 mg Compares total daily exposure, not bedtime residual from every earlier drink.
Fixed guardrail 3 to 8 hours before bed Provides a simple clock rule beside the half-life model.

Candidate-time residuals use a ramp when the candidate is so close to bedtime that absorption has not completed. After the absorption window, residual caffeine follows the exponential decay equation. The safe-dose value reverses the formula by asking how large D can be while still reaching T by bedtime after absorption and buffer are subtracted from the available lead time.

Caffeine timing inputs and interpretation boundaries
Input or comparison Changes latest sip? Important boundary
Caffeine dose Yes A larger dose needs more half-lives to reach the same bedtime target.
Absorption time Yes It is added to lead time before decay is considered complete.
Extra buffer Yes It moves the cut-off earlier as a planning margin.
Consumed earlier today No It affects the daily total check only.
Candidate drink time No It tests a proposed time against the already-computed cut-off.

The model does not estimate accumulation from several earlier servings, sleep-stage effects, tolerance, circadian timing, stimulant medicines, liver function, or personal sensitivity. Those factors can make a conservative cut-off more appropriate than the default adult planning assumptions.

Limitations and Privacy:

The result is an informational planning estimate for one modeled serving. It should not be used as a personal medical limit, a pregnancy caffeine prescription, or proof that a drink will not affect sleep.

  • Drink presets are approximate. Use product-specific milligrams when the label, cafe, or supplement maker publishes them.
  • Half-life presets are broad planning assumptions. Personal clearance can be faster or slower.
  • Daily guide comparisons are not individualized advice for pregnancy, cardiovascular disease, blood pressure, anxiety, insomnia, or medication interactions.
  • The calculation runs in the browser and does not require uploads, accounts, or external caffeine database lookups. Copied rows, downloads, and shared URLs can still contain the values you entered.

Worked Examples:

Standard coffee before a 10:00 PM bedtime. A 95 mg dose, 5 hour half-life, 30 mg bedtime target, and 45 minute absorption time need about 9 h 4 m of lead time. The latest sip lands near 12:56 PM, with 1.66 required half-lives.

Testing a 4:00 PM candidate drink. With the same coffee and bedtime settings, the candidate has six hours before bed. The modeled bedtime residual is about 45.9 mg > 30 mg, so the safe dose at that time is about 62 mg and the dose reduction needed is about 33 mg.

Daily total warning without changing the cut-off. A planned 160 mg drink after 260 mg earlier in the day gives a projected daily total of 420 mg under the healthy adult guide. The bedtime cut-off still comes from the planned serving, bedtime, half-life, absorption, buffer, and residual target.

Boundary case. If the entered dose is at or below the bedtime target, decay time is zero. The latest sip still moves earlier by the absorption time and any extra buffer because the plan reserves time for peak effect and personal margin.

FAQ:

Why can the cut-off be earlier than a six-hour rule?

A six-hour rule ignores dose, residual target, and half-life. A large dose, slow half-life, strict target, absorption time, or extra buffer can push the modeled cut-off earlier.

Do earlier drinks change the residual curve?

No. Consumed earlier today changes Projected daily total and Remaining allowance. The residual curve is based on the single planned serving.

Why did the bedtime roll to tomorrow?

Auto date mode treats a passed bedtime clock value as the next occurrence of that time. Choose Tonight or Tomorrow when you need a fixed date rule.

Can this replace medical advice during pregnancy?

No. The pregnancy-focused half-life and daily guide settings are conservative planning aids. Use clinician guidance for personal limits and symptoms.

Are the drink presets exact?

No. They are common serving anchors. Choose Custom when product labels, nutrition data, or cafe listings give a more accurate caffeine amount.

Glossary:

Absorption time
The modeled time between the first sip and peak active amount before decay is counted.
Bedtime threshold
The maximum modeled caffeine amount allowed at bedtime under the selected plan.
Candidate time
A proposed drink time tested against the computed cut-off.
Half-life
The time required for the modeled active caffeine amount to fall by half.
Safe max dose
The largest modeled dose that fits the selected residual target at the candidate time.

References: