Time
Whole minutes since 2026-01-01 00:00 UTC. It marks the start of the minute, not the exact millisecond.
Structured ID generator
A 32-bit ID built from a minute, a generator number, and a slot. Small to store, easy to read, and usable offline.
32-bit integer 16 generators 128 IDs / minute 64-year range
Example · generator 5 · slot 3
01N-651B-S
Crockford Base32 + check
Playground
The demo runs the same code as the tests. Generate IDs, fill the eight slots, or move the clock forward.
A fixed clock. State resets on refresh.
Crockford Base32 + check
—
Decimal, 0x hex, or checked Base32.
Crockford Base32 + check
—
Encoded time —
The demo uses memory, so state resets on refresh. A real system saves state before returning each ID.
The format
Time comes first, so IDs sort roughly by age. The last seven bits identify the generator and its slot in the minute.
Whole minutes since 2026-01-01 00:00 UTC. It marks the start of the minute, not the exact millisecond.
One writer, not necessarily one machine. Each generator gets its own number from a central list.
Eight IDs per generator per minute. When they are used up, the generator moves to the next minute.
id = time × 128 + generator × 8 + slot
Worked example
Take 2026-10-30 14:32 UTC, generator 5, and the fourth slot in that minute.
435,752 minutes have passed since 2026-01-01.
Generator 5 is 0101 in four bits.
Slot 3 is 011 in three bits.
435752 × 128 + 5 × 8 + 3 = 55,776,299.
Base32 is the best format for people: seven data characters plus one check character. The check only guards the written code; the 32-bit ID is unchanged. The decoder verifies it before reading the ID. Dashes are only spacing.
Correctness
Uniqueness comes from how IDs are generated, not just from the number. Three rules matter most.
Two processes with the same generator number must share one saved state. Otherwise they can issue the same ID.
State is saved before the ID leaves the generator. A crash can skip an ID, but it can never repeat one.
If the clock moves back, the generator keeps its last minute and uses the next slot. It stops if it gets too far ahead.
Profiles
SID-32 is the default. If you need larger bursts, second precision, or a signed integer, use a wider profile.
| Profile | Width | Time / gen / slot | Generators | Rate | Range |
|---|---|---|---|---|---|
| SID-31 | 31 bits | 25 / 3 / 3 | 8 | 64 / min | ~63.8 years |
| SID-32 Default | 32 bits | 25 / 4 / 3 | 16 | 128 / min | ~63.8 years |
| SID-32h | 32 bits | 20 / 6 / 6 | 64 | 4,096 / hour | ~119.6 years |
| SID-40 | 40 bits | 25 / 7 / 8 | 128 | 32,768 / min | ~63.8 years |
| SID-48 | 48 bits | 32 / 8 / 8 | 256 | 65,536 / s | ~136.1 years |
Only SID-32 is implemented on this page.