Skip to content
FreeAIDevTools

Epoch Converter: Unix Timestamp to Date and Back

Updated

What is Unix epoch time? Unix epoch time counts seconds since January 1, 1970 at 00:00 UTC, so 1785628800 is August 2, 2026. A 13-digit timestamp is in milliseconds, not seconds: divide by 1,000. The converter below works in both directions, converts in any timezone with its UTC offset, and runs entirely in your browser.

Now: …

The Inference Report · Every Tuesday

Know when AI prices change.

One short email every Tuesday: new models, price moves and free tiers that were cut or added. Five minutes, no fluff.

No spam. Unsubscribe anytime.

By language

What is Unix epoch time?

Unix epoch time is the count of seconds elapsed since 1970-01-01 00:00:00 UTC. The reference instant is fixed, the unit is fixed, and the value is always measured in UTC. There is no such thing as "epoch in PST" or "epoch in IST". The number itself is timezone-independent. What varies is the wall-clock string the renderer prints, which depends on whichever zone the rendering code happens to convert into.

Worked example: the value 1777010400 resolves to 2026-04-24 06:00:00 UTC. The same number resolves to 2026-04-24 11:00:00 +05:00 in Pakistan Standard Time and to 2026-04-23 23:00:00 -07:00 in Pacific Daylight Time. Three valid wall-clock displays, one underlying instant. The number on the wire never changed; only the renderer's timezone setting did. This property is exactly why systems use epoch on the storage and transport layer and only convert to a local string at the presentation edge.

Seconds vs milliseconds vs nanoseconds

Epoch time ships in four common precisions and the digit count gives the unit away. A 10-digit value is seconds, the classic Unix convention used by POSIX, most server logs, and JWT exp claims. A 13-digit value is milliseconds, the form returned by JavaScript's Date.now() and most browser APIs. A 16-digit value is microseconds, the precision PostgreSQL stores timestamps at and a common unit in tracing systems. A 19-digit value is nanoseconds, the form Go's time.Now().UnixNano() returns and what high-resolution profilers record.

Quick rule for sanity-checking any timestamp from the current era: a 2026 instant lands at roughly 1.78x10^9 in seconds and 1.78x10^12 in milliseconds. If a value reads 1.78x10^15, it is microseconds. If it reads 1.78x10^18, it is nanoseconds. Anything outside those magnitudes is either a different era or a unit-mismatch bug.

Worked example of the bug: a backend emits 1777010400000 (milliseconds), the consumer parses it as seconds, and the resulting date renders to roughly the year 58,000. That kind of absurd output is the clearest possible "something is wrong" smell, and it always traces back to a mismatched precision contract between two services. Our converter reads the unit from the digit count: up to 11 digits is seconds, 12 to 14 is milliseconds, 15 to 17 is microseconds and 18 or more is nanoseconds, so all four precisions convert without a toggle.

Common pitfalls

Epoch time looks deceptively simple. It is one number. The pitfalls below all stem from treating that number as if it carried context it does not, or from quietly mixing two precisions in a single code path. Each one has cost real production hours in postmortems we have read or written.

  • Treating "epoch in local time" as a concept. It is not one. Epoch is always UTC by definition, and the wall-clock display is a rendering choice made at the presentation layer. A timestamp does not carry a timezone, and trying to "store epoch in EST" means storing a wrong number that will be misread the moment it crosses a process boundary.
  • The Y2038 problem. A 32-bit signed Unix timestamp overflows at 2147483647, which is 2038-01-19 03:14:07 UTC. Past that instant the value wraps negative and dates appear in 1901. The active risk concentrates in embedded systems with 32-bit time_t, older C code compiled before the kernel's 64-bit migration, and MySQL TIMESTAMP columns, whose range still ends at that exact second. Audit before the cliff, not after.
  • Mixing seconds and milliseconds in the same code path. A multiplication or division by 1000 inserted in one branch and forgotten in another produces silently wrong timestamps that pass every type check. The bug stays invisible in development (durations of seconds look the same as milliseconds at small scale) and surfaces in production when a cache TTL fires 1000x too soon or a token expires 1000x too late.
  • Using Date.now() / 1000 and forgetting to Math.floor the result. The result is a fractional second, and many APIs and token validators expect whole seconds: a JWT with iat: 1777010400.123 can be rejected with an unhelpful error even though the spec allows fractions. Floor the value whenever an API asks for seconds.

When to use this tool

We built the converter for three concrete workflows. The first is debugging a server log that prints raw epoch timestamps with no human-readable side: paste the number, get the UTC and local wall-clock instantly, and stop interrupting the investigation to open a Python REPL. The second is setting an OAuth token's exp claim correctly. JWT exp is seconds since epoch, not milliseconds, and emitting Date.now() directly into that field is one of the most common bugs in fresh auth code. The third is sanity-checking a database created_at against the wall-clock time of a known event. If a row claims to have been written at 1777010400 but the deploy happened at 12:00 UTC the same day, the converter shows the gap in one paste.

Frequently asked

Why is my timestamp showing the wrong time?

Usually one of two things. The display is converting to a different timezone than you expect (the epoch value itself is always UTC), or seconds and milliseconds got mixed up: a 13-digit millisecond value read as seconds lands tens of thousands of years in the future, and a 10-digit second value read as milliseconds lands in January 1970.

How do I tell if a timestamp is in seconds or milliseconds?

Count the digits. A current timestamp has 10 digits in seconds (classic Unix, JWT exp), 13 in milliseconds (JavaScript Date.now()), 16 in microseconds and 19 in nanoseconds (Go's UnixNano). Our converter reads the unit from the digit count (up to 11 seconds, 12 to 14 milliseconds, 15 to 17 microseconds, 18 or more nanoseconds), so you can paste any of the four as is.

What is the Y2038 problem?

A signed 32-bit Unix timestamp tops out at 2147483647, which is 2038-01-19 03:14:07 UTC, and then wraps to a negative number that reads as 1901. The risk sits in embedded devices and old C code with a 32-bit time_t, and in MySQL TIMESTAMP columns, whose range still ends at that exact second. Audit and migrate well before the date.

How do I convert between epoch and ISO 8601?

JavaScript: new Date(epochMs).toISOString(). Python: datetime.fromtimestamp(seconds, tz=timezone.utc).isoformat(). Linux shell: date -u -d @1777010400 +%Y-%m-%dT%H:%M:%SZ (on macOS use -r instead of -d), and PostgreSQL: to_timestamp(1777010400).

What's the difference between epoch time and Unix time?

In everyday use they mean the same thing: seconds since 1970-01-01 00:00:00 UTC, as POSIX defines it. Strictly, the epoch is the starting instant and Unix time is the count from it. People also call a 13-digit Date.now() value "epoch", which is really milliseconds since the epoch.

Sources: POSIX, seconds since the Epoch · MDN on Date.now(). How we check our data