UUID Generator Online
Generate UUID v4 (random) and v7 (time-ordered) instantly. Bulk generate, validate, and copy — free with no signup required.
UUID Structure Breakdown
UUID Validator
What Is a UUID?
A UUID (Universally Unique Identifier), also called a GUID (Globally Unique Identifier), is a 128-bit label used to uniquely identify information without a central coordinating authority. Defined in RFC 4122, a UUID is represented as 32 hexadecimal digits arranged in five groups separated by hyphens: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx, where M is the version and N encodes the variant.
UUIDs are used as primary keys in databases, identifiers for API resources, session tokens, filenames, and distributed system record IDs — anywhere you need a unique identifier that does not require coordination between systems.
UUID v4 vs v7 — Which Should You Use?
UUID v4 — Random
- ✓122 bits of cryptographic randomness
- ✓Virtually zero collision probability
- ✓No information leakage about creation time
- ✗Random ordering hurts B-tree index performance
- ✗Cannot determine which UUID was created first
Best for: privacy-sensitive IDs, URLs, session tokens, any context where ordering does not matter.
UUID v7 — Time-ordered
- ✓First 48 bits encode Unix millisecond timestamp
- ✓Monotonically increasing — sorts by creation time
- ✓Dramatically better database index locality
- ✓Embeds timestamp — useful for debugging
- ✗Exposes creation time in the ID
Best for: database primary keys (PostgreSQL, MySQL, SQLite), event logs, anything that benefits from chronological ordering.
Recommendation: Use UUID v7 for new database schemas — it has the same global uniqueness guarantees as v4 but with far better index performance due to sequential ordering. Use v4 when you need to conceal creation time.
UUID Format Explained
| Section | Bits | Description |
|---|---|---|
| time-low | 32 | Low 32 bits of time (v1) or random/timestamp (v4/v7) |
| time-mid | 16 | Middle 16 bits of time or random data |
| time-hi-and-version | 16 | High 12 bits of time + 4-bit version number (M) |
| clock-seq-and-variant | 16 | 2-bit variant field (N) + 14-bit clock sequence |
| node | 48 | 48 bits of random data (v4/v7) or MAC address (v1) |
Common Use Cases for UUIDs
Database Primary Keys
Replace auto-increment integers with UUIDs to safely merge datasets, support distributed writes, and avoid exposing record counts in URLs. UUID v7 is preferred for its index-friendly sequential ordering.
REST API Resources
Use UUID primary keys in API endpoints (/users/550e8400-e29b-41d4-a716-446655440000) to prevent enumeration attacks and decouple public IDs from internal row counts.
Distributed Systems
In microservices and event-driven architectures, UUIDs let each service generate IDs independently without a central sequence generator, eliminating a coordination bottleneck.
File & Object Names
Name uploaded files with UUIDs (uuid.jpg) in S3/R2/GCS buckets to prevent conflicts and avoid leaking original filenames or upload order.
Frequently Asked Questions
Are UUIDs truly unique?
A UUID v4 has 122 bits of randomness. The probability of generating two identical UUIDs even across one billion UUIDs per second for the entire age of the universe is astronomically small — effectively zero for any practical application. UUID v7 has 74 bits of randomness per millisecond, still far more than sufficient.
What is the difference between UUID and GUID?
Nothing meaningful. GUID (Globally Unique Identifier) is Microsoft's term for the same concept, defined in COM. The format is identical. Both refer to RFC 4122 128-bit identifiers.
Can I use UUIDs as database primary keys in PostgreSQL or MySQL?
Yes. PostgreSQL has a native uuid type that stores 16 bytes efficiently. MySQL stores them as CHAR(36) or BINARY(16). Use UUID v7 to maintain index locality and avoid the page-split performance issues caused by random v4 UUIDs in clustered indexes.
Is UUID v7 standardized?
Yes. UUID v7 was formally standardized in RFC 9562 (May 2024), which supersedes RFC 4122. It defines a time-ordered UUID using Unix Epoch milliseconds in the first 48 bits, followed by version bits, then random data — making it both unique and sortable.
What about UUID v1?
UUID v1 also embeds a timestamp but uses the MAC address of the host as the node field, which leaks the machine's network identity. v7 is the modern, privacy-safe replacement for v1's time-ordering property.