CUID2 Generator

Generates identifiers matching the CUID2 format, a lowercase letter followed by lowercase base36 (letters and digits) characters, using the Web Crypto API for cryptographically random output. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-25

Overview

Introduction

CUID2 is an identifier format designed for horizontally scaled systems where many machines need to generate unique, collision-resistant IDs without coordinating with each other.

This tool produces IDs in the CUID2 format entirely in your browser, using cryptographically secure randomness for every character after the leading letter.

What Is CUID2 Generator?

A generator for CUID2-shaped identifiers: a random lowercase letter followed by random lowercase base36 characters (digits 0-9 and letters a-z), 24 characters long by default.

Length is adjustable from 2 to 32 characters, matching the range the reference JavaScript implementation supports.

How CUID2 Generator Works

The tool draws one cryptographically random letter for the first character, then fills the remaining length with cryptographically random base36 characters via crypto.getRandomValues().

This differs from the reference @paralleldrive/cuid2 library, which additionally mixes in a monotonic counter, a machine fingerprint, and a hash function to spread load evenly across sharded database indexes at very high write volumes — this tool optimizes for correct format and strong randomness rather than reproducing that internal scheme.

When To Use CUID2 Generator

Use it when you need an ID in CUID2's format — for example, matching an existing database column or ORM schema (like Prisma's cuid2() default) that expects this shape.

For pure uniqueness with no format requirement, a UUID v4 or Nano ID works just as well and is simpler to reason about.

Features

Advantages

  • Output always starts with a letter, safe for identifier contexts that disallow a leading digit.
  • Length is fully configurable within the format's supported range.
  • Uses a cryptographically secure random source for every character.

Limitations

  • Not a drop-in cryptographic replica of the @paralleldrive/cuid2 reference implementation's internal hash construction — see the FAQ for what that means in practice.
  • Like any fixed-length random ID, collision probability rises as generation volume grows; longer lengths reduce that risk.

Examples

A default 24-character CUID2-format ID

Input

(no input; generated from settings)

Output

k3f8x2m9q7v1n5w0t6r4b8yz

Starts with a random lowercase letter, followed by 23 more base36 characters.

Best Practices & Notes

Best Practices

  • Keep the default 24-character length unless you have a specific schema constraint requiring a different size.
  • Prefer this tool when you need to spot-check or backfill test data matching an existing CUID2 column, not as a source of production IDs for a live sharded system.
  • Generate in batches when seeding test fixtures rather than calling the tool repeatedly for one ID at a time.

Developer Notes

Base36 character mapping uses modulo on a full 32-bit random value per character, which introduces a statistically negligible bias for a 36-symbol alphabet (2^32 isn't an exact multiple of 36), well below any practically observable threshold at typical ID lengths.

CUID2 Generator Use Cases

  • Generating placeholder or seed data matching a CUID2 database column
  • Producing quick test IDs in a CUID2-shaped format for fixtures
  • Learning what a CUID2 looks like structurally

Common Mistakes

  • Assuming this generator's output is deterministically reproducible from a seed — like the reference library, it always produces fresh random output.
  • Relying on this tool's output for a production system that specifically needs the reference implementation's counter-and-fingerprint collision-avoidance scheme at very high write throughput.

Tips

  • If your database column has a fixed CHAR(24) or similar constraint, leave the length at the default 24 to match it exactly.
  • Generate a batch when populating test fixtures rather than generating IDs one at a time.

References

Frequently Asked Questions