DevDash

UUID Generator

Generate v4 UUIDs for use in databases, APIs, and more.

Click Generate to create a new UUID. Use the count field to generate up to 100 at once.

Uppercase
Hyphens

About UUIDs

A UUID (Universally Unique Identifier) is a 128-bit value used to identify resources without requiring a central coordinating authority. UUIDs are standardized by RFC 9562 (formerly RFC 4122) and are displayed as 32 hexadecimal digits arranged in five groups separated by hyphens, following the patternxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (8-4-4-4-12). The version number is encoded in the 13th character, and the variant is encoded in the 17th.

UUID v4: Random Generation

Version 4 UUIDs are the most commonly used type. They are generated entirely from random or pseudo-random numbers, with 122 of the 128 bits being random (the remaining 6 bits indicate the version and variant). This tool uses your browser's crypto.randomUUID() API, which draws from a cryptographically secure random number generator. Because v4 UUIDs carry no information about when or where they were created, they do not leak timestamps or hardware identifiers.

Other UUID Versions

v1 UUIDs embed a timestamp and MAC address, making them sortable by creation time but potentially leaking hardware information. v3 and v5 UUIDs are generated by hashing a namespace identifier and a name using MD5 (v3) or SHA-1 (v5), producing deterministic output for the same input. v7 is a newer format that embeds a Unix timestamp in the most significant bits, combining time-based sortability with random uniqueness — making it increasingly popular for database primary keys.

Uniqueness Guarantees

With 122 random bits, the probability of generating two identical v4 UUIDs is extraordinarily small. You would need to generate approximately 2.71 quintillion (2.71 x 1018) UUIDs to reach a 50% chance of a single collision. To put this in perspective, if you generated one billion UUIDs per second, it would take about 86 years to reach that threshold. For all practical purposes, v4 UUIDs can be treated as unique.

Database Considerations

When using UUIDs as database primary keys, there are tradeoffs to consider. UUIDs are 128 bits compared to 32 or 64 bits for typical integer IDs, which increases storage size and index footprint. Random v4 UUIDs cause scattered inserts in B-tree indexes, which can degrade write performance at scale. Time-ordered formats like UUID v7 or ULID mitigate this by ensuring new IDs sort after existing ones. Despite these considerations, UUIDs excel in distributed systems where generating IDs without coordination between nodes is essential.

UUIDs vs Sequential IDs

Sequential auto-increment IDs are compact, human-readable, and index-friendly, but they reveal ordering information (an attacker can guess how many records exist) and cannot be generated independently across multiple databases. UUIDs solve these problems at the cost of larger storage and less readable identifiers. Many teams use UUIDs as external-facing identifiers while keeping integer IDs internally, getting the benefits of both approaches.

Frequently Asked Questions

What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit value displayed as 32 hexadecimal digits in five groups separated by hyphens, following the 8-4-4-4-12 format. UUIDs allow distributed systems to generate unique identifiers independently without a central authority or coordination between nodes.

Are UUIDs truly unique?

The collision probability for v4 UUIDs is astronomically low — approximately 1 in 2^122. With 122 random bits, you would need to generate billions of UUIDs per second for decades before reaching a meaningful collision probability. For all practical applications, v4 UUIDs can be treated as globally unique.

What is the difference between UUID v1 and v4?

UUID v1 combines a timestamp with the machine's MAC address, making IDs sortable by creation time but potentially leaking hardware information. UUID v4 is generated entirely from random numbers with no embedded metadata. V4 is more widely used because it reveals nothing about when or where it was created.

Should I use UUIDs or auto-increment IDs?

UUIDs are ideal for distributed systems where multiple nodes need to generate IDs independently without coordination. Auto-increment IDs are more compact, index-friendly, and human-readable, making them better for single-database applications. Many teams use auto-increment IDs internally and UUIDs as external-facing identifiers.

How many UUIDs can I generate before a collision?

You would need to generate approximately 2.71 quintillion (2.71 x 10^18) v4 UUIDs to reach a 50% probability of a single collision. At a rate of one billion UUIDs per second, that would take about 86 years. In practice, UUID collisions are not a realistic concern for any application.