A Unix timestamp in microseconds counts the number of microseconds (one-millionth of a second) since the epoch 1970-01-01T00:00:00Z. Microsecond resolution appears in databases such as PostgreSQL timestamptz, in tracing systems, and in scientific data. Because these values can be larger than JavaScript can represent exactly with a normal number, this converter uses BigInt to keep every digit correct.
Where microsecond timestamps appear
Microsecond resolution is common in systems where performance matters at the sub-millisecond level:
- PostgreSQL
timestamptzandtimestamp— PostgreSQL stores timestamps internally as microseconds since 2000-01-01, but externally these are often presented as Unix epoch microseconds when queried via clients or exported to data pipelines. - Distributed tracing — systems like Jaeger, Zipkin, and OpenTelemetry record span start and duration in microseconds to distinguish calls that happen in rapid succession.
- High-frequency data — financial tick data, sensor logs, and scientific instruments often need microsecond precision to maintain ordering across events that occur within the same millisecond.
- Python’s
datetime— Python’sdatetime.datetime.timestamp()returns a float in seconds, butdatetime.utcnow().timestamp() * 1_000_000is a common pattern for microsecond epoch values. - ClickHouse and analytical databases — column types like
DateTime64(6)operate in microseconds and export epoch-microsecond integers.
The JavaScript precision problem
JavaScript’s Number type is a 64-bit floating-point value, which gives it only 53 bits of mantissa. This means integers larger than 2^53 - 1 (about 9 × 10¹⁵, or 9 quadrillion) cannot be represented exactly. A present-day microsecond timestamp is around 1.7 × 10¹⁵ — still within the safe range, but approaching it. To be safe and future-proof, this tool uses BigInt throughout so no precision is lost regardless of the timestamp value.
How it works
The tool parses the microsecond value as a BigInt, then splits it into whole milliseconds and a remaining microsecond fraction:
const us = BigInt(input);
const ms = us / 1000n; // whole milliseconds
const remUs = us % 1000n; // leftover microseconds (0..999)
const date = new Date(Number(ms));
The Date gives the calendar date-time down to the millisecond, and the leftover remUs is appended to the fractional-seconds part of the ISO-8601 output so no precision is lost. To encode, the tool parses the date to milliseconds and multiplies by 1000n.
A present-day microsecond timestamp is about 16 digits, for example 1700000000000000. If your value has ~13 digits it is in milliseconds; ~10 digits means seconds.
Tips and notes
- BigInt is used so timestamps past
Number.MAX_SAFE_INTEGER(about 9 quadrillion) stay exact. - Date-time parsing only resolves to millisecond precision, so encoding a string yields a microsecond value ending in three zeros unless the string itself carries microsecond digits.
- Always store the canonical UTC form; local time is for display only.
- To convert microseconds to milliseconds: divide by 1,000. To seconds: divide by 1,000,000.
All conversions run locally in your browser — nothing is uploaded.