What is a Snowflake ID?
A Snowflake ID is a unique identifier format originally created by Twitter to generate massive amounts of uncoordinated, collision-free IDs across a distributed system. Unlike UUIDv4 (which is purely random), Snowflake IDs are 64-bit integers that are time-sortable.
Because the first 41 bits represent a timestamp, you can insert Snowflake IDs into a database (like MySQL or Postgres) and sort them natively by creation time without needing a separate created_at column. This structure drastically reduces database index fragmentation.
The 64-bit Binary Breakdown
Our Snowflake parser visually demonstrates exactly how these IDs are constructed. A standard Snowflake ID consists of exactly 64 bits (fitting perfectly into a standard 64-bit integer or SQL BIGINT):
- Sign Bit (1 bit): Always
0. This ensures the integer is always positive. - Timestamp (41 bits): Milliseconds elapsed since a custom Epoch. 41 bits allow the system to generate IDs for ~69 years before rolling over.
- Datacenter ID (5 bits): Identifies the specific data center generating the ID (allows up to 32 datacenters).
- Machine/Worker ID (5 bits): Identifies the specific machine inside the datacenter (allows up to 32 machines per datacenter).
- Sequence Number (12 bits): A counter that increments for every ID generated on the same machine within the exact same millisecond. It rolls over every 4096 IDs, meaning a single machine can generate 4,096 unique IDs per millisecond.
Discord, Instagram, and Custom Epochs
While Twitter invented the concept, many modern tech giants have adopted variations of the Snowflake algorithm. The most notable difference is the Custom Epoch.
The timestamp inside a Snowflake isn't absolute UNIX time; it's the delta (difference) since the company started using the system. This saves precious binary space.
- Twitter Epoch:
1288834974657(Nov 04, 2010) - Discord Epoch:
1420070400000(Jan 01, 2015)
If you are trying to parse a Discord ID, simply change the "Custom Epoch" input in our decoder to the Discord Epoch value.
Why use Snowflake over UUID?
While UUIDv7 and ULID are modern, sortable string-based alternatives, Snowflake IDs have one massive advantage: Size. A Snowflake is a 64-bit integer (8 bytes). A UUID is 128-bit (16 bytes), and often stored as a 36-character string. For massive companies handling billions of rows, cutting the primary key size in half saves terabytes of RAM in database B-Tree indexes.