DigitHelm

UUID Generator | UUID v4

Generate UUID v4 universally unique identifiers instantly. Generate single or bulk UUIDs.

UUID Version

Uses cryptographically secure random bits, 122 bits of entropy, 5.3×10³⁶ possible values.

Output Format

UUID Validator

Paste any UUID to check its validity and version.

What Is the UUID Generator | UUID v4?

A UUID (Universally Unique Identifier), also known as a GUID, is a 128-bit label standardised in RFC 4122. It is written as 32 hexadecimal digits in five groups separated by hyphens:xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx. The M nibble encodes the version and the N nibble encodes the variant.

UUIDv4 uses 122 bits of cryptographically secure randomness (6 bits are reserved for version and variant flags). The probability of a collision when generating 1 billion v4 UUIDs is approximately 6 × 10⁻¹⁹, effectively impossible in any practical application.

v4 vs v7, which should you use?

UUIDv4 is the current default for most applications. UUIDv7 (RFC 9562, 2024) embeds a 48-bit millisecond timestamp in the MSBs, making UUIDs lexicographically sortable by creation time, ideal for database primary keys because it reduces B-tree index fragmentation. Use v4 for random IDs; use v7 when insertion order matters.

Formula

UUID Version Comparison

VersionGeneration basisBits of entropySortable?Use case
v1Time + MAC address~60 bits (node varies)Yes (by time)Distributed systems needing ordering
v2Time + DCE security~60 bitsYesDCE/POSIX systems (rare today)
v3Name + MD5 hashDeterministicNoURL/DNS namespaced IDs (legacy)
v4Purely random (CSPRNG)122 bitsNoGeneral-purpose IDs, databases, APIs
v5Name + SHA-1 hashDeterministicNoReproducible namespaced IDs
v7Unix time ms + random74 bitsYes (by time)DB primary keys (newest standard)
NILAll zeros0 bitsN/APlaceholder / null identifier

How to Use

  1. 1Select a UUID version: v4 (random) for general use, v1 simulation for time-based ordering, or NIL for a zero placeholder.
  2. 2Choose an output format: lowercase (standard), UPPERCASE, or No Hyphens (compact, used in some databases).
  3. 3Set the quantity (1–100) and click Generate.
  4. 4Click Copy next to any individual UUID, or use Copy All (text) or Copy as JSON for bulk export.
  5. 5Scroll the UUID list if you generate many values, the panel is scrollable.
  6. 6Use the UUID Validator panel at the bottom to paste any UUID and instantly identify its version.
  7. 7The Recent History panel persists your last 10 generated UUIDs across page reloads via localStorage.

Example Calculation

Anatomy of a UUID v4

550e8400-e29b-41d4-a716-446655440000 ^^^^^^^^ ^^^^ ^^^^ ^^^^ ^^^^^^^^^^^ time_low time_mid ver var node Digit 13 (M) = 4 → version 4 Digit 17 (N) = a,b,8,9 → RFC 4122 variant v4 example from crypto.randomUUID(): f47ac10b-58cc-4372-a567-0e02b2c3d479 Bits 6–7 of octet 8: 10xxxxxx (variant bits)

Understanding UUID Generator | UUID v4

UUIDs solve the distributed ID generation problem: how do you create a unique identifier when multiple servers, clients, or database shards are creating records simultaneously, without a central coordinator? A v4 UUID requires no network call, no sequence table, and no coordination, each client generates its own ID independently with a collision probability so low it is safely ignored in any practical system.

The canonical UUID format is defined in RFC 4122 (now updated by RFC 9562 in 2024). The 32 hex digits are split into five groups with hyphens: 8-4-4-4-12. Position 13 (the first digit of the third group) encodes the version, and position 17 (the first digit of the fourth group) encodes the variant (10xx in binary for the RFC 4122 variant).

This generator uses crypto.randomUUID() in modern browsers, a cryptographically secure pseudorandom number generator (CSPRNG) provided by the browser's WebCrypto API. This is the same entropy source used for TLS key generation. On older browsers without crypto.randomUUID, a Math.random()-based fallback is used (statistically adequate for non-security use cases).

For database primary keys at scale, consider UUIDv7 (RFC 9562): it embeds a millisecond timestamp in the first 48 bits, making UUIDs sortable by creation time. This dramatically reduces B-tree index fragmentation compared to random v4 UUIDs inserted in arbitrary order.

Frequently Asked Questions

How unique is a UUID v4, what are the odds of a collision?

UUID v4 uses 122 bits of cryptographically random data:

  • 5.3 × 10³⁶ possible unique values (more than atoms in the observable universe per person).
  • Collision probability among 1 billion UUIDs: ~6 × 10⁻¹⁹ (effectively zero).
  • 50% collision probability requires generating ~2.7 × 10¹⁸ (quintillion) UUIDs.
  • Uses crypto.randomUUID() (CSPRNG) in modern browsers, not Math.random().

When should I use UUID v1 (time-based) instead of v4?

  • v1 encodes a 60-bit timestamp (100 ns intervals since Oct 1582) in the first three fields.
  • Sorting v1 UUIDs lexicographically approximates chronological order.
  • Original v1 embeds the MAC address, a privacy and tracking concern.
  • This tool uses a random node (privacy-safe v1 simulation) instead of MAC address.
  • Prefer UUIDv7 for new systems needing time-sortable IDs (RFC 9562, 2024).

What is a NIL UUID and when is it used?

  • Value: 00000000-0000-0000-0000-000000000000 (128 zero bits).
  • Used as a null/default value when a UUID field is required but not yet assigned.
  • Common in APIs that return a NIL UUID for resources not yet created.
  • Databases can index and query NIL UUIDs to find uninitialized records.
  • Distinct from NULL, NIL is a valid UUID value, NULL means no value present.

Should I store UUIDs as a string or binary in a database?

  • BINARY(16) or UUID type: 16 bytes, 55% smaller than the 36-character string form.
  • PostgreSQL: native uuid type, efficient storage, fast indexing.
  • MySQL: UUID_TO_BIN() / BIN_TO_UUID() with swap_flag=1 for v1 time ordering.
  • String (CHAR(36)): portable and debuggable but wastes 20 bytes per row.
  • For high-cardinality tables (millions of rows), binary storage meaningfully reduces index size.

What is the difference between UUID and GUID?

  • UUID: term from RFC 4122, used in Linux, Java, Python, PostgreSQL.
  • GUID: Microsoft's name, used in Windows Registry, COM, .NET, SQL Server (uniqueidentifier).
  • The format, bit layout, and versions are identical between UUID and GUID.
  • SQL Server NEWID() generates RFC 4122 v4 UUIDs despite the different terminology.
  • RFC 9562 (2024) updated the UUID standard and added v6, v7, v8.

Related Calculators