Guide
How accurate are online timers and stopwatches?
A timer in a browser tab has to cope with background tabs, sleeping laptops and locked phones. Some online timers drift or ring late because of it. Here is what browsers actually do, and how a timer can keep correct time anyway.
An online timer looks simple: show a number, make it smaller every second, beep at zero. But a web page doesn’t get to run whenever it likes. The browser decides when its code runs, and it has good reasons to run hidden pages as little as possible. Whether a timer stays accurate comes down to two choices: which clock it reads, and whether it counts ticks or measures time.
Two clocks, two jobs
Every browser offers two clocks, and they are good at different things:
| Clock | Wall clock (Date.now) | Monotonic clock (performance.now) |
|---|---|---|
| Measures | The date and time of day | Time since the page opened |
| Can jump | Yes, when the system clock is set or synced | No, it never goes backwards or skips |
| Resolution | 1 millisecond | Rounded to 100 microseconds |
| Best for | Counting down to a date | Timers and stopwatches |
If your computer corrects its clock by a few seconds while a timer runs, a timer built on the wall clock jumps by those seconds. One built on the monotonic clock doesn’t notice. For a countdown to a date weeks away, the wall clock is the right one, because the target is a moment on the calendar.
Counting ticks: the classic mistake
The obvious way to write a timer is to ask the browser to run some code every 1,000 milliseconds and subtract one second each time. That timer is wrong in three ways:
- Ticks run late. The browser runs a scheduled function at the first chance it gets after the delay, not exactly on time. If the page is busy, it waits. A few milliseconds lost per tick add up over an hour.
- Hidden tabs are throttled. To save battery, browsers run timers in background tabs much less often. Firefox on desktop waits at least a second, Firefox on Android can wait 15 minutes or unload the tab entirely, and Chrome has three levels:
| Situation | Timers run |
|---|---|
| Tab visible, or it played sound in the last 30 seconds | On time (at least 4 ms apart for rapid repeats) |
| Tab hidden | At most once per second |
| Hidden for over 5 minutes, silent for 30 seconds, and the timer has repeated 5 or more times | At most once per minute |
- Animations stop. Most browsers pause animation frames in background tabs completely, so anything that updates the time only when it redraws freezes.
Under Chrome’s once-a-minute rule, a tick-counting timer with five minutes left would need 300 ticks and get one per minute: it would ring about five hours late. The fix is simple: don’t count ticks. Record when the timer should end, and whenever the code does get to run, work out the time left from the clock. A late tick then only delays the screen update, never the time itself.
Sleeping laptops and locked phones
Background tabs are a solved problem. Devices that stop running altogether are not, and no web page can fully work around them:
- A sleeping computer. The monotonic clock is meant to keep counting while the computer sleeps, but MDN notes that only browsers on Windows currently do. On a Mac, for example, ten minutes with the lid closed may simply not count, and a timer ends ten minutes late.
- A locked phone. Mobile browsers pause pages that are off screen, and may freeze or unload them to save power. The time catches up when you return, but an alarm can’t sound while the page is paused.
- A dimming screen. Pages can ask the device to keep the screen on with the Screen Wake Lock API, available in all major browsers since 2025. The browser drops that request when the tab is hidden, and battery saver modes can refuse it.
How TickPickr keeps time
These are the choices in TickPickr’s own code, tool by tool:
- Online timer and focus timer. When you press Start, the end time is fixed on the monotonic clock. The display recalculates the time left five times a second, and a separate one-off timer is set for the exact end. Because it runs once rather than repeating, Chrome’s once-a-minute rule doesn’t apply to it, so in a background tab the alarm normally sounds within about a second of the end. Coming back to the tab updates the time straight away.
- The alarm is a beep generated in the browser, with no sound file to load. Browsers only allow sound after you have interacted with a page, so pressing Start also unlocks the audio.
- Keeping the screen on. While a timer or the stopwatch runs, TickPickr asks for a screen wake lock where the browser supports it, and asks again whenever you return to the tab.
- Stopwatch. The start, every lap and every stop are read straight from the monotonic clock. The animation only draws the digits, so when a background tab pauses it, nothing is lost.
- Countdown to a date. This one uses the wall clock on purpose, compared with the target date in your time zone, so it stays right across days of sleep and restarts.
The limits above still apply: on a computer outside Windows that goes to sleep, or a phone that locks, a TickPickr timer runs late by the time the device was stopped.
Getting the most reliable timing
- Keep the timer’s tab open. Another tab in front of it is fine.
- Check the sound is on and the device isn’t muted before you walk away.
- On a laptop, stop it sleeping for long timers, or keep it plugged in and open.
- On a phone, keep the screen on and plugged in. If you need the alarm with the phone in your pocket, the built-in clock app is the better tool.
- For timing a race or a lap, remember that your thumb is the slowest part: human reaction time is far longer than any clock error.
Using a timer to plan your work rather than your cooking? Read timeboxing vs time blocking.
Frequently asked questions
Does switching tabs slow down an online timer?
It slows down how often the page can run code, not time itself. Browsers check timers in hidden tabs as rarely as once a second, and in Chrome once a minute after five minutes. A timer that measures elapsed time from a clock stays correct; one that counts ticks falls behind.
Why did my timer stop when I locked my phone?
Mobile browsers pause or freeze pages that are not on screen to save battery, and the screen lock also releases any request to keep the screen on. The countdown catches up when you unlock, but an alarm can’t ring while the page is paused. For timers you need to hear with the phone locked, use the phone’s own clock app.
Why did the timer end late after my laptop was asleep?
The high-precision clock that timers rely on is supposed to keep counting during sleep, but according to MDN only browsers on Windows currently do. Elsewhere, the minutes the computer spent asleep may not count, so the timer ends that much later. Keep the computer awake for timers that matter.
Is an online timer accurate enough for cooking or exams?
Yes, as long as the tab stays open and the device stays awake. A timer that measures elapsed time is accurate to a fraction of a second over hours. The risks are a muted device, a sleeping laptop or a locked phone, not the timing itself.
How precise is the browser’s clock?
performance.now() reports time in fractions of a millisecond, but browsers deliberately round it to 100 microseconds (5 microseconds on specially isolated pages) for security reasons. That is still far finer than any stopwatch display or human reaction needs.