s / ms / μs / ns

Unix ns / μs

Decode or build Unix time at second through nanosecond resolution.

Unix precision

Paste an integer (auto-detects unit by length), or pick a date.

This page converts POSIX time at four resolutions: seconds, milliseconds, microseconds, and nanoseconds. Paste an integer and leave Unit on Auto, or force a unit when the digit length is misleading. Pick a UTC calendar date to emit all four integers at midnight. The everyday Unix timestamp converter still owns live “now” and common second-or-millisecond debugging. This spoke is the BigInt round-trip for μs and ns, so low digits are not rounded away before the civil ISO line is shown.

Digit length is the unit checksum

Languages disagree on the unit hiding inside an integer named epoch. Go’s time.UnixNano, Java’s System.currentTimeMillis, Python’s time.time_ns, MySQL FROM_UNIXTIME, and JavaScript Date.now() all sit on the same timeline with different multipliers. A ten-digit value is usually whole seconds. Thirteen digits are usually milliseconds. Sixteen digits are usually microseconds. Nineteen digits are usually nanoseconds. Pasting a nineteen-digit payload into a seconds field yields a civil date in the far future and a silent production bug.

Auto-detect on this page uses the length of the absolute digit string: up to twelve digits as seconds, thirteen or fourteen as milliseconds, fifteen or sixteen as microseconds, and seventeen or more as nanoseconds. Override the Unit menu when a clock stores leftover trailing zeros, or when a test fixture pads a millisecond to nineteen digits. Digit length is a checksum, not a proof; a known civil midnight in 2026 is the better proof.

The sibling batch timestamp converter is for many second or millisecond lines. Hexadecimal seconds belong on the hex Unix page. Start and end of a UTC day belong on epoch bounds, which prints range edges rather than a single mystery integer.

Why BigInt instead of JavaScript Number

JavaScript’s Number cannot hold every nanosecond since 1970 as an integer. MAX_SAFE_INTEGER is 2^53−1. A nineteen-digit nanosecond already exceeds that safe integer range, so ordinary division rounds the low digits before you ever format a date. This page uses BigInt for microsecond and nanosecond input so the integer is divided with exact integer arithmetic, then converted to milliseconds only for the Date display step.

That display step still snaps to JavaScript Date millisecond resolution. Listed microseconds and nanoseconds in the result are reconstructed from the millisecond instant (ms×1,000 and ms×1,000,000). Sub-millisecond remainder from the original integer is not preserved after that reconstruction. Keep the original BigInt in the log if a forensic remainder below one millisecond matters.

Negative timestamps before 1970 are valid POSIX values and are accepted. Very large future values may be outside the range Date can represent; the form errors instead of wrapping. This is a browser clock limit, not a POSIX spec limit.

How to convert without a hardcoded civil example

Paste the integer from the log. Leave Unit on Auto unless you already know the column’s unit. Read the ISO-8601 UTC line, then read the four listed integers. To go the other way, pick a calendar date; the page emits seconds, milliseconds, microseconds, and nanoseconds for that UTC midnight. Recalculate a sample for 2026 when writing docs so screenshots match current digit lengths.

A Python service that stores time.time_ns() and a browser chart that uses Date.now() must meet on the same instant. Convert one sample both ways so the chart’s millisecond axis matches the nanosecond column after dividing by one million. Database migrations from DATETIME to BIGINT should name the unit in the column (ts_ms versus ts_ns). Convert a known civil date here and paste the integer into a unit test.

Share seconds in URLs on the classic Unix page. Use this page when the payload is microseconds or nanoseconds. Sort keys in data lakes should stay integers, not formatted strings. Convert a known midnight in 2026 once, store the integer, and never parse locale dates back from CSV exports.

POSIX days, leap seconds, and other epochs

POSIX time does not include leap seconds. A nanosecond field cannot represent 23:59:60. Civil days here have 86,400 labeled seconds. For TAI or GPS linear seconds, which do not skip leap seconds the same way, use GPS / TAI time. Do not expect this converter to prove whether a leap second was inserted.

This is not a wall-clock timezone converter. Attach a zone only when displaying; store UTC integers. Wrong epoch plus wrong unit stacks two errors. If the integer might actually be FILETIME, WebKit, Cocoa, or NTP, start from the converters hub instead of forcing a Unix unit.

.NET 100-nanosecond ticks count from year 1, not from 1970. Those values belong on the .NET ticks converter even though the tick length is in the same ballpark as this page’s nanosecond field. A 18- or 19-digit integer is not automatically Unix nanoseconds.

Schema comments for 2026

If a column is named created_at but holds nineteen digits, assume nanoseconds until proven otherwise; if it holds thirteen, assume milliseconds. Write that guess in the schema comment the same day you convert a sample here. APIs should label the unit in the field name or in the OpenAPI description so clients do not sniff digit length in production.

Label the unit in logs too. A line that prints only “epoch=…” without s, ms, μs, or ns forces every reader to guess. Recalculate examples for 2026 when the runbook is reprinted so nobody copies a screenshot whose digit length no longer matches the code.

If two services disagree by a factor of 1,000, they are on adjacent units, not on different epochs. If they disagree by a factor of 1,000,000, one side is nanoseconds and the other is milliseconds. Convert one shared midnight through this page and paste both integers into the failing test. Do not “fix” the civil date string in a CSV; fix the unit in the writer.

Frequently asked questions

What unit does a nineteen-digit Unix integer usually represent?

Auto-detect treats seventeen or more digits as nanoseconds since 1970. A matching microsecond value is about sixteen digits, milliseconds about thirteen, and whole seconds about ten. Override the Unit menu when a clock stores leftover zeros. Confirm the civil ISO line against a known midnight in 2026 before trusting a log parser.

How does this page keep nanosecond integers from rounding?

Microsecond and nanosecond input is divided with BigInt integer arithmetic, then converted to milliseconds only for the Date display. JavaScript Number cannot hold every nanosecond since 1970 as a safe integer. Listed nanoseconds in the result are reconstructed from milliseconds, so keep the original integer if a remainder below one millisecond still matters.

Why can JavaScript Number not store every nanosecond?

Number is an IEEE floating value with a safe integer limit of two to the fifty-third minus one. A nineteen-digit nanosecond already exceeds that limit, so ordinary division rounds low digits before a date is formatted. BigInt avoids that rounding on the way down to milliseconds. The ISO line still cannot show leftover nanoseconds below one millisecond.

Is POSIX Unix time the same as TAI or GPS time?

No. POSIX time labels 86,400 seconds on each civil day and omits leap seconds from the count. TAI counts SI seconds continuously. GPS time equals TAI minus nineteen seconds and is usually stored as week plus seconds of week. Convert those scales on the GPS / TAI page rather than pasting them here as Unix nanoseconds.

When should epoch bounds be used instead of this converter?

Use epoch bounds when the job is the first and last second of a UTC day, month, or year—range edges for a query or partition. Use this page when the job is one integer at second through nanosecond resolution, including auto-detect by digit length. A single mystery value is not a bucket; a bucket is not a nanosecond payload.

How does auto-detect choose between seconds and milliseconds?

It uses the digit length of the absolute value: up to twelve digits as seconds, thirteen or fourteen as milliseconds, then microseconds and nanoseconds at longer lengths. Force the Unit menu when a fixture pads zeros or when a clock stores an unusual width. Digit length is a checksum; a known civil date in 2026 is the confirmation.

Processing, please wait...