About UUID & Token Generator
Produces a single value or a whole batch, drawn from your browser's cryptographic generator rather than a seeded pseudo-random one. The distinction matters as soon as the value becomes a database key or a session token.
Generate RFC-4122 version-4 UUIDs and secure random tokens one at a time or in bulk. UUIDs are 128-bit identifiers with such a vast range that collisions are practically impossible, making them ideal for database keys, request IDs and idempotency keys.
Copy a single identifier or generate hundreds at once. Version 4 is random rather than sequential, which is what makes it safe to expose in a URL but slower as a database primary key than a monotonic id.
Version 4 UUIDs draw 122 random bits, which puts collisions beyond practical concern — you would need to generate billions per second for decades before the probability became worth modelling. The real trade-off is not uniqueness but ordering. Random keys scatter inserts across a B-tree index, fragmenting it and destroying the locality that makes recent rows fast to read, which is why large tables keyed on v4 degrade in a way sequential ids do not.
Version 7 exists precisely for that, placing a timestamp in the high bits so new rows sort together and land near each other in the index while keeping random bits for uniqueness. It has become the sensible default for database primary keys, with v4 remaining right for tokens and identifiers where ordering would leak information. Version 1 is worth avoiding in anything new: it embeds the generating machine's MAC address, which is information disclosure for no benefit now that v7 is available.
Common use cases
- Creating primary keys for records that must be unique across several databases or services.
- Generating idempotency keys so a retried API request is not processed twice.
- Producing correlation or request IDs for tracing a call through a distributed system.
- Creating unguessable identifiers for a resource exposed in a URL.
- Seeding test fixtures with stable identifiers that can be referenced across systems.