Generate Snowflake IDs with component breakdown. Part of the DevTools Surf developer suite. Browse more tools in the Generators collection.
Use Cases
Generate unique IDs for distributed systems where multiple services need to create IDs without coordination.
Decode an existing Snowflake ID to extract its embedded timestamp and worker information.
Test ID generation in development with a controlled epoch and worker ID.
Replace UUID v4 in high-throughput systems where sortability by creation time is valuable.
Tips
Configure the worker ID to be unique per process or machine — duplicate worker IDs in a distributed deployment will generate colliding Snowflake IDs.
Snowflake IDs are sortable by generation time when compared as integers, but not as strings — string comparison of '12345' and '9999' gives wrong order because of lexicographic sorting.
Store Snowflake IDs as 64-bit integers (BIGINT), not strings — JavaScript's number type loses precision on Snowflake IDs because it uses 53-bit floating point.
Fun Facts
The Snowflake ID format was created and open-sourced by Twitter in 2010 to replace MySQL auto-increment IDs, which became a scalability bottleneck as Twitter grew to millions of tweets per day.
A Snowflake ID encodes: 41 bits of timestamp (milliseconds since a custom epoch), 10 bits of machine/worker ID, and 12 bits of per-millisecond sequence — allowing 4,096 unique IDs per worker per millisecond.
Instagram published a blog post in 2012 describing their Sharding IDs system, a Postgres-based Snowflake variant that remains influential in database sharding design.
FAQ
How is a Snowflake ID different from UUID v7?
Both encode timestamps. Snowflake encodes 41-bit millisecond timestamps with worker ID and sequence — designed for distributed systems with known machine topology. UUID v7 is a standards-based format without a worker ID field, using random bits instead.
Will Snowflake IDs overflow?
The 41-bit timestamp field overflows ~69 years after the custom epoch. Twitter's epoch was November 4, 2010 — overflow occurs around 2079. Set a recent epoch for new systems to push this further into the future.