Click Generate to create a CUID2
Options
2 (min)24 (default)32 (max)
CUID2 Validator
Bulk Generate
CUID2 vs Other IDs
| Feature | CUID2 | UUID v4 | Nano ID |
|---|---|---|---|
| Length | 24 | 36 | 21 |
| Starts with letter | ✓ Always | ✗ No | ✗ No |
| Valid HTML ID | ✓ Yes | ✗ Hyphens | ✗ Maybe |
| Distributed-safe | ✓ SHA-256 | ✓ Random | ✓ Random |
| Customizable length | ✓ 2-32 | ✗ Fixed | ✓ Any |
Frequently Asked Questions
What is CUID2?
CUID2 (Collision-Resistant Unique Identifier 2) is the successor to CUID. It generates secure, collision-resistant IDs that work across distributed systems without coordination. Default length is 24 characters.
How is CUID2 different from UUID?
CUID2 is designed specifically for horizontal scaling. It's shorter, always starts with a letter (valid for HTML IDs and CSS selectors), and has stronger collision resistance guarantees in distributed environments.
Is CUID2 secure?
Yes. CUID2 uses a cryptographic hash function (SHA-256) with entropy from multiple sources including random data, timestamps, and a counter. The output is indistinguishable from random.
When should I use CUID2?
Use CUID2 when you need IDs that work in distributed systems without coordination, need to be URL-safe, and must start with a letter. It's popular in web apps, especially with frameworks like Next.js and Prisma.
Can I customize the length?
Yes! CUID2 supports lengths from 2 to 32 characters. The default is 24 characters which provides excellent collision resistance. Shorter lengths have higher collision probability.