How to Use This Tool
A UUID is a 128-bit identifier you can generate anywhere, on any machine, without coordinating with
anything else, and still be confident it is unique. That property is the entire point, and it depends
completely on the randomness being real. A generator using Math.random() produces
identifiers that look identical and are not safe, which is why this one uses the browser's cryptographic
random source.
Generating
Set a count from 1 to 10,000, pick a type, choose an output format and press Generate. Options for uppercase, braces and hyphen removal appear where they apply. The output is ready to paste into a migration, a fixture file or a spreadsheet without further editing.
Which type to use
- UUID v4 is the default and the right answer most of the time. Fully random, universally supported, recognised by every database and language.
- UUID v7 puts a millisecond timestamp in the first 48 bits, so identifiers sort roughly in creation order. This matters enormously for database performance: random primary keys scatter writes across a B-tree index, while time-ordered ones append, which can be several times faster on large tables.
- ULID is also time-ordered but encodes to 26 characters instead of 36, using an alphabet that avoids I, L, O and U so it cannot be misread aloud or produce accidental words.
- Nano ID is 21 URL-safe characters with 126 bits of entropy — shorter than a UUID, more random, and designed for public identifiers in URLs.
Why Math.random is not acceptable
JavaScript's Math.random() is a fast pseudo-random generator seeded from a small internal
state. Its output is statistically fine for shuffling a playlist and completely unsuitable for
identifiers, because the sequence is predictable from a handful of observed outputs. If your UUIDs are
session tokens, password reset links, invitation codes or anything else an attacker would like to guess, a
Math.random generator hands them the next value. Everything here uses
crypto.getRandomValues().
The collision maths, honestly
UUID v4 has 122 random bits, giving roughly 5.3 × 10³⁶ possibilities. By the birthday bound you would need about 2.7 quintillion identifiers before reaching a 50% chance of any two matching. Generating a billion a second, that takes longer than the age of the universe. This is why production systems do not check for duplicates — not because collisions are impossible, but because they are less likely than the hardware failing.
