Cuid2 Generator
Press c to copy or r for a new one
Generate in bulk
What is a Cuid2?
A Cuid2 is a 24-character lowercase alphanumeric string that always starts with a letter, so it is safe to drop into HTML IDs, CSS selectors and URLs without escaping or quoting.
It is a hash of four inputs: a random seed, the current time, a per-session counter, and a host fingerprint. Hashing them together is the point, because the finished ID reveals none of them.
Why use Cuid2?
Cuid2 is designed for the case where an ID will be seen by users or attackers. It is horizontally scalable like a UUID, but unlike a v1 or v7 it exposes no timestamp and no machine identity, and unlike a v4 it is guaranteed to be readable and selectable everywhere.
The length is configurable if you need more or less collision resistance than the default 24 characters.
What happened to the original Cuid?
Its author deprecated it. The original leaked a fingerprint and a monotonic counter in plain text, which made IDs partly predictable. Cuid still works and is documented here, but new code should use Cuid2.
The tradeoff Cuid2 accepts is speed: hashing every ID is slower than concatenating fields, and the result no longer sorts by time.
Generate one in code
TypeScript
import { createId } from "@paralleldrive/cuid2";
createId();Python
from cuid2 import Cuid # pip install cuid2
Cuid().generate()Go
import "github.com/nrednav/cuid2"
cuid2.Generate()Rust
// cargo add cuid2
cuid2::create_id();