How to use the CUID generator
- Set the Length, from 2 to 32 characters. The default of 24 matches cuid2’s default.
- Set How many IDs, from 1 to 500.
- Press Generate and copy the list.
What it does and when to use it
cuid2 is a popular choice for database primary keys and public record IDs in JavaScript projects. They are a good fit when you want IDs that are hard to guess, safe to show in URLs, free of upper case (so they survive case-insensitive systems) and never start with a digit.
Use this page to create IDs for seed data and fixtures, to test that your validation accepts the format, or to see how a shorter length looks. If you want time-sortable IDs, the ULID generator or the UUID generator with version 7 is a better match. For a plain random ID with a collision estimate on screen, try the Nano ID generator.
How it works
For each ID the tool:
- Picks a random lowercase letter for the first character.
- Builds an input string from the current time in base 36, a fresh random base-36 string as long as the ID, a counter that starts at a random value and goes up by one per ID, and a 32-character random fingerprint shared by the batch.
- Hashes that string with SHA3-512, writes the hash in base 36, and keeps enough characters to reach the chosen length.
All random parts come from crypto.getRandomValues. The length sets an upper limit on strength: with 36 possible characters, a 24-character ID can hold at most about 124 bits, and a 10-character ID at most about 51 bits.
Worked examples
- Default length. Length 24 gives IDs such as
z8m01lopqq86ngxsv40o60npandat3srcofghtnf9q6ky0giof2, followed by the note “Built like cuid2 … Not byte-compatible with any one library.” - Short IDs. Length 10 gives values such as
wauuslt5xg. That is handy for a demo, but at about 51 bits it is too short for a large table.
Limits and tips
- Lengths under about 16 raise the risk of duplicates in big datasets. Keep a unique index on the column either way.
- IDs are lowercase only. Do not upper-case them later, or they will no longer match.
- A cuid is an identifier, not a secret. Do not use one as a password or an API key.
Frequently asked questions
What is the difference between cuid and cuid2?
Will these IDs match the @paralleldrive/cuid2 package exactly?
Why does every ID start with a letter?
Can I sort cuid2 IDs by creation time?
Does the tool download anything?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.