Countdown Timer — Online, With Alarm
Count down to a duration or a target date, with an audible alert. Stays accurate while the tab is in the background.
Why most browser timers drift, and this one does not
The obvious way to build a timer is setInterval(tick, 1000) with a counter. It is also wrong, in two compounding ways.
First, setInterval does not fire at exactly 1000 ms. It fires at least 1000 ms later, when the main thread is free. Under load each tick arrives slightly late, and because the counter increments per tick rather than per elapsed second, the error accumulates. Over an hour a naive timer can drift by many seconds.
Second, and far worse, browsers throttle timers in background tabs — typically to once per second, and after a few minutes of inactivity to once per minute or less. Chrome and Safari both do this to save battery. A tick-counting timer in a background tab simply stops counting properly, and returns a badly wrong value when you switch back.
The fix is to stop counting ticks. Record the target time once as an absolute timestamp, then on every render compute target − Date.now(). The interval becomes a repaint trigger rather than the source of truth. Throttling then affects only how often the display updates, and the moment the tab regains focus the correct value appears.
The alarm is scheduled the same way — against the absolute target — so it fires at the right time regardless of how often the tab was allowed to run.
What this is good for
- Pomodoro and focus blocks —25 minutes of work, 5 minutes of break. The background accuracy matters here specifically, since the whole point is to not be looking at the tab.
- Cooking and brewing —Coffee and tea steeping, where 30 seconds either way is genuinely noticeable.
- Timeboxing meetings —A visible countdown on a shared screen is a more effective time limit than a chairperson.
- Counting down to a date —Launches, deadlines, events. Set a target date rather than a duration.
- Exercise intervals —Though a dedicated interval timer handles repeating work/rest cycles better than a single countdown.
About
The Countdown Timer counts down from any hours-minutes-seconds value and plays an audio alert when it reaches zero. It runs entirely in your browser tab so you can keep it open alongside your work. Multiple laps and a count-up mode are also supported.
How to use
- 1 Enter the hours, minutes, and seconds for your countdown.
- 2 Click Start to begin the timer.
- 3 Click Pause to pause it, and Resume to continue.
- 4 When the timer reaches zero, an audio alert plays automatically.
- Will the alarm play if I switch to another browser tab?
- Yes. The timer uses the Web Audio API and continues running in the background even when the tab is not active. The audio alert will play at the set time regardless of which tab is in focus, as long as the browser has not suspended the tab entirely.
- Can I set a timer for more than one hour?
- Yes. The hours field accepts any value, so you can set timers for multiple hours — for example, a 2-hour deep-work session or a 90-minute pomodoro cycle. There is no upper limit on the hours value.
- Does the countdown timer work offline?
- Yes. Once the page is loaded, the timer runs entirely in your browser with no network requests. You can disconnect from the internet and the timer will continue counting down and play the alarm normally.
More in Date & Time
See all date & time.