UUID Generator
A UUID (Universally Unique Identifier) is a 128-bit identifier used to uniquely identify resources in distributed systems. UUIDs are essential in software development for database primary keys, API identifiers, session tokens, and message correlation IDs where globally unique values are needed without central coordination.
This tool generates UUIDs in three versions: v1 (timestamp-based, includes creation time), v4 (fully random, the most commonly used), and v7 (Unix timestamp + random, sortable by creation time per RFC 9562). Each version has different trade-offs between uniqueness, privacy, and sortability.
How it works
UUID v4 uses 122 random bits, giving 2^122 (≈5.3 × 10^36) possible values. The probability of a collision after generating 1 billion UUIDs is approximately 2.7 × 10^-20, making duplicates virtually impossible in practice.
Use cases
- Generating unique database primary keys without auto-increment
- Creating correlation IDs for distributed system tracing
- Assigning unique identifiers to API resources and entities
- Testing applications that require UUID inputs
Frequently asked questions
What is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit identifier written as 32 hexadecimal digits in five hyphen-separated groups, such as 550e8400-e29b-41d4-a716-446655440000. UUIDs let distributed systems generate globally unique IDs without any central coordination. They are widely used for database keys, API resource IDs, and correlation IDs.
What is the difference between UUID v1, v4, and v7?
UUID v1 is timestamp-based and encodes the creation time; v4 is generated from 122 random bits and is the most commonly used version; v7 combines a Unix millisecond timestamp with random bits, making IDs sortable by creation time per RFC 9562. Choose v4 for maximum randomness, v7 when you need time-ordered IDs, and v1 only when legacy compatibility requires it.
Can two UUIDs ever be the same?
A collision is theoretically possible but practically negligible. UUID v4 has 2^122 (about 5.3 × 10^36) possible values, so after generating 1 billion UUIDs the collision probability is roughly 2.7 × 10^-20. For real-world systems, duplicates are considered impossible in practice.
Which UUID version should I use for database primary keys?
UUID v7 is generally the best choice for primary keys because its timestamp prefix makes values roughly sequential, which improves B-tree index locality and insert performance compared to fully random v4 keys. UUID v4 still works fine for smaller tables or when insertion order must not be inferable from the ID.
Do UUIDs expose any information about me?
It depends on the version. UUID v1 embeds the creation timestamp and historically the machine's MAC address, which can reveal when and where it was generated. UUID v4 is fully random and reveals nothing, while v7 exposes only the creation time. This generator runs entirely in your browser, so no generated values are sent anywhere.