High resolution timer precision
performance.now() returns a clock whose coarseness depends on browser and isolation.
In one line
Can use a clock whose sharpness shows your browser and privacy mode
performance.now() returns a clock whose coarseness depends on browser and isolation.
Timer resolution is a deliberate defense against timing attacks. The resolution itself tells a site the browser and whether privacy mode or cross-origin isolation is on, and limits attacks like cache timing.
What it can and can't do
What the user does: Nothing. It happens when the page loads
It can
- Check how fine the page timer is
- Guess your browser from that sharpness
- Tell if privacy mode or cross origin protection is on
It cannot
- Get a very sharp clock without extra protections
- Ask permission first
- See your files
- Know who you are by itself
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 24 | 2013-01-10 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 15 | 2012-08-28 | None |
| Safari | Supported | 8 | 2014-10-16 | None |
| Safari on iPhone | Supported | 9 | 2015-09-16 | None |
| Chrome on Android | Supported | 25 | 2013-02-27 | None |
| Samsung Internet | Supported | 1.5 | 2013-09-25 | None |
How a site asks for it
| API | performance.now(); Date.now(); crossOriginIsolated |
| Browser compat keys | api.Performance.now |
| How access is granted | none |
| What the user sees | Not listed |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | Not listed |
| How to take it back | Not listed |
| Inside an iframe | Not listed |
Typical flow
- Call performance.now() in a tight loop
- Compute smallest nonzero delta
- Infer resolution and jitter
Data you get
What comes back: Milliseconds since time origin, fractional
Shape: float
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
performance.now() Chrome default | float | ms | 0 to unbounded | 100 microseconds (jittered) |
Chrome cross-origin isolated | float | ms | 0 to unbounded | 5 microseconds |
Firefox default | float | ms | 0 to unbounded | 1 ms (RFP: 16.67 ms) |
Safari | float | ms | 0 to unbounded | 1 ms |
Firefox cross-origin isolated | float | ms | 0 to unbounded | 20 microseconds |
Technical limits
- Cannot get nanosecond timing without cross-origin isolation (and still limited to about 5 microseconds)
- Jitter added per page, repeated sampling can average it out
The story
What it is
performance.now() gives a very fast clock, but browsers deliberately make it coarser unless the site is isolated.
For you
You never see it. It is why games and videos stay in sync. Browsers blur this clock on purpose to protect you from timing attacks, so most pages get a slightly rounded time.
For makers
Games, audio tools and animation need good timing to run smoothly. Browsers round the timer to stop attacks and fingerprinting, and give a finer clock only to isolated pages. The rounding level is also a clue about your browser.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A browser game uses the clock to step physics at an even rate, so movement does not jitter. | Krunker.io, Shell Shockers |
| music | A web synth or DAW uses precise time to line up notes on the beat. | Soundtrap, BandLab |
| video | A video call tool measures delay to adjust how it buffers voice and picture. | Google Meet |
| analytics | A speed monitoring tool uses it to time page steps from real visitors. | Datadog RUM |
| security | Researchers have shown fine timers can be abused for timing attacks, so browsers round them. | None named |
| ads | A tracker tests how coarse the clock is to guess which browser and privacy mode you use. | None named |
| creative | A web animation tool uses precise timing to keep previews smooth. | Figma |
Risks
- Precision hints at your browser
- Fine timers raise attack risk
What the platform says
- MDN: performance.now(). Returns a high resolution time for measuring how long things take, with precision limited for security.
- web.dev: Why COOP and COEP. Google explains that precise timers return only on pages that prove they are isolated from other sites.
Good uses and abuse
Legitimate uses
- Profiling and animation timing
Known abuse
- Side-channel attacks need finer timers; resolution fingerprints browser mode
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 1 | Rough identifying entropy, when known |
History
- 2018-01, all: Spectre: Chrome, Firefox, Safari coarsen performance.now() and Date; SharedArrayBuffer disabled
- 2018-03, Firefox 60: 1 ms precision default
- 2021-01, Firefox 79: Finer 20 microsecond precision only when cross-origin isolated
- 2021-05, Chrome 91: 100 microsecond cap on all platforms; 5 microseconds if cross-origin isolated
Related capabilities
Related
- Cross-origin isolation and SharedArrayBuffer clocks. Can use a very fine clock and shared memory, but only if the site opts in
- Cache timing history sniffing. Can time how fast something loads to guess if you visited a site before
Sources
How well checked: Checked against real behavior.