What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit label used to uniquely identify information in computer systems. The standard form is defined by RFC 4122 and renders as 32 hexadecimal digits grouped by hyphens, for example:

550e8400-e29b-41d4-a716-446655440000

Format & Length

A UUID is always 128 bits (16 bytes). The canonical string representation is 36 characters: 8-4-4-4-12 hex groups separated by hyphens. The 3rd group starts with the version digit, and the 4th group starts with a variant digit.

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
       M = version (1-8)
       N = variant (8, 9, a, or b for RFC 4122)

Versions

  • v1 — Time-based
  • v3 — Namespace MD5
  • v4 — Random
  • v5 — Namespace SHA-1
  • v6 — Reordered time
  • v7 — Unix time + random
  • v8 — Custom

FAQ

What does UUID stand for?

UUID stands for Universally Unique Identifier. It is also known as GUID (Globally Unique Identifier) in Microsoft ecosystems.

How long is a UUID?

A UUID is 128 bits long. In its standard hyphenated form it is 36 characters (32 hex digits + 4 hyphens). Without hyphens it is 32 characters.

Can a UUID be duplicated?

The probability of a collision is astronomically small. For v4 (random), you would need to generate about 2.71 × 10^18 UUIDs to reach a 50% chance of a single collision.

What is a UUID used for?

UUIDs are used as database primary keys, distributed system identifiers, software/hardware identifiers, API keys and anywhere a unique reference is needed without a central authority.