The timeStamp property is a read-only number: milliseconds from the page (or worker) time origin until the event was created. Learn MDN’s keypress demo, event deltas, reduced precision, and how it differs from Date.now()—with five examples and try-it labs.
01
Kind
Instance property
02
Type
number (ms)
03
From
Time origin
04
Use
Timing / deltas
05
Note
Reduced precision
06
Status
Baseline widely
Fundamentals
Introduction
Every event carries a creation time. event.timeStamp tells you how many milliseconds had passed since the document (or worker) started when that event was created.
That makes it great for measuring gaps between clicks, keys, or pointer moves—without depending on the user’s wall clock. Browsers may round the value slightly to reduce fingerprinting.
💡
Beginner tip
Think: timeStamp = “how long after this page started was this event born?” Not “what time is it on the clock?”
Concept
Understanding Event.timeStamp
An instance property that returns when the event was created, as a high-resolution timestamp in milliseconds.
Unit — milliseconds since the time origin.
Window origin — roughly when navigation / document loading began.
Worker origin — when the worker was created.
DOMHighResTimeStamp — high-res number; precision may be reduced for privacy.
Read-only — set by the browser when the event is created.
Baseline Widely available on MDN (since July 2015); also in Web Workers.
Foundation
📝 Syntax
JavaScript
event.timeStamp
Value
A number: milliseconds from the time origin until the event was created (a DOMHighResTimeStamp).
Event stamps are a natural clock for spacing user input without starting a separate timer.
Privacy
🛡️ Reduced Time Precision
MDN notes that browsers may round event.timeStamp to help protect against timing attacks and fingerprinting. In Firefox, reduced precision often defaults to about 2 ms; with stronger fingerprinting resistance it can be much coarser (for example 100 ms).
JavaScript
// With reduced precision, values may look "stepped":
// 9934, 10362, 11670, …
// or even multiples of 100 with stronger privacy settings.
For most UI timing (debounce-like gaps of hundreds of milliseconds), reduced precision is fine. Do not rely on microsecond-level differences in web apps.
Applications
🚀 Common Use Cases
Measuring time between user actions (double-click, combo keys).
Simple input throttling without setTimeout.
Logging relative event order / latency in demos.
Comparing synthetic vs real event timing in tests.
Teaching time origin vs wall-clock Date.
Under the Hood
🔧 How It Works
1
Time origin starts
Document navigation (or worker creation) begins the clock.
Origin
2
Event is created
Browser records how many ms have passed.
Create
3
Precision may shrink
Engines can round the stamp for privacy.
Privacy
4
✓
You read timeStamp
Handlers use the number alone or as a delta.
Important
📝 Notes
MDN: Baseline Widely available (since July 2015) — no Deprecated / Experimental / Non-standard banner.
Available in Web Workers.
Read-only DOMHighResTimeStamp in milliseconds.
Precision may be reduced (fingerprint / timing-attack protection).
Event.timeStamp is marked Baseline Widely available on MDN (since July 2015). Logos use the shared browser-image-sprite.png sprite from this project. It is also available in Web Workers. Precision may be reduced for privacy.
✓ Baseline · Widely available
Event.timeStamp
Read-only milliseconds since the time origin when the event was created (DOMHighResTimeStamp).
UniversalWidely available
Google ChromeFull support · Desktop & Mobile
Full support
Mozilla FirefoxFull support; may reduce precision (~2ms default)
Full support
Apple SafariFull support · macOS & iOS
Full support
Microsoft EdgeFull support · Chromium
Full support
OperaFull support · Modern versions
Full support
Internet ExplorerSupported (legacy behavior / precision differs)
Full support
Event.timeStampExcellent
Bottom line: Use timeStamp for relative event timing and deltas. Expect rounded precision; prefer Date only for wall-clock needs.
Wrap Up
Conclusion
Event.timeStamp is the event’s age in milliseconds since the time origin. Use it to display when an event fired, compute deltas, and space out input—while remembering browsers may round it for privacy.
Prefer it over Date.now() for in-page event timing
Expect rounded / stepped values
Log stamps when debugging input order
Keep throttle gaps well above precision noise
❌ Don’t
Assign event.timeStamp yourself
Treat it as calendar / wall-clock time
Rely on microsecond accuracy in the browser
Confuse it with performance.now() “now” samples
Build security on ultra-fine timing differences
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about timeStamp
When the event was created, relative to the time origin.
5
Core concepts
⏱️01
Number
milliseconds
API
🎯02
Origin
page / worker
Clock
🔁03
Deltas
subtract stamps
Pattern
🛡️04
Privacy
may be rounded
Note
🎯05
Baseline
since Jul 2015
Status
❓ Frequently Asked Questions
It is a read-only number on an Event: the time in milliseconds when the event was created, measured from the beginning of the time origin.
No. MDN marks Event.timeStamp as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard. It is also available in Web Workers.
In a Window, it is typically when navigation to the document started (for example when the user followed a link or a script started loading the document). In a worker, it is when the worker was created.
It is a DOMHighResTimeStamp. Spec-wise it can be accurate to about 5 microseconds, but browsers often reduce precision to help prevent fingerprinting and timing attacks.
Store the first event.timeStamp, then subtract it from a later event.timeStamp. That delta is in milliseconds (subject to reduced precision).
No. Date.now() is wall-clock time since the Unix epoch. event.timeStamp is relative to the document/worker time origin—better for comparing event timing within a page.
Did you know?
performance.now() and event.timeStamp share the same general idea of a high-resolution clock from the time origin, but they answer different questions: now in script vs when this event object was created.