{ }jsonkit
Format
Validate
Convert
Query
Generate

UUID and NanoID generator

Generate UUID v4, UUID v7 or NanoID in batches with the crypto RNG.
Type
Count
78 B · paste or drop a file
1 2
✓ complete78 B → 369 B0.0 ms

About UUID / NanoID Generator

This UUID generator creates random UUID v4, time-ordered UUID v7 or 21-character NanoID values. Pick a type and a count of 1, 10 or 50, and copy the list into a database seed, a test fixture or an API call.

Every id comes from your browser's crypto RNG (crypto.randomUUID and crypto.getRandomValues). Nothing is requested from a server or uploaded.

Turn on As JSON array to paste a batch straight into code, or keep the one-per-line list.

How it works

UUID v4: random

Version 4 has 122 bits of cryptographic randomness, with the version and variant bits fixed. It is the common default: no coordination, negligible collision risk, and support everywhere. The tool uses crypto.randomUUID when available and falls back to crypto.getRandomValues.

UUID v7: time-ordered

Version 7 (RFC 9562) starts with a 48-bit Unix millisecond timestamp, followed by the version and variant bits and then randomness. Because the leading bits grow over time, v7 ids sort by creation time. That suits database B-tree indexes far better than random v4 ids.

NanoID: short and URL-safe

NanoID is a 21-character id from a 64-symbol URL-safe alphabet (A-Z, a-z, 0-9, _ and -). It is shorter than a UUID, has no hyphens, and is safe in URLs and file names. The alphabet size divides 256 evenly, so each character is unbiased.

UUID v4 vs v7 vs NanoID at a glance

Randomness: v4 has 122 random bits, v7 has 74 after its 48-bit timestamp, and a 21-character NanoID has 126 (21 × 6). Sorting: only v7 sorts by creation time. Size: both UUID versions are 128 bits (16 bytes in a native uuid column, 36 characters as text). NanoID is a 21-character string with no native database type. Leakage: v7 reveals the millisecond it was created. v4 and NanoID reveal nothing.

Collision odds

With 122 random bits, you would need about 2.7 × 10^18 v4 UUIDs before the chance of any duplicate reaches 50%. NanoID's 126 bits are slightly stronger. A v7 id can only collide with another id from the same millisecond, and it still has 74 random bits there. In practice, collisions come from broken random number generators, not from the math.

Database index locality

B-tree primary keys work best when new keys land next to recent ones. Random v4 keys insert all over the index, which causes page splits and more cache misses as tables grow. v7 keys grow with time, so inserts append near the end, much like an auto-increment integer. NanoID behaves like v4 here. This generator does not add a per-millisecond counter, so v7 ids from the same millisecond are in random order among themselves.

Count and JSON output

Generate 1, 10 or 50 ids at a time. Leave As JSON array off for a plain list, or turn it on to get a formatted JSON array for a config, seed script or test.

Frequently asked questions

What is the difference between UUID v4 and v7?

v4 is fully random, so ids have no order. v7 starts with a millisecond timestamp, so ids sort by time and index better in databases. Use v4 for general uniqueness and v7 when insert order or index locality matters.

Should I use UUID v7 as a database primary key?

Usually yes, if you want UUID keys. v7 keeps inserts close together in the index, which avoids most of the write and cache cost of random v4 keys, and it needs no central sequence. Avoid it where exposing the creation time is a problem, and use v4 or NanoID for those public ids.

Is NanoID better than UUID?

It depends on the job. NanoID is shorter (21 characters vs 36) and URL-safe without hyphens, which suits links and file names. UUID is a formal standard with native support in databases and libraries. Pick NanoID for compact public ids and UUID for interoperability.

Are these ids random and safe to use?

Yes. They come from your browser's cryptographic RNG, the same source used for secure tokens. Nothing is uploaded, so they are safe for production records.

Can UUIDs collide?

In practice, no. A v4 UUID has 122 random bits. You would need to generate billions of ids per second for many years to get a real chance of one collision. v7 adds a timestamp in front of its random bits, so its odds are just as small.

Is this generator free and private?

Yes. There is no account and no limit. Every id is created in your browser, and the tool works offline.

Sources & last verified

We checked this tool's behavior and the claims on this page against the specifications below on . The tool runs in your browser, so the output you see is exactly what the engine produced.

Found a wrong result or an outdated claim? Report an error and we will check it again.