Stays in your browser
UUID Generator — Create Online
Free UUID generator. Create RFC 4122 version 4 UUIDs and copy them in bulk.
- 13ea71de-8389-4454-8a45-a1721e29d387
- a37b3105-d099-401b-8ec3-312d2530330d
- f705e850-a597-4a04-b792-ee1480c9f0a4
- c9414f9c-c6fb-49b3-8599-dc767e555d69
- 46d1d702-20be-4dfc-9006-834ba07a7676
Picking the right UUID version
UUID version matters more than most teams expect, because it decides what your database index looks like. A random v4 key inserts all over the B-tree, which fragments the index and makes write-heavy tables slower as they grow. A time-ordered v7 key is still globally unique but increases over time, so inserts land near the end of the index the way an auto-increment integer does.
UUIDs are the right choice when identifiers must be generated independently in many places without coordination, or when a sequential integer would leak information such as how many orders you have taken. They are the wrong choice when an identifier appears in a URL that people read, since 36 characters are hard to type and hard to remember.
One thing a UUID is not is a secret. Version 4 has enough randomness that guessing one is impractical, but UUIDs are frequently logged, indexed, and shared, and they carry no expiry or revocation. Treat anything that grants access as a credential with its own lifecycle rather than reusing an identifier as a token.
FAQ
- What is a UUID?
- A universally unique identifier used for database keys and distributed systems.
- Is v4 random?
- Yes. Version 4 uses cryptographically strong randomness.
- Can two UUIDs collide?
- In theory yes, but the probability is negligible in practice.
- Should I use UUID v4 or v7?
- Use v7 for new database primary keys, because its time prefix keeps inserts sequential and the index healthy. Use v4 when the value must not reveal when it was created, or when it is generated once and rarely written, such as a request identifier in logs.
- Are UUIDs a good primary key?
- They are workable if the storage cost is acceptable: 16 bytes and a wider index than a 4-byte integer, plus a bulkier foreign key everywhere it is referenced. The performance concern is randomness, not the size, which is why time-ordered versions exist and why v4-only schemas tend to need rethinking at scale.
- Can I use a UUID as an API token?
- It is inadvisable even though v4 has strong randomness. Tokens need expiry, scoping, rotation, and revocation, and a UUID carries none of those. Generate credentials with a dedicated CSPRNG and store only a hash of them, so a database leak does not hand over live access.