CUID2 Generator

Generate cryptographically secure, collision-resistant identifiers. CUID2 offers enhanced security with configurable length for modern applications.

About CUID2

CUID2 is the evolution of the original CUID, designed from the ground up with security as a primary concern. Created by Eric Elliott and the Parallel Drive team, CUID2 addresses several security limitations of the original format.

Key Features

  • Cryptographically Secure - Uses secure random number generation
  • No Predictable Patterns - IDs don't reveal creation order
  • Configurable Length - Choose from 2 to 32 characters
  • Enhanced Entropy - Better distribution of randomness
  • URL Safe - Only lowercase letters and numbers

When to Use CUID2

  • Session tokens and authentication
  • API keys and access tokens
  • Security-sensitive database records
  • Password reset tokens
  • Any scenario where ID predictability is a concern

Length Recommendations

LengthUse Case
24 (default)Most applications - excellent balance of size and uniqueness
32 (max)High-security tokens, extreme-scale systems
16-20URL slugs where brevity matters, lower-volume systems

Frequently Asked Questions

What is CUID2?

CUID2 is the second generation of collision-resistant unique identifiers. Designed to address security concerns in the original CUID, it uses cryptographically secure random number generation to eliminate predictable patterns.

What are the differences between CUID2 and CUID?

Instead of timestamps and counters, CUID2 uses cryptographically secure random generation. This makes CUID2s more suitable for security-sensitive applications because they don't reveal when or in what order they were created. CUID2 also allows for a configurable length of two to 32 characters.

Why can't I extract a timestamp from CUID2?

Unlike CUID v1, CUID2 does not encode a timestamp. This is intentional; the lack of predictable patterns makes it more secure. If you need to extract a timestamp, use CUID v1 instead.

What length should I use for CUID2?

The default length of 24 characters offers excellent collision resistance for most applications. Use longer lengths (up to 32 characters) for extremely high-volume systems or when extra uniqueness is required. Shorter lengths are available, but they reduce collision resistance (minimum 2).

Is CUID2 suitable for security tokens?

Yes! CUID2 is designed with security in mind. Its cryptographically secure random number generator makes it ideal for session tokens, API keys, and other security-sensitive identifiers, as predictability would pose a vulnerability in these cases.