UUID Decoder and Validator

Decode and validate UUIDs to extract version, timestamp and metadata

Try these examples:

What is UUID Decoding?

UUID decoding is the process of analyzing a UUID to extract information about its:

  • Version: Which UUID version (1-8) based on 4 bits in position 48-51
  • Variant: Which UUID variant (usually RFC 4122) based on bits 64-65
  • Components: Extracting timestamp, node ID, or other data based on version
  • Generation time: For time-based UUIDs (v1, v6, v7)

Example: 123e4567-e89b-12d3-a456-426614174000 is a Version 1 UUID created on 2018-10-03 09:45:32 UTC.

UUID Structure Overview

FormatDescription
8-4-4-4-1232 hex digits grouped with hyphens
Version bitsBits 48-51 (13th digit)
Variant bitsBits 64-65 (17th digit)

The version number appears as the first hex digit in the third group (e.g., 123e4567-e89b-12d3-a456-426614174000 for version 1).

Decoding by UUID Version

VersionWhat can be decoded
UUID v1
  • Timestamp (with 100ns precision, since Oct 15, 1582)
  • MAC address (if not randomized)
  • Clock sequence (for collision avoidance)
UUID v3/v5
  • Cannot decode original input
  • Can verify if created from known inputs
  • Can distinguish between v3 (MD5) and v5 (SHA-1)
UUID v4
  • Random data only
  • No extractable information
  • Can verify it's a valid v4 UUID
UUID v6
  • Timestamp (with 100ns precision, since Oct 15, 1582)
  • MAC address (if not randomized)
  • Clock sequence (for collision avoidance)
UUID v7
  • Unix timestamp (millisecond precision)
  • Random component (not decodable)
ULID
  • Unix timestamp (millisecond precision)
  • Random component (not decodable)

Timestamp Extraction from UUIDs

UUID TypeTime Extraction MethodEpoch
UUID v1Combine bits 0-31, 32-47, and 48-59, reordering timestamp componentsOctober 15, 1582
UUID v6Extract bits 0-59 (already in correct order)October 15, 1582
UUID v7Extract bits 0-47 (Unix milliseconds)January 1, 1970
ULIDDecode first 10 Base32 characters to get 48-bit Unix millisecondsJanuary 1, 1970

UUID Validation Rules

  • Format check: 8-4-4-4-12 hexadecimal digits with hyphens
  • Version check: 13th character must be 1-8
  • Variant check: 17th character must be 8, 9, A, or B (for RFC 4122)

Regular expression for basic UUID validation:

^[0-9a-f]8-[0-9a-f]4-[1-8][0-9a-f]3-[89ab][0-9a-f]3-[0-9a-f]12$

Practical Applications

  • Forensic analysis: Determining when IDs were created
  • Debugging: Tracing system behavior through ID timestamps
  • Auditing: Validating chronological integrity
  • Security analysis: Detecting forged or manipulated IDs
  • Data recovery: Reconstructing temporal relationships
  • System migrations: Understanding legacy UUID implementation details

MAC Address Extraction (v1/v6)

For UUID v1 and v6, you can often extract the node identifier (MAC address) if it wasn't randomized during generation:

  1. Extract the last 12 hex digits (48 bits) from the UUID
  2. Format with colons as XX:XX:XX:XX:XX:XX
  3. Check if the MAC address is real or random by examining the multicast bit

If the first byte has bit 0x01 set, it's likely a randomized node ID rather than an actual MAC address.

Frequently Asked Questions

Can I determine exactly when a UUID v4 was created?

No. UUID v4 is purely random with no timestamp information. Time of creation cannot be determined from a UUID v4 value.

How accurate are timestamps in time-based UUIDs?

UUID v1/v6 timestamps have 100-nanosecond precision. UUID v7 and ULID have millisecond precision. However, actual system clock accuracy may vary.

Can I convert between UUID versions?

No, you cannot convert directly between versions while preserving the same identifier value. Different versions have fundamentally different structures.

Can I identify the computer that generated a UUID v1?

If the node ID wasn't randomized, a UUID v1 may contain the MAC address of the generating system. However, many modern implementations randomize this for privacy.

How can I tell if a UUID is valid?

Check the format (8-4-4-4-12 hex digits), verify the version digit (13th character) is 1-8, and confirm the variant bits (17th character is 8, 9, A, or B for RFC 4122 UUIDs).

Resources