Skip to content
DevTools / UUID & ID Generator

UUID & ID Generator

Choosing an identifier format is an architectural decision, not a detail: it determines whether your database index fragments on every insert, whether IDs leak creation time and volume, and whether they are safe to expose in a URL. This generator produces the formats developers actually choose between — UUID v4, UUID v7, UUID v1, ULID, Nano ID, MongoDB ObjectId and random passwords — in bulk, with the entropy of each format stated and the birthday-bound collision probability computed for the quantity you asked for.

Runs entirely in your browser — nothing is uploaded.

122 random bits. The default when you just need a unique id.
Entropy
122bits
50% collision at
~10^11
birthday bound
Generated
8
Result
  1. 1ed63af1f-b8e3-482d-b728-9b0d973f066d
  2. 2aa0708a5-50bf-4bed-bc35-9d3db868dd76
  3. 31a91f6cc-4433-4ee4-a9ec-8977ba0097e0
  4. 47d39e169-4ebe-461f-9b18-d180abc2b648
  5. 57987f177-6682-419f-8867-d8a0e189395c
  6. 6b0e62df9-0def-4ac6-9c9f-97d9d6f383dd
  7. 7801dad91-876a-421f-be94-c7e6559fe979
  8. 809791600-4115-4229-912e-4661a1d9369d

Range check

8 / 8 generated values fall inside the range.

How it works

UUID version 4 is 122 random bits with six bits reserved to mark the version and variant, rendered as 32 hexadecimal digits in five hyphenated groups. Its appeal is that generation requires no coordination at all: two machines that have never met can each mint an identifier and the collision probability is negligible. The cost is that the values are uniformly random, so inserting them into a B-tree index scatters writes across the whole tree, and a bulk import of a million rows touches a million different pages. On a large table that is a measurable throughput problem.

UUID version 7 solves exactly that by placing a 48-bit millisecond timestamp in the most significant bits, followed by random data. Because the values increase with time, they append to the end of an index rather than scattering through it, keeping write performance close to that of a sequential integer while retaining enough randomness to be unguessable. The trade is that the timestamp is visible to anyone holding the identifier, which reveals when a record was created and roughly how many exist — sometimes useful, sometimes a leak.

ULID applies the same idea with a different encoding: 48 bits of millisecond timestamp followed by 80 bits of randomness, rendered in Crockford Base32, which is case-insensitive and omits the letters I, L, O and U to remove visual ambiguity. The result is 26 characters, lexicographically sortable, and safe in a URL or a filename without escaping. Nano ID takes the opposite approach: a compact alphabet of URL-safe characters, defaulting to 21 characters and about 126 bits of entropy, tuned for the shortest identifier that is still collision-safe.

MongoDB ObjectId is the odd one out but follows the same trend. It is 12 bytes: four bytes of seconds since the epoch, five bytes of random per-process value and a three-byte counter. It is sortable by creation time, shorter than a UUID and designed for a specific database's indexing behaviour. Passwords are generated from a configurable character set with the entropy stated in bits, which is the number that actually matters — length alone is a poor proxy, since a 16-character password drawn from a 26-letter alphabet carries far less entropy than an 11-character one drawn from the full 94 printable ASCII characters.

Common use cases

  • Generate primary keys for a new table where sortable, index-friendly identifiers matter.
  • Create correlation IDs to trace a request across multiple services in a distributed system.
  • Produce unique filenames or object storage keys without a central counter.
  • Mint opaque session or invitation tokens that reveal nothing about the record behind them.
  • Generate test fixtures that need realistic identifiers at scale.
  • Create strong random passwords or API secrets with a known entropy figure.

Last updated: 2026-10-14

Frequently asked questions

UUID v4 or UUID v7?

UUID v7 for anything that will be stored in an indexed database, because its timestamp prefix keeps insertions at the end of the index instead of scattering them, which on a large table can be the difference between a healthy and a struggling write path. UUID v4 for identifiers that must not reveal timing, or where the identifiers are generated in a system with no particular database concern. Both have the same 128-bit size and the same negligible collision probability.

Can I really not collide?

For UUID v4 the probability is about one in 2.7 times ten to the seventeenth for a billion identifiers generated, which is far smaller than the probability of the hardware failing while you generate them. The practical caveat is not randomness but randomness source: identifiers generated from a weak pseudo-random generator, or from a virtual machine cloned without reseeding, can collide in practice. These are generated with the browser's cryptographically secure generator, which is seeded by the operating system.

Do UUIDs leak information?

Version 7, version 1 and ULIDs all do, because they embed a timestamp in the most significant bits. Anyone holding one can read when the record was created to the millisecond, and by sampling identifiers can estimate how many records exist and how fast they are being created. Version 4 is opaque. If the identifiers are exposed publicly and creation-rate confidentiality matters, use v4; if they are internal and index performance matters, use v7.

What does the entropy figure mean?

It is the number of bits of unpredictability in the value — the base-2 logarithm of the number of equally likely possibilities. A UUID v4 has 122 bits, meaning an attacker would need on average 2^121 guesses to find a specific one. Entropy determines both collision resistance and unguessability, and it is the number to compare when choosing between formats, because character count alone is misleading: two identifiers of equal length can differ by dozens of bits of entropy depending on the alphabet they draw from.

Related tools