Skip to content

UUID Format: Versions, Generation, and Validation

Oct 30, 2026 · Formats & Standards

Introduction to the UUID Format

A UUID is a 128-bit identifier written as 32 hexadecimal digits in an 8-4-4-4-12 layout. RFC 9562 defines the format, identifies the version in the third group, and defines the variant in the fourth group. UUIDs are useful for database keys, distributed records, and other identifiers that must work across systems. QuikConsole does not have a UUID parser or validator; its Regex Tester is the closest existing tool for checking a UUID against a pattern.

What is a UUID and Why is it Important?

A UUID is a 128-bit value that is designed to be globally unique. The probability of a collision, where two different UUIDs are identical, is so low that it is considered negligible for most practical purposes. This makes the uuid format an ideal choice for scenarios where unique identification is critical, such as in databases, network protocols, and distributed systems.

The importance of UUIDs lies in their ability to provide a high degree of confidence in uniqueness without the need for a central authority. This decentralized nature is particularly useful in distributed systems, where coordination between different components can be challenging.

Types of UUIDs

There are several types of UUIDs, each with its own generation method and use case. Understanding these types is crucial for selecting the appropriate uuid format for your specific needs.

  1. Version 1 (Time-Based UUID): These UUIDs are generated using the current timestamp and the MAC address of the network interface. They are useful when you need a time-ordered sequence of UUIDs.
  2. Version 2 (DCE Security UUID): This version is similar to Version 1 but includes additional security information. It is less commonly used and is mainly for specific applications within the Distributed Computing Environment (DCE).
  3. Version 3 (Name-Based UUID): These UUIDs are generated by hashing a namespace identifier and a name. They are deterministic, meaning the same input will always produce the same UUID.
  4. Version 4 (Randomly Generated UUID): These UUIDs are generated using random numbers. They are the most commonly used type of UUID and are ideal for scenarios where uniqueness is required but determinism is not necessary.
  5. Version 5 (Name-Based UUID): Similar to Version 3, but uses SHA-1 as the hashing algorithm instead of MD5. This version is preferred over Version 3 for new applications due to the security advantages of SHA-1 over MD5.

Generating UUIDs

The QuikConsole UUID Generator creates version 4 and version 7 UUIDs entirely in the browser. Version 4 uses 122 random bits, while version 7 combines a Unix millisecond timestamp with random data and produces time-ordered identifiers.

Set the count from 1 to 100, then choose whether the output should be uppercase or omit hyphens. Use Regenerate to create another batch, Copy to copy the current result, or Download to save it. The generator creates new identifiers only; it does not validate, parse, or decode existing UUIDs.

Validating UUIDs

A canonical UUID contains 32 hexadecimal digits arranged as 8-4-4-4-12. It must also use a defined version and the standard RFC variant. The QuikConsole UUID Generator produces new values but does not inspect values you paste.

To validate a UUID manually, apply this case-insensitive regular expression:

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

This checks versions 1 through 8 and the standard variant, but excludes the nil UUID and the all-f maximum UUID. It verifies structure only. A UUID is not a secret, and a successful match does not establish authenticity, provenance, or resistance to tampering.

Using UUIDs in Applications

Incorporating UUIDs into your applications can enhance the reliability and scalability of your systems. Here are some common use cases for UUIDs:

  • Database Keys: Using UUIDs as primary keys in databases can prevent collisions and simplify data migration across different systems.
  • Session IDs: Generating unique session IDs for users ensures that each session is distinct and can be tracked accurately.
  • Transaction Identifiers: In financial systems, UUIDs can be used to uniquely identify transactions, enhancing security and traceability.
  • Distributed Systems: In environments where multiple nodes need to communicate, UUIDs can help uniquely identify messages and events.

When using UUIDs in your applications, it’s important to consider the trade-offs between the different types of UUIDs. For instance, while Version 4 UUIDs offer simplicity and speed, they lack the temporal ordering of Version 1 UUIDs. Conversely, Version 1 UUIDs provide a time-based ordering but require access to a network interface and can potentially expose information about the system.

Best Practices for Working with UUIDs

Apply UUIDs according to how they are generated, stored, and exposed. No UUID is an authentication credential or a proof that its input was unaltered.

  1. Choose the Right Version: Use version 4 when random identifiers are sufficient. Prefer version 7 when you need identifiers that sort chronologically. Version 1 remains available, but version 6 provides reordered time fields for sortable output.
  2. Match Uniqueness Guarantees to the Method: Version 4 UUIDs have 122 random bits and provide probabilistic uniqueness, not an absolute guarantee. Versions 3 and 5 are deterministic: the same namespace and name produce the same UUID.
  3. Store UUIDs Efficiently: A UUID contains 128 bits, or 16 bytes in binary. Store it in a native 16-byte column when possible; the canonical 36-character text form requires more space.
  4. Generate Consistently: Use a standards-compliant library rather than constructing UUIDs manually. The QuikConsole UUID Generator produces version 4 and version 7 UUIDs, with options for uppercase output and removing hyphens.

Choosing and Using UUIDs

UUIDs provide a practical way to distribute identifiers without assigning sequential values. Version 4 suits general-purpose random identifiers, while version 7 supports time-ordered records. Versions 3 and 5 provide deterministic identifiers for names, and versions 1 and 6 preserve time-based generation in different layouts.

Treat UUIDs as identifiers, not secrets. Validate their structure when accepting them as input, store them in the format your database supports, and select the version that matches the ordering, determinism, and privacy requirements of the application.

Frequently asked questions

How do I validate a UUID format?

Use the case-insensitive regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$. It requires the standard layout, version, and variant. This strict pattern excludes the nil and max UUIDs.

When should I use UUID v4 instead of UUID v7?

Use UUID v4 when you need a random identifier and UUID v7 when you also want time ordering. V4 provides 122 random bits; v7 embeds Unix epoch milliseconds plus random data, making generated values sortable by creation time.

Is a UUID safe to use as a session token or secret?

A UUID is an identifier, not a secret. It cannot authenticate a request or prove that it was not tampered with, and a v4 UUID should not replace a securely generated session token checked against server-side session data.

Which UUID versions contain timestamps?

Only UUID versions 1, 6, and 7 carry timestamps. In version 7, the first 48 bits encode Unix epoch milliseconds; versions 1 and 6 use a count of 100-nanosecond intervals from the UUID epoch of 1582-10-15.

How can I generate random and time-ordered UUIDs?

QuikConsole's UUID Generator produces version 4 and version 7 UUIDs entirely in the browser. Set Count from 1 to 100, choose Uppercase or No hyphens if needed, then use Regenerate, Copy, or Download; it does not validate, parse, or decode UUIDs.

Contact: contact@quikconsolecom.net