What is uuid format
Last updated: April 1, 2026
Key Facts
- The UUID format structure is: time_low (8 digits)-time_mid (4 digits)-time_high_and_version (4 digits)-clock_sequence (4 digits)-node (12 digits)
- UUID format is defined by RFC 4122, an Internet Engineering Task Force standard ensuring consistency across systems
- Five UUID versions exist with different generation methods: version 1 (time-based), version 3 (MD5 namespace), version 4 (random), version 5 (SHA-1 namespace), and version 6 (time-based with improvements)
- UUIDs are case-insensitive and can be represented with or without hyphens, though the hyphenated format is standard
- The UUID format provides approximately 5.3 × 10^36 possible unique identifiers, making collision probability virtually zero for practical applications
UUID Format Specification
The UUID (Universally Unique Identifier) format is a standardized method for creating globally unique identifiers defined by RFC 4122. A UUID consists of 128 bits (16 bytes) of data, typically represented as a 36-character hexadecimal string. The standard format uses lowercase or uppercase letters (a-f or A-F) combined with digits (0-9), separated by four hyphens into five groups following the pattern: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
UUID Structure and Components
The 36-character UUID format breaks down into five components:
- Time Low (8 hex digits): In time-based UUIDs, represents the low 32 bits of the timestamp
- Time Mid (4 hex digits): The middle 16 bits of the timestamp
- Time High and Version (4 hex digits): The highest 12 bits of timestamp plus 4-bit version number
- Clock Sequence (4 hex digits): 2-bit variant field plus 14-bit clock sequence
- Node (12 hex digits): In time-based UUIDs, typically the MAC address of the host machine
UUID Versions and Variants
RFC 4122 defines five UUID versions, each with distinct generation methods and use cases. Version 1 uses timestamp and MAC address for uniqueness, providing sortability but potentially revealing system information. Version 3 generates UUIDs from MD5 hashes of namespaces and names, useful for deterministic generation. Version 4 creates random UUIDs, the most commonly used version in modern applications due to its simplicity and privacy. Version 5 uses SHA-1 hashing for better security than version 3. Version 6, a newer addition, improves upon version 1 with better sortability and privacy characteristics.
UUID Representation and Variants
While the hyphenated 36-character format is standard, UUIDs can be represented in multiple ways. The hex format removes hyphens (32 hexadecimal characters), the URN format adds the prefix "urn:uuid:", and some systems use binary format for storage optimization. The UUID specification includes a 2-bit variant field that indicates the UUID structure type, with the variant bits typically set to 10 in RFC 4122 compliant UUIDs.
UUID Format in Practice
Across programming languages and databases, UUID format remains consistent. A typical UUID looks like: 550e8400-e29b-41d4-a716-446655440000. Databases like PostgreSQL, MySQL, and others support native UUID data types that automatically handle validation and storage. APIs and web services commonly transmit UUIDs as JSON strings in this standard format. The format's simplicity and universality have made it the de facto standard for unique identification across distributed systems, microservices architectures, and modern application development.
Related Questions
What are UUID versions and which should I use?
UUID versions 1-5 use different generation methods. Version 4 (random) is most common in modern applications. Version 5 offers better security through SHA-1 hashing, while version 1 provides sortability but reveals system info.
Are two UUIDs ever the same?
With version 4 (random), collision probability is virtually zero in practical applications. With version 5 (deterministic), identical inputs always produce identical UUIDs, which is sometimes desirable.
Why are UUIDs better than sequential numbers for databases?
UUIDs eliminate the need for centralized ID generation, supporting distributed systems and database replication without coordination. They work seamlessly in microservices and multi-server environments.