UUIDs (Universally Unique Identifiers) are 128-bit values used to identify resources without a central authority. You’ve seen them — strings like 550e8400-e29b-41d4-a716-446655440000. But not all UUIDs are created equal.

UUID Structure

A UUID has 36 characters (128 bits) displayed in 5 groups:

550e8400-e29b-41d4-a716-446655440000
┗━━┛┗━━┛┗━━┛┗━━━┛┗━━━━━━━━━━━━━┛
  1    2    3    4        5
  • Groups 1–4: timestamp and clock sequence
  • Group 5: 12 random bytes

UUID v1: Time-Based

UUID v1 embeds the timestamp and MAC address of the generating machine:

{
  "uuid": "550e8400-e29b-11d4-a716-446655440000",
  "time_low": 0x550e8400,
  "time_mid": 0xe29b,
  "time_hi_and_version": 0x11d4,   version 1
  "clock_seq": 0xa716,
  "node": 0x446655440000 MAC address
}

Characteristics:

  • Time-ordered: later UUIDs sort after earlier ones (useful for databases)
  • Reveals which machine generated the UUID and approximately when
  • MAC address can be a privacy concern

UUID v4: Random

UUID v4 generates 122 bits of randomness — no timestamp, no node information:

{
  "uuid": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "time_low": 0xf47ac10b,
  "time_mid": 0x58cc,
  "time_hi_and_version": 0x4372,   version 4 (bits set to 4)
  "clock_seq": 0xa567,
  "node": 0x0e02b2c3d479 random
}

Characteristics:

  • No information leakage — doesn’t reveal time or machine
  • Not sortable by generation order
  • Statistically unique — the probability of collision is vanishingly small

Version 1 vs Version 4: Side by Side

| Property | UUID v1 | UUID v4 | |----------|---------|---------| | Bits of randomness | ~60 | 122 | | Time-ordered | Yes | No | | Contains MAC address | Yes | No | | Privacy-preserving | No | Yes | | Collision risk | Very low | Extremely low | | Sortable | Yes (by time) | No | | Database-friendly | Yes (for insertion order) | Yes (if indexed) |

Which to Use When

Use UUID v1 when:

  • You need insert-order sorting in a database without a separate timestamp
  • You want to debug when and where a UUID was created
  • Privacy is not a concern (internal systems)

Use UUID v4 when:

  • You need truly random, unguessable identifiers
  • Privacy matters — no MAC address or timestamp should be exposed
  • You’re generating tokens, session IDs, or public identifiers

The Myth of UUID Collisions

The UUID v4 collision probability is negligible. With 122 bits of entropy, you’d need to generate 2.7 quintillion UUIDs before expecting a single collision (birthday paradox aside, the math is reassuring).

v7: Time-Ordered Random UUIDs (Bonus)

A newer standard — UUID v7 — combines the best of both:

  • Time-ordered (like v1)
  • Random node identifier (like v4, no MAC privacy issue)
  • 62 bits of timestamp + 62 bits of randomness
{
  "uuid": "0192a31e-2687-7f42-b1a7-e24d00f3d24a",
  "time_hi_and_version": 0x7f42 version 7
}

v7 is useful for databases where insert-order sorting matters and you don’t want UUID v1’s privacy issues.

Summary

UUID v1 embeds timestamp and MAC address — useful for sorting, bad for privacy. UUID v4 is fully random — great for security, no information leakage. UUID v7 is the newer hybrid that gives you both time-ordering and privacy.

Generate UUID v1 and v4 instantly with the UUID Generator.