← back to blogs
backendsystem-design

How Twitter Generates Unique IDs at Scale — Snowflake ID

July 15, 2025

While diving deeper into system design, I came across Twitter's Snowflake ID generation strategy — and it's absolutely fascinating!

What is a Snowflake ID?

A 64-bit unique ID generated without needing any coordination (like a distributed cache or database).

Snowflake ID Structure

64-bitTwitter Snowflake ID — Bit Layout
1
41
10
12
0
TIMESTAMP
MACHINE ID
SEQUENCE
1 bit
41 bits
10 bits
12 bits
Sign Bit
Always 0
Ensures positive integers
Timestamp
Milliseconds since custom epoch
Range: ~69 years
Machine ID
Unique per server node
Up to 1024 machines
Sequence
Increments per millisecond
Max 4096 IDs/ms
total capacity: 263 unique IDstime-sortable by defaultno coordination required

What problem does it solve?

Compared to other ID strategies

Want to learn more?