What is a UUID?
A universally unique identifier is a 128-bit value designed so independently generated identifiers can be used without a central counter. The familiar text form contains 32 hexadecimal digits divided by hyphens into groups of 8-4-4-4-12.
UUID is the standards-oriented name; GUID is a closely related term commonly used in Microsoft ecosystems.
UUID v4 structure
550e8400-e29b-41d4-a716-446655440000In a version 4 UUID, the first hexadecimal digit of the third group is 4. The first digit of the fourth group identifies the standard variant and is commonly 8, 9, a, or b. The remaining available bits are random.
Randomness and collision risk
UUID v4 provides 122 random bits after reserving version and variant bits. That is a very large space, so accidental duplication is extremely unlikely with a cryptographically secure random generator and ordinary volumes.
“Extremely unlikely” is not the same as impossible. Poor random sources, implementation bugs, copied fixtures, or manual reuse can create duplicates, so storage systems should still enforce uniqueness.
UUID v4 versus auto-increment IDs
- Distributed generation: UUIDs can be created before a database round trip.
- Predictability: sequential IDs reveal ordering and approximate counts; random UUIDs are harder to enumerate but are not access-control secrets.
- Index locality: random values can produce less database index locality than increasing keys.
- Size: UUID text and 128-bit storage are larger than many integer keys.
Common UUID v4 uses
UUID v4 is useful for request correlation, offline-created records, event identifiers, test fixtures, public object references, and records produced across multiple services. It should not be treated as proof of authorization merely because it is difficult to guess.
Generate a UUID v4
The Orbilyra UUID Generator uses the browser's cryptographically secure UUID capability to generate one or many lowercase, hyphenated version 4 values locally.
If a record also needs a creation time, store an explicit timestamp. The Unix timestamp guide explains how machine-readable time values differ from random identifiers.