Online KSUID generator

Your generated KSUID

Bulk ID generator

You can generate up to 1000 IDs at a time using the Bulk ID Generator. Select the ID version you require by selecting it from the drop-down list.

Min 1, max 1000

KSUID in a nutshell

A K-Sortable Unique IDentifier (KSUID) is a globally unique ID that is naturally sortable by generation timestamp.

KSUID incorporates a timestamp and a random payload, ensuring that IDs are both unique and strictly sortable by their creation time. This makes them ideal for systems where chronological ordering is essential, such as logs, messages, or database entries, without the coordination overhead of centralized ID generation.

KSUID (K-Sortable Unique IDentifier) is a globally unique identifier that is naturally sortable by generation time. It combines a 32-bit timestamp with a 128-bit random payload, resulting in a 20-byte ID that is encoded as a 27-character alphanumeric string.

A KSUID consists of a 4-byte timestamp (unixtime-based) and a 16-byte cryptographically strong random payload. This 20-byte binary structure is then encoded into a 27-character string using Base62 encoding, making it URL-safe and compact.

Unlike UUID v4 which is completely random, KSUID is time-sortable. This makes it significantly better for database primary keys as it reduces index fragmentation. KSUIDs are also lexicographically sortable by their string representation.

Yes, KSUID uses Base62 encoding which includes alphanumeric characters (0-9, a-z, A-Z) but excludes special characters, making it safe for URLs and filenames without requiring further encoding.

KSUID has a 128-bit random payload, which is larger than UUID v4's 122 bits of randomness. This provides an extremely low probability of collision, arguably even safer than UUID v4, while adding the benefit of time-sorting.

Yes, KSUIDs are strictly time-sortable. Because the timestamp comes first in the binary structure, and the Base62 encoding preserves order, KSUIDs can be sorted chronologically by their string representation.

A KSUID string is always 27 characters long, which is shorter than the standard 36-character string representation of a UUID, despite encoding more data (160 bits vs 128 bits).

Use KSUID when you need unique identifiers that are also roughly time-ordered (like Twitter Snowflakes) but want a decentralized generation without needing a coordinated generator or machine IDs. It's excellent for improved database indexing performance compared to random UUIDs.