UUID Generator Online
Generate random UUID/GUID instantly.
What is UUID?
UUID (Universally Unique Identifier) is a 128-bit identifier that is unique across both space and time. UUIDs are also known as GUIDs (Globally Unique Identifiers). They are commonly used in software development to uniquely identify information without requiring a central registration authority.
UUID Format
A UUID is represented as 32 hexadecimal digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and 4 hyphens).
Example: 550e8400-e29b-41d4-a716-446655440000
UUID Versions
UUID has multiple versions, each designed for different use cases. The version number is encoded in the UUID itself (the first character of the third group).
UUID v1 (Time-based)
Background: UUID v1 was one of the original UUID versions defined in RFC 4122. It combines a timestamp with the MAC address of the generating machine to create a unique identifier.
How it works: Uses a 60-bit timestamp (100-nanosecond intervals since October 15, 1582), a 14-bit clock sequence, and a 48-bit node ID (typically the MAC address).
Use cases:- Distributed systems where you need to trace when and where a UUID was generated
- Database records that benefit from time-ordered identifiers
- Audit logging where timestamp information is valuable
- Legacy systems that require RFC 4122 compliance
Considerations: Exposes the MAC address and creation time, which may be a privacy concern. Not suitable for security-sensitive applications.
UUID v4 (Random)
Background: UUID v4 is the most widely used version today. It relies entirely on random or pseudo-random numbers, making it simple to implement and privacy-friendly.
How it works: 122 bits are randomly generated, with 6 bits reserved for version and variant information. This provides approximately 5.3 × 10³⁶ possible UUIDs.
Use cases:- Primary keys in databases (most common use case)
- Session identifiers and tokens
- Unique identifiers for objects, files, or resources
- Any scenario where you need a simple, random unique ID
- Microservices and distributed systems
Considerations: Not sortable by creation time. Collision probability is extremely low but theoretically possible. Requires a good random number generator.
UUID v5 (SHA-1 Name-based)
Background: UUID v5 generates deterministic UUIDs by hashing a namespace and name using SHA-1. Given the same inputs, it always produces the same UUID. (UUID v3 is similar but uses MD5.)
How it works: Concatenates a namespace UUID with a name string, then applies SHA-1 hashing. The first 128 bits of the hash become the UUID (with version and variant bits set).
Standard namespaces:- DNS - For domain names (e.g., "example.com")
- URL - For URLs (e.g., "https://example.com/page")
- OID - For ISO Object Identifiers
- X500 - For X.500 Distinguished Names
Use cases:- Generating consistent IDs for resources across different systems
- Creating reproducible identifiers from human-readable names
- URL shortening services or content addressing
- Deduplication based on content or name
- Mapping external identifiers to UUIDs consistently
Considerations: Deterministic nature means the same input always produces the same UUID. Not suitable when uniqueness per generation is required.
UUID v7 (Unix Epoch Time-based)
Background: UUID v7 is a newer version proposed in the draft RFC for new UUID formats. It addresses the limitations of v1 by using Unix Epoch timestamps, making UUIDs naturally sortable.
How it works: Uses a 48-bit Unix timestamp (milliseconds since 1970-01-01), followed by random bits. The timestamp is placed in the most significant bits, enabling lexicographic sorting.
Use cases:- Database primary keys where insertion order matters (better index performance)
- Time-series data and event logging
- Distributed systems requiring sortable, unique identifiers
- Modern applications replacing auto-increment IDs
- Systems where you want both uniqueness and chronological ordering
Considerations: Still a draft standard (as of 2024), but gaining adoption. Provides better database performance than v4 due to sequential nature. Recommended for new projects that need sortable UUIDs.
Version Comparison
- Need random, simple IDs? → Use UUID v4
- Need sortable, time-ordered IDs? → Use UUID v7
- Need deterministic IDs from names? → Use UUID v5
- Need legacy compatibility with timestamp? → Use UUID v1
This generator supports all four versions. UUID v4 is selected by default as it provides random, unique identifiers suitable for most use cases.