Online cuid generator

Your generated cuid

Bulk cuid generator

You can generate up to 1000 cuids at a time using the Bulk Cuid Generator. Select the cuid version you require - either version-1 or version-2 - by selecting it from the drop-down list.

Min 1, max 1000

Cuid in a nutshell

Collision-resistant ids optimized for horizontal scaling and binary search lookup performance.

Version 1

Cuid, or Collision-resistant Unique Identifier, is a highly efficient system for generating unique IDs, utilizing timestamps and counters for scalability and fingerprints to prevent collisions among multiple clients, created by Eric Elliott. It excels in speed by allowing quick and synchronous ID generation, eliminating the need for database round trips.Read more about Cuid

Version 2

Cuid2 is the next generation of Cuid, which has been used in thousands of applications for over a decade with no confirmed collision reports. The changes in Cuid2 are significant and could potentially disrupt the many projects that rely on Cuid, so it was decided to create a replacement library and id standard, instead. The Cuid is now deprecated in favour of Cuid2, according to author Eric Elliott.Read more about Cuid2

The CUID (Collision-Resistant Unique Identifier) system is designed for generating unique IDs for horizontal scaling and distributed systems. It uses a combination of timestamp data, machine fingerprints, and random values to generate collision-resistant identifiers that are optimized for database performance.

A standard CUID contains the following: 1) A leading "c" identifier, 2) a timestamp in milliseconds, 3) a counter for the same millisecond generation, 4) a host fingerprint, and 5) random data. For example, the CUID "ckqtls7040000h3d8suihro21" is 25 characters long. The length can vary between 23 and 35 characters, depending on the implementation.

The original CUID (v1) was deprecated due to security concerns regarding predictable patterns and metadata leakage. Current implementations recommend using CUID2, which uses cryptographic hashing to eliminate fingerprinting vulnerabilities while maintaining collision resistance.

Unlike UUIDs, which use a 128-bit random approach, CUIDs offer better database index locality through time-based prefixes. CUIDs are shorter (25 vs. 36 characters), safer for URLs, and specifically designed for distributed systems that need sortable IDs without central coordination.

Key benefits include natural sortability, the ability to generate on the client side, cross-platform compatibility, and optimized database indexing. Compared to random UUIDs in large datasets, the time-based prefix improves insert performance by 10-20%.

It is ideal for distributed systems that require client-generated IDs and for applications that need sortable timestamps without exposing the creation time. It is also ideal for databases where index fragmentation caused by random IDs results in performance issues. It is commonly used in SaaS platforms and IoT ecosystems.

CUID v1 included host fingerprints, raising privacy concerns. However, CUID2 eliminates this issue by using cryptographic salts. Modern implementations do not embed MAC addresses or other identifiable host information in generated IDs.

The probability of a CUID collision is approximately 1 in 10¹⁸ due to the 60-bit entropy from the timestamp, counter, and fingerprint. The newer CUID2 uses 80-bit entropy with cryptographic hashing, which reduces the collision risk to approximately 1 in 10²⁴ when generating one million IDs per second. Both versions maintain practical collision resistance; however, CUID2's security improvements make it suitable for sensitive systems.

NanoID focuses on minimal size (21 characters) and speed, while CUID prioritizes collision resistance and sortability. CUID's timestamp prefix allows for efficient database range queries, while NanoID's fully random nature provides greater security for tokens.