About Epoch Converter

Different platforms count time since the Unix epoch in different units: Unix tools and JWTs use seconds, JavaScript and Java use milliseconds, database columns and Python's time_ns use micro- or nanoseconds. Mixing them is one of the most frequent — and most confidently misdiagnosed — bugs in date handling. This converter translates a value between seconds and milliseconds explicitly, so you can verify the unit instead of guessing.

It complements the Timestamp Converter: use that one to turn timestamps into readable dates; use this one when the question is specifically 'is this value seconds or milliseconds, and what is it in the other unit?'

How to use Epoch Converter

  1. Use the input area to enter or paste your data.
  2. Use the main action button to run the tool.
  3. Copy or download the output as needed.

Example

Input

Your input or data here

Output

Result will appear here after running the tool

Why two (four, really) units exist

The original Unix time() returned whole seconds — enough for file mtimes in 1971. As systems needed finer resolution, each ecosystem picked its own multiplier: Java chose milliseconds for System.currentTimeMillis() (and JavaScript inherited it), databases went to microseconds for transaction ordering, and Go/tracing systems use nanoseconds. The number line is the same; only the tick size differs.

Conversion is exact multiplication or division by 1000 — with one subtlety: converting down (ms → s) truncates or rounds sub-second precision away. 1783150200999 ms floor-divides to 1783150200 s; the 999 ms is gone. When sub-second precision matters (event ordering, latency math), convert up, never down.

Identify the unit at a glance

For dates between 2001 and 2286, the digit count is unambiguous:

  • 10 digits (1.7×10^9): seconds — Unix tools, JWT exp/iat, most REST APIs.
  • 13 digits (1.7×10^12): milliseconds — JavaScript Date.now(), Java, Kafka timestamps.
  • 16 digits (1.7×10^15): microseconds — Postgres/MySQL internals, Python datetime.timestamp() scaled.
  • 19 digits (1.7×10^18): nanoseconds — Go time.UnixNano(), OpenTelemetry, Prometheus internals.

The classic failure modes

Passing seconds to new Date(n) in JavaScript lands you in January 1970 (n interpreted as ms). Passing milliseconds to a seconds API (JWT exp, Redis EXPIREAT, Unix touch) produces dates tens of thousands of years out — or, more insidiously, values that pass validation and simply never expire in a human lifetime. And double conversion (dividing by 1000 twice) shrinks a timestamp to a few days after the epoch. All three are one glance away from diagnosis once you count digits.

Common errors and how to fix them

new Date(timestamp) shows January 1970

Cause: You passed seconds to a milliseconds API — the value was read as ~20 days of milliseconds.

Fix: Multiply by 1000: new Date(seconds * 1000).

JWT never expires / expiry in year 58000

Cause: exp was written in milliseconds; validators compare it against seconds.

Fix: Divide by 1000 when minting: Math.floor(Date.now() / 1000) + ttl.

Timestamp becomes a small number like 1783150

Cause: Divided by 1000 one time too many along the pipeline.

Fix: Trace each hop and enforce the unit at boundaries — name fields explicitly (created_at_ms) to make the unit visible.

Sub-second precision silently lost

Cause: A ms/µs value was floor-divided into seconds somewhere (often an ORM or serializer default).

Fix: Keep the higher-resolution unit end to end; convert down only at display time.

Tips and best practices

  • Name your fields with units: expires_at_ms, created_sec. Most epoch bugs are invisible because the unit lives only in someone's head.
  • Floor, don't round, when converting ms → s for expiries — rounding up can grant a second of validity you didn't intend.
  • In JS, prefer Math.floor(Date.now()/1000) over parseInt tricks; in Python, int(time.time()); in Go, time.Now().Unix() vs .UnixMilli() are explicit by name.
  • When comparing values from two systems, convert both to the same unit first, then compare — comparing then converting hides magnitude errors.

Frequently asked questions

How do I tell seconds from milliseconds?
Count digits: for contemporary dates, 10 digits means seconds, 13 means milliseconds (16 µs, 19 ns). A date-conversion result of 1970 or year 58000 is the other reliable indicator of a unit mismatch.
Does converting milliseconds to seconds lose data?
Yes — the sub-second part (up to 999 ms) is truncated. Fine for human-readable dates and coarse expiries; unacceptable for ordering events or measuring latency. Convert up (s → ms) when unsure.
Which unit do JWTs use?
Seconds — RFC 7519 defines NumericDate as seconds since the epoch. Writing Date.now() (milliseconds) into exp is the classic 'token never expires' bug.
Which unit does JavaScript use?
Milliseconds throughout: Date.now(), getTime(), the Date constructor. Divide by 1000 at every boundary with Unix-second systems (JWTs, most APIs, Redis TTL commands).
Is the conversion exact?
Between integers, yes — ×1000 or ÷1000. Beware floating-point seconds (1783150200.123): at nanosecond scale, doubles run out of precision, which is why Go and databases keep integer nanoseconds instead.

Embed this tool

Add Epoch Converter to your own site, blog post, or internal docs — free, no signup. The widget runs entirely in your visitors' browsers, same as it does here.