UUID Generator (v4 & v7)
UUID v4 (random) and v7 (time-ordered) generator. One at a time or in bulk.
This tool runs in your browser. No data leaves your device.
How It Works
A UUID (Universally Unique Identifier) is a 128-bit identifier whose chance of collision is practically zero. There are several versions; in practice two stand out: v4 and v7.
UUID v4
Fully random. Generated with crypto.randomUUID().
123e4567-e89b-42d3-a456-426614174000
^
version (4)
The upside: in a distributed system you can generate unique IDs with no coordination.
The downside: there is no temporal ordering. Used as a database primary key, the B-tree index keeps writing to scattered pages — insert performance degrades, especially on high-volume tables.
UUID v7
RFC 9562 (2024). The first 48 bits are a Unix millisecond timestamp, the rest is random. Still unique, but time-ordered.
01876d10-1b21-7000-8000-000000000000
^^^^^^^^^^^^^ ^
timestamp ms version (7)
Why v7 is better for a DB primary key:
- New rows land at the end of the B-tree.
- Index splits drop.
- Cache locality improves.
- Date-based queries can use the index.
Which one, when?
| Case | Choice |
|---|---|
| Database primary key | v7 |
| General-purpose IDs generated in an API | v7 or v4 |
| Where unpredictability is critical (e.g. session token) | v4 |
| Compatibility with an older system | v4 (supported everywhere) |
What about v1, v3, v5?
- v1: MAC address + timestamp. A privacy hole (it leaks the device). Don’t use it.
- v3, v5: the hash of a namespace. For a specific use case (e.g. when you need a deterministic ID); otherwise prefer v4/v7.
Collision probability
For UUID v4: even if you generated 1 billion UUIDs a year, you would have to wait about 85 years to see a collision. For v7, the time part requires two UUIDs to be generated in the same millisecond — and the collision probability in the random part is still negligible.
Privacy
UUIDs are generated in your browser with crypto.getRandomValues. Nothing leaves
your browser.