UUID Validator
Check whether a UUID string is valid and correctly formatted.
Back to all tools on ToolForge
Result
About UUID Validator
This UUID validator checks whether a string is a valid UUID (Universally Unique Identifier) and correctly formatted according to RFC 4122 standards. It validates the 8-4-4-4-12 hexadecimal structure and verifies that version and variant bits are properly set.
It is useful for form validation, API debugging, database migrations, and data cleanup when you need to confirm whether an identifier is a valid UUID or just a similar-looking string.
UUID Format Structure
A UUID is a 128-bit number represented as 32 hexadecimal digits in the format 8-4-4-4-12:
Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
| | | | |
| | | | +-- 48 bits (12 hex digits)
| | | +------- 12 bits (3 hex digits, includes variant)
| | +------------ 16 bits (4 hex digits, includes version)
| +----------------- 32 bits (8 hex digits)
+------------------------- 32 bits (8 hex digits)
Total: 128 bits = 32 hex digits + 4 hyphens = 36 characters
UUID Version Bits
The version is indicated by the most significant 4 bits of the time_hi_and_version field (13th hex character):
| Version | Hex Digit | Generation Method |
|---|---|---|
| UUID v1 | 1 | Time-based (timestamp + MAC address) |
| UUID v2 | 2 | DCE Security (time-based with POSIX UID/GID) |
| UUID v3 | 3 | Name-based using MD5 hash |
| UUID v4 | 4 | Random/pseudo-random generation |
| UUID v5 | 5 | Name-based using SHA-1 hash |
UUID Variant Bits
The variant is indicated by the most significant bits of the clock_seq_hi_and_reserved field (17th hex character). RFC 4122 defines the variant as one of:
| Variant | Hex Digits | Description |
|---|---|---|
| RFC 4122 | 8, 9, a, b | Standard UUID format (most common) |
| Microsoft GUID | c, d, e, f | Legacy Microsoft GUID format |
| Reserved (NCS) | 0-7 | Reserved for NCS backward compatibility |
Validation Regex Pattern
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
Breakdown:
- ^[0-9a-f]{8} : 8 hex digits (time_low)
- -[0-9a-f]{4} : 4 hex digits (time_mid)
- -[1-5][0-9a-f]{3}: version (1-5) + 3 hex digits (time_hi_and_version)
- -[89ab][0-9a-f]{3}: variant (8,9,a,b) + 3 hex digits (clock_seq)
- -[0-9a-f]{12}$ : 12 hex digits (node)
Common UUID Examples
UUID v1 (time-based): 550e8400-e29b-11d4-a716-446655440000 UUID v3 (MD5 name-based): 6fa45988-0f35-36d3-a09c-3a52f1b3b003 UUID v4 (random): 550e8400-e29b-41d4-a716-446655440000 UUID v5 (SHA-1 name-based): 886313e1-3b8a-5372-9b90-0c9aee199e5d
Common Use Cases
- Database migrations: Validate UUID strings before inserting into UUID-typed columns
- API development: Verify UUID parameters in REST endpoints
- Data import/cleanup: Filter invalid UUIDs from datasets
- Form validation: Client-side validation for UUID input fields
- Debugging: Quickly check if a string is a properly formatted UUID
UUID vs GUID
UUID (Universally Unique Identifier) and GUID (Globally Unique Identifier) are often used interchangeably. UUID refers to the RFC 4122 standard, while GUID is Microsoft's implementation. Microsoft GUIDs may use variant values c-f, while standard UUIDs use 8-b.
Frequently Asked Questions
- What is a UUID and what is the standard format?
- A UUID (Universally Unique Identifier) is a 128-bit number used to uniquely identify information in computer systems. The standard format is 8-4-4-4-12 hexadecimal digits (36 characters including hyphens): xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. This format is defined in RFC 4122.
- What are the different UUID versions?
- UUID v1: Time-based (uses timestamp + MAC address). UUID v2: DCE Security (time-based with user/group IDs). UUID v3: Name-based using MD5 hashing. UUID v4: Random/pseudo-random generation. UUID v5: Name-based using SHA-1 hashing. Versions 3 and 5 produce deterministic UUIDs from names/namespaces.
- How do I identify a UUID version from the string?
- The version is stored in the 13th hex digit (first digit of the third group). For example, in '550e8400-e29b-41d4-a716-446655440000', the '4' indicates UUID v4. Valid versions are 1-5. The variant is indicated by the first hex digit of the fourth group (must be 8, 9, a, or b for RFC 4122).
- What makes a UUID invalid?
- Common invalid UUID issues: wrong character count (must be 36 with hyphens or 32 without), non-hexadecimal characters, invalid version digit (must be 1-5), invalid variant digit (must be 8, 9, a, or b), missing or misplaced hyphens. This validator checks for proper 8-4-4-4-12 format with valid version and variant bits.
- What is the difference between UUID v4 and v5?
- UUID v4 is randomly generated (122 random bits), providing 2^122 possible values. UUID v5 is deterministic, generated by hashing a namespace UUID and name using SHA-1. Use v4 for random unique IDs; use v5 when you need consistent UUIDs for the same input (e.g., converting database keys to UUIDs).
- Are UUIDs guaranteed to be unique?
- UUIDs are not mathematically guaranteed unique, but the collision probability is negligible for practical purposes. For v4, generating 1 billion UUIDs per second for 100 years gives roughly a 50% chance of one collision. For v1/v5, uniqueness depends on proper implementation (unique MAC address or namespace).