Identifiers

Nano ID generatorCUID, CUID2 and KSUID too

Generate a fresh batch or inspect the readable fields of CUID and KSUID.

Nano ID generator

Input

Choose an algorithm and settings below. Every explicit run creates a fresh batch; editing settings only marks the previous batch stale.

Processing stays in this browser. Inputs are not sent to a server.

Result

Settings

Batch 1–1,000; NanoID length 1–128; CUID2 length 2–32. Custom alphabet: 2–64 distinct printable ASCII characters, without spaces. Decode input: at most 128,000 characters and 1,000 IDs.

Choose settings, then run.

Use the Nano ID generator when a database import, test fixture or short URL needs identifiers with specific character and length rules. Choose the format your receiving system expects before shortening the output.

The four modes do different jobs: NanoID offers a custom alphabet, CUID2 hides its internal inputs behind a hash, legacy CUID retains readable fields, and KSUID carries a seconds timestamp.

Why use this Nano ID generator?

Choose a format before choosing a length

The Nano ID generator keeps four algorithms together while showing only their supported settings. A shorter NanoID is allowed; a shortened KSUID would lose its format, so its length stays fixed.

Four differently structured identifier strips: adjustable random characters, segmented legacy fields, opaque hash output, and time with a random payload.

Inspect only fields that exist

CUID and KSUID expose time-bearing structure. Their reports retain the encoded fields, while NanoID and CUID2 remain opaque. A parsed timestamp is a stored value, not proof of when an event happened.

A structured identifier separates into a clock and a random payload, alongside an opaque identifier without a recoverable clock.

Check the assumptions before shortening an ID

01

Match the receiving system

NanoID starts at 21 URL-safe characters; CUID2 starts at 24 lowercase alphanumeric characters. Custom alphabets apply only to NanoID. Duplicate alphabet characters produce an error instead of extra weight.

  • Changing any setting makes existing results stale; it never silently creates another batch.
02

Set the right population

Collision probability uses expected total issuance, separate from the batch count. For KSUID, enter the maximum number sharing a single timestamp second. Legacy CUID does not receive a misleading uniform-string estimate.

  • Ctrl/Cmd+Enter runs the current task. Only decoding can run automatically, after 350 ms.
03

Inspect the complete report

The preview begins with 50 records and expands by 100. Copy and downloads include all results. Decode rejects the whole batch if any non-empty line is invalid.

  • Example and Clear show a replacement preview; Apply commits it, and Undo restores the previous input, settings and results.

Four algorithms with different structure

Configurable NanoID

Choose URL-safe, hexadecimal, digits or your own alphabet. The official rejection sampler avoids the modulo bias that would otherwise favor some characters in a non-power-of-two alphabet.

CUID2 generator

CUID2 uses SHA3-512 to combine time, salt, a counter and a session fingerprint. It begins with a lowercase letter. Length can change from 2 to 32, but alphabet and internal fields are not editable.

Legacy CUID compatibility

The format has a c prefix, Base36 milliseconds, a four-character counter, a four-character fingerprint slot and eight random characters. This implementation fills the fingerprint slot with a random session marker instead of reading browser properties.

KSUID generator and decoder

A KSUID encodes 20 bytes into 27 case-sensitive Base62 characters. Four bytes store a seconds offset from Unix 1400000000; the other sixteen bytes hold random payload. The decoder reports both UTC time and raw payload.

What the output can and cannot prove

A probability is not a uniqueness check
The birthday expression estimates at least one repeated value under independent sampling. CUID2 uses an idealized output space rather than a proven uniform distribution. KSUID compares only one seconds bucket. Keep database uniqueness constraints; this tool neither queries your database nor silently redraws duplicate results.
Time fields are not a creation certificate
CUID timestamps have variable width; parsing uses the fixed 16-character tail. KSUID resolves seconds, with no ordering guarantee within a second or across clock rollback. Nil and Max KSUID values are marked sentinel and must not be interpreted as real creation events.
Keep the exact format
Non-empty lines are not trimmed, repaired, sorted or deduplicated. Select CUID or KSUID yourself; overlapping character sets cannot identify a generator. NanoID and CUID2 have no supported time decoder.
Parameters have local limits
Each batch accepts 1–1,000 IDs. NanoID supports length 1–128 and 2–64 distinct visible ASCII characters; CUID2 supports length 2–32. Unicode alphabets, spaces, weighted characters, prefixes, custom separators and edited KSUID time or payload are outside this tool.
Legacy and external systems
Old CUID is deprecated and is included for compatibility. IDs are not passwords or authorization checks. No weak random fallback, file upload, URL fetch, database connection or automatic network request is used. UUID, ULID and Snowflake modes belong to separate tools.

Nano ID generator questions

Can I use a custom alphabet?

Yes. Choose Custom alphabet in NanoID mode and enter 2–64 unique visible ASCII characters. A duplicate, space or unsupported Unicode character is rejected. Other algorithms keep their defined alphabets.

What size should I pick for a Nano ID?

Start with 21 when you do not have a tighter requirement. At 64 symbols that gives 126 ideal space bits. Shortening the string or using digits alone reduces the space exponentially; enter your total issuance to see the change.

How is CUID2 different from CUID?

CUID exposes milliseconds, a counter and a fingerprint slot. CUID2 hashes its internal inputs into an opaque string and is the replacement recommended by its authors. The old format is retained here for compatibility testing.

How does KSUID embed timestamps?

It puts an unsigned 32-bit seconds offset before 128 random payload bits. The epoch is Unix 1400000000. Decode mode returns that offset, Unix milliseconds, UTC text and payload; it cannot establish that the encoded time is truthful.

How can I make unique room IDs of four to six characters?

A short code cannot guarantee uniqueness across arbitrary issuance. With ten digits and six positions there are only one million outputs. Use a database constraint and retry policy, consider expiration, and estimate the population of simultaneously relevant codes before choosing a length.

Have a question about an ID?

Open the Nano ID generator

Use the Nano ID generator to compare the format and collision assumptions, then export a fresh batch with the settings your application requires.