What this tool does
A UUID is a 128-bit identifier, rendered as eight groups of hexadecimal digits separated by dashes. This tool generates them in bulk using the browser's cryptographic random number generator, in either version 4 (fully random) or version 7 (time-ordered). Choosing the right version matters if you plan to sort or index the values.
How it works
Version 4 takes all 128 bits from the random source and sets the version and variant bits, so the identifier carries no information about when or where it was created. It has no meaningful order, which is fine as a primary key but means inserts scatter across a B-tree index and fragment it over time.
Version 7 puts a millisecond Unix timestamp in the leading bits and fills the remainder randomly. Identifiers are therefore still unique, but they sort in creation order, which keeps index writes sequential and makes them far cheaper as database keys. The tradeoff is that creation time is visible in the value, so version 7 is a poor choice where the timestamp is sensitive.
Generation uses crypto.getRandomValues rather than Math.random. Math.random is not a cryptographic source and is predictable, which would let someone predict identifiers your system relies on being unguessable.
Worked example
Seeding 100,000 rows in a table with a primary key and noticing that inserts became slow and the index bloated.
- Version 4 values have no ordering, so every insert lands in a random position in the index
- Each insert dirties a different page, causing page splits and write amplification
- Switching to version 7 makes inserts append in time order
Sequential index writes, far less fragmentation, and noticeably faster bulk inserts on a large table.
Accuracy and limitations
- Version 4 exposes no ordering or timestamp. Do not use it where you need to sort by creation.
- Version 7 embeds a creation timestamp that anyone can decode. Avoid it if the timing is sensitive.
- Neither version is a secret. Use a random token generator if the value must be unguessable, such as for a password reset link.
Frequently asked questions
- What is the difference between UUID v4 and v7?
- Both are 128-bit and globally unique. Version 4 is entirely random, so values have no order. Version 7 prefixes a millisecond timestamp, so values sort in creation order, which is much better for database indexes and clustering.
- Should I use UUID or an auto-incrementing integer as a primary key?
- Integers are smaller and index better, but they leak volume information and cannot be generated client-side without coordination. UUIDs are larger but can be created anywhere, merge without conflict, and do not reveal how many records exist. Version 7 is the version to choose if you use UUIDs as keys.
- Are these values unpredictable?
- Yes, the randomness comes from the browser's cryptographic random source, so the values cannot be predicted by observing earlier output. That said, a UUID is an identifier, not a credential — do not use one as a secret.
- How many can I generate at once?
- As many as you ask for, in one batch. Generating a large number of UUIDs one at a time in your own code is slow because each draw is separate, so this tool draws them in bulk and returns the list ready to copy.