Generate Universally Unique Lexicographically Sortable Identifiers with high performance
Snowflake ID Generator
Generate highly-performant, 64-bit distributed unique identifiers (Snowflake IDs). Originally developed by Twitter, Snowflake IDs are sortable by time and fit in a standard 64-bit unsigned integer.
Snowflake ID Generator & Anatomy Visualizer
-Generate, parse, and visualize distributed 64-bit Snowflake IDs
Bit-Level Structural Anatomy (64 bits)
Hover over the sections below to see how Snowflake IDs compress dynamic temporal, machine, and sequential bits into a singular positive 64-bit integer.
Snowflake ID vs UUID vs ULID
| Feature | Snowflake ID | ULID | UUID v4 |
|---|---|---|---|
| Data Type | Yes 64-bit Integer (BigInt) | Yes 128-bit String | Yes 128-bit String (Hex) |
| Time-Sortable | Yes (Millisecond precision) | Yes (Millisecond precision) | No |
| Distributed safe | Yes (Requires Machine ID) | Yes (Randomness component) | Yes (Cryptographic entropy) |
| Length / Representation | Yes 19-character digit string | Yes 26 Crockford Base32 chars | No 36 hex-formatted chars |
| Ideal Database indexing | Yes Extremely High (Native Integer) | Yes High (String type) | No Moderate (Hex String) |
Anatomy of a Snowflake ID
A standard Snowflake ID is represented as a 64-bit integer, and its bits are allocated as follows:
- Sign bit (1 bit): Always 0 to ensure the generated number is positive.
- Timestamp (41 bits): Millisecond epoch precision, providing up to 69 years of unique timestamps based on a custom Epoch.
- Machine/Node ID (10 bits): Identifies the server instance generating the ID, supporting up to 1024 unique instances.
- Sequence (12 bits): Local counter incremented within the same millisecond to prevent collisions, supporting up to 4096 unique IDs per millisecond per machine.
Ideal Use Cases
- High-volume relational database primary keys (MySQL, PostgreSQL) where integer indexes are faster than strings.
- Distributed logging or analytics systems that require time-sortable event indexing.
- Large microservice environments where individual nodes generate unique IDs without centralized coordination.