realepochconverter
snowflake id converter

Snowflake ID Converter — Discord & Twitter Timestamps

Paste any 64-bit snowflake ID — from Discord, Twitter/X, or your own service — and this tool bit-shifts out the timestamp, worker, process, and sequence fields. Every conversion is pure integer arithmetic against a fixed epoch constant.

converter

Snowflake ID → timestamp.

Decode Discord, Twitter/X, or custom 64-bit snowflake IDs into dates — pure bit-shifts against a fixed epoch, no lookups.

epoch

How a snowflake ID is laid out

A snowflake is a 64-bit integer. The sign bit (bit 63) is unused, the next 41 bits are a timestamp in milliseconds since a service-specific epoch, and the remaining 22 bits identify the machine and the request:

  • Bits 62–22 — timestamp in ms. Shift right by 22 and add the epoch to get the date.
  • Bits 21–17 — 5 bits: the worker (Discord) or datacenter (Twitter) ID.
  • Bits 16–12 — 5 bits: the process (Discord) or worker (Twitter) ID.
  • Bits 11–0 — 12 bits: a per-millisecond sequence counter (0–4095).

Because the timestamp is stored in the most significant bits, snowflake IDs sort in chronological order — which is exactly why so many services use them for primary keys.

Known epochs

  • Discord — epoch 1420070400000 ms (2015-01-01 00:00:00 UTC). Worker / process / sequence layout.
  • Twitter / X — epoch 1288834974657 ms (2010-11-04 01:42:54.657 UTC). Datacenter / worker / sequence layout.
  • Custom — any epoch in milliseconds, for self-hosted snowflake implementations.

Example conversions

  • 1535074998681600000 → August 7, 2026 00:00:00 UTC (Discord epoch, worker 0, process 0, sequence 0).
  • 0 → exactly the selected epoch — the first ID a service could ever issue.

In your own code

  • JavaScript: (id >> 22n) + 1420070400000n — the timestamp in ms (use BigInt; IDs exceed Number.MAX_SAFE_INTEGER).
  • Python: (id >> 22) + 1420070400000 — then datetime.fromtimestamp(ms / 1000, tz=timezone.utc).
  • Go: time.UnixMilli((id >> 22) + 1420070400000).
  • SQL: FROM_UNIXTIME((id >> 22 + 1420070400000) / 1000) — on 64-bit integers only.

Gotchas

  • Precision — IDs are up to 19 digits, larger than JavaScript's safe-integer limit. This converter reads them with BigInt, so nothing is lost. In your own JS, never parse an ID with Number().
  • The 22 bits — timestamp is id >> 22 with arithmetic shift; worker is (id >> 17) & 0x1F; process is (id >> 12) & 0x1F; sequence is id & 0xFFF.
  • Epochs differ — a Discord ID decoded against the Twitter epoch is off by about four years. Always pick the right preset (or supply the custom epoch).
  • Microservices — many self-hosted snowflake forks keep the same 41/5/5/12 layout but change the epoch; the Custom preset covers those.

Related tools

Once you have the timestamp part, theUnix timestamp to date converter can format it in any timezone, and the date to epoch converter does the reverse.

Related converters

Copied