UUIDv4 Generator

Generate UUIDv4 IDs

Copy

UUIDv4 Generator

Universally Unique Identifiers (UUIDs) are standardized identifiers defined by RFC 4122, which outlines the structure and generation methods for UUIDs. UUIDs are 128-bit numbers, typically represented as 32 hexadecimal digits separated by hyphens, expressed using the 8-4-4-4-12 format:
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
where M is the version number and N is the variant.  

The version number is defined by the most significant 4 bits (higher nibble) of the 7th byte of the UUID (this is the character after the second dash). RFC 4122 defines several UUID versions (1 through 5), each with a different generation algorithm: 

Ver. Bits  Description
1    0001  The time-based version.
2    0010  Distributed Computing Environment (DCE) Security version, with embedded POSIX UIDs.
3    0011  The name-based version that uses MD5 hashing.
4    0100  The randomly or pseudo-randomly generated version.
5    0101  The name-based version that uses SHA-1 hashing.

The variant or type field determines the layout of the UUID and, as a result, specifies the interpretation of all other bits in the UUID. The variant field consists of a variable number of the most significant bits of the 8th byte of the UUID ("x" indicates any value):

Bits    Description
0xx	Reserved for Network Computing System (NCS) backward compatibility.
10x	The variant specified in RFC 4122.
110	Reserved for Microsoft Corporation COM/DCOM backward compatibility
111	Reserved for future definition.

UUIDv4

UUIDv4, the "random" or "pseudo-random" version, is generated based on random or pseudo-random numbers. It provides 122 bits of randomness, making it highly unlikely for two UUIDv4s to collide.

Generating UUIDv4:

  • Generate 16 random bytes: Typically, these are generated using a cryptographically secure pseudo-random number generator.
  • Set the version bits: In UUIDv4, this involves setting specific bits to indicate that it is a UUIDv4.
  • Set the variant bits: UUIDv4 uses the variant specified in RFC 4122.
  • Format the UUID: The 16 bytes are then formatted into the 32-digit hexadecimal representation with hyphens.

UUIDv4 provides a robust and widely adopted mechanism for generating unique identifiers, especially in scenarios where centralized coordination might be challenging or impractical.

Contact

Missing something?

Feel free to request missing tools or give some feedback using our contact form.

Contact Us