Home Other UUID Generator

UUID Generator

Generate random UUIDs.

Input

Result

ADVERTISEMENT

What is a UUID Generator?

A UUID Generator creates universally unique identifiers (UUIDs) following the UUID v4 standard. Each UUID is a 128-bit number displayed as 32 hexadecimal characters in a 8-4-4-4-12 grouping pattern. UUIDs are used in software development as unique keys for database records, distributed system identifiers, and API resource names where uniqueness across systems is essential.

How to calculate a UUID v4 manually (the formula)

A UUID v4 contains 122 random bits plus 6 fixed bits (version and variant). The format is: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx. The 4 indicates version 4. The y encodes the variant (8, 9, A, or B). Each x is a random hexadecimal digit. To generate: create 16 random bytes, set bit 6 of byte 7 (version nibble to 0100 = 4), set bits 6-7 of byte 9 to 10 (variant), then format as hex with hyphens.

Example calculation

A generated UUID v4: f47ac10b-58cc-4372-a567-0e02b2c3d479. The 4 in position 13 (43-72-4**3**72) identifies version 4. The A in position 17 (a567) is the variant nibble (10 binary = A hex). The remaining 122 bits are cryptographically random. This format provides approximately 5.3 × 10^36 possible unique values.

Common mistakes

  • Using UUID v1 when privacy matters — UUID v1 embeds the MAC address and timestamp, potentially exposing hardware identity and creation time.
  • Storing UUIDs as sequential integers — UUIDs are not sequential; using them as clustered primary keys in databases can cause index fragmentation. Use a separate auto-increment key or a sequential UUID variant.
  • Truncating the UUID for display — Using only the first 8 characters (32 bits) dramatically increases collision risk from negligible to approximately 1 in 4 billion.

Frequently asked questions

What is a UUID?

A UUID is a 128-bit identifier formatted as 32 hexadecimal characters in groups separated by hyphens (8-4-4-4-12).

How is a UUID v4 generated?

Version 4 UUIDs use random or pseudo-random numbers for all 128 bits except predetermined version and variant bits.

What is the UUID format?

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f).

Are UUIDs guaranteed unique?

With 2^122 random bits, the probability of collision is astronomically low, practically guaranteeing uniqueness.

What is the difference between UUID v4 and v1?

v4 is random; v1 uses the MAC address and timestamp, making it predictable.

When should I use a UUID?

Use UUIDs for database primary keys, distributed system identifiers, session tokens, and API resource names.