UUID Generator
Generate random UUID v4 identifiers
Identifiers that never collide
A UUID (Universally Unique Identifier) is a 128-bit value written as 32 hexadecimal characters in the familiar 8-4-4-4-12 pattern. Its whole purpose is to let many independent systems each mint identifiers without coordinating - no central counter, no risk of two machines picking the same value.
f47ac10b-58cc-4372-a567-0e02b2c3d479
└─ 8 ─┘ └4┘ └4┘ └4┘ └─ 12 ──┘Why version 4 is the default
Version 4 UUIDs are almost entirely random - 122 of the 128 bits come from a random source. The number of possible values is so enormous that the chance of generating the same one twice is, for all practical purposes, zero. That is what makes them safe to create independently on a phone, a server and a background worker all at once.
Where they earn their keep
- Database primary keys that can be generated client-side before a record is saved.
- Idempotency keys so a retried API request is not processed twice.
- Correlation IDs for tracing one request across multiple services and logs.
- Unique file or upload names that will never clash.
v4 versus v7
One trade-off worth knowing: because v4 is fully random it scatters across a database index, which can hurt insert performance at scale. The newer version 7 embeds a timestamp so the values sort roughly in creation order, giving much better index locality. If you control the schema and care about write performance, v7 is worth a look; for everything else, v4 is the dependable workhorse. In modern browsers and Node you can generate one in a single call with crypto.randomUUID().