1001Ferramentas
❄️Dev

Snowflake ID Parser

Decompose a snowflake (Twitter, Discord) into timestamp, worker ID, datacenter ID and sequence. Shows the human-readable date.

Snowflake ID: 64 bits of time, machine and sequence

Twitter created the format in 2010 when moving off MySQL auto-increment: with several databases, nobody can be the single authority handing out the next number. The solution was to assemble the identifier from three parts each machine can fill in alone — the clock, its own number and a local counter.

The layout is fixed: one sign bit always zero, 41 bits of milliseconds counted from an epoch the project chooses, 10 bits identifying the machine and 12 bits of sequence. The 12 sequence bits cap it at 4096 identifiers per millisecond per machine, which in practice never binds. It is the 41 time bits that set the scheme's lifespan: about 69 years from the epoch.

The epoch is what varies between implementations, which is why the page lets you choose: Twitter uses 4 November 2010, Discord 1 January 2015. Applying the wrong epoch raises no error — it returns a plausible date that is wrong by years. Worth noting too that sorting by identifier sorts by time, which is half the reason the format exists.

Frequently asked questions

Why does Twitter send the ID as text in JSON?
Because JavaScript represents numbers as double-precision floats, which hold exact integers only up to 2 to the 53rd. A Snowflake uses 63 bits, so the value arrives rounded and points at a different record. That is why the API carries a string version of the field alongside the numeric one — and the string is the one to use.
What happens if the machine clock goes backwards?
The original implementation refuses to generate until the clock passes the last instant used, because emitting with a smaller time would break ordering and could repeat an identifier already issued. It is the format's structural weakness: it depends on a monotonic clock, and time adjustment is a real event on servers.
Snowflake or UUID v7?
They do the same job by different routes. Snowflake fits in 64 bits, half a UUID and still fits a database integer — but it requires coordinating the assignment of machine numbers. UUID v7 takes 128 bits and needs no coordination, because the rest is random. Without infrastructure to hand out node numbers, v7 is less work.

Related Tools