The method returns a DOMHighResTimeStamp, measured in milliseconds.

The timestamp is not actually high-resolution. To mitigate security threats such as Spectre, browsers currently round the result to varying degrees. (Firefox started rounding to 2 milliseconds in Firefox 59.) Some browsers may also slightly randomize the timestamp. The precision may improve again in future releases; browser developers are still investigating these timing attacks and how best to mitigate them.

Note: This feature is available in Web Workers.

The returned value represents the time elapsed since the time origin.

Bear in mind the following points:

  • In dedicated workers created from a Window context, the value in the worker will be lower than in the window who spawned that worker. It used to be the same as t0 of the main context, but this was changed.
  • In shared or service workers, the value in the worker might be higher than that of the main context because that window can be created after those workers.


t =;


var t0 =;
var t1 =;
console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.");

Unlike other timing data available to JavaScript (for example, the timestamps returned by are not limited to one-millisecond resolution. Instead, they represent times as floating-point numbers with up to microsecond precision.

Also unlike, the values returned by always increase at a constant rate, independent of the system clock (which might be adjusted manually or skewed by software like NTP). Otherwise, performance.timing.navigationStart + will be approximately equal to

Reduced time precision

To offer protection against timing attacks and fingerprinting, the precision of might get rounded depending on browser settings.
In Firefox, the privacy.reduceTimerPrecision  preference is enabled by default and defaults to 20us in Firefox 59; in 60 it will be 2ms.

// reduced time precision (2ms) in Firefox 60;
// 8781416
// 8781814
// 8782206
// ...

// reduced time precision with `privacy.resistFingerprinting` enabled;
// 8865400
// 8866200
// 8866700
// ...

In Firefox, you can also enable privacy.resistFingerprinting — this changes the precision to 100ms or the value of privacy.resistFingerprinting.reduceTimerPrecision.microseconds, whichever is larger.


Specification Status Comment
High Resolution Time Level 2
The definition of '' in that specification.
Candidate Recommendation Stricter definitions of interfaces and types.
High Resolution Time
The definition of '' in that specification.
Recommendation Initial definition

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 20.0 webkit
24.0 [1]
(Yes) 15.0 (15.0) [2] 10.0 15.0 8.0
on Web workers 33 ? 34.0 (34.0) ? ? ?
now() in a dedicated worker is now separate from the main context's now(). ? ? 45.0 (45.0) ? ? ?
Feature Android Android Webview Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support 4.0 25.0 (Yes) 15.0 (15.0) [2] 10.0 No support 9 25.0
on Web workers ? (Yes) ? 34.0 (34.0) ? ? ? (Yes)
now() in a dedicated worker is now separate from the main context's now(). ? ? ? 45.0 (45.0) ? ? ? ?

[1] Windows versions of Chrome 20 through 33 return only to millisecond precision.

[2] Starting with Firefox 57.0.4, the accuracy of this function has been reduced, first to 20 microseconds and subsequently (in Firefox 59) to 2 milliseconds, while the Mozilla team investigate a security issue related to the precise timing of events. The precision may be improved again in a future release.

See also