UUID Generator & Validator

Generates cryptographically random UUIDs using the Web Crypto API, choosing between version 4 (fully random) and version 7 (time-ordered), with options for count, case, and hyphenation. Also validates a pasted UUID and reports its version and variant bits. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-25

Overview

Introduction

A UUID (Universally Unique Identifier) is a 128-bit value used to identify records, sessions, or resources without a central authority coordinating who hands out which number.

This tool generates version 4 (random) and version 7 (time-ordered) UUIDs entirely in your browser, and can also validate and decode an existing UUID's version and variant bits.

What Is UUID Generator & Validator?

A generator and validator for RFC 9562 UUIDs, the standard that also defines older formats like v1 and v3/v5 as well as the newer v6, v7, and v8.

Generation supports the two most commonly requested formats today: v4 for maximum randomness and v7 for values that sort chronologically, which many databases prefer for primary keys.

How UUID Generator & Validator Works

For v4, the tool fills 16 bytes with crypto.getRandomValues(), then overwrites the 4 version bits and 2 variant bits per the spec, leaving 122 bits fully random.

For v7, the first 48 bits are set to the current Unix timestamp in milliseconds, the version and variant bits are set, and the remaining 74 bits are filled with cryptographically random data.

Validation parses the input against the canonical 8-4-4-4-12 hex-digit grouping, then reads the version nibble and variant bits directly out of the hex string to report what kind of UUID it is.

When To Use UUID Generator & Validator

Use v4 when you need a globally unique identifier with no information leakage about when it was created — session tokens, request IDs, anonymous resource names.

Use v7 when the ID becomes a database primary key or is used in a system where insertion order matters, since its timestamp prefix keeps related rows physically close together in sorted indexes.

Features

Advantages

  • Uses a cryptographically secure random source for every generated ID, not a predictable pseudo-random generator.
  • Supports batch generation up to 1,000 IDs at once for seeding test data or fixtures.
  • Validates arbitrary UUIDs and explains exactly which version and variant they are, useful for debugging IDs from unfamiliar systems.

Limitations

  • v7's timestamp component reveals the approximate creation time of the ID, which v4 does not — avoid v7 if that leaks information you don't want to expose.
  • The validator only accepts the canonical hyphenated textual form; it does not accept base64-encoded or binary UUID representations.

Examples

A v4 UUID

Input

(no input; generated from settings)

Output

9d5e2f7a-6b1c-4e3d-8a9f-0c2b4d6e8f10

36 characters, version nibble '4', variant bits '10xx'.

A v7 UUID

Input

(no input; generated from settings)

Output

018f2c3a-9b40-7e21-8c5d-1a2b3c4d5e6f

First 12 hex digits encode the millisecond timestamp; version nibble is '7'.

Best Practices & Notes

Best Practices

  • Use v7 for new database primary keys where index locality matters.
  • Generate in batches when seeding test fixtures rather than calling the tool repeatedly for one ID at a time.
  • Run a pasted UUID through the validator before assuming it's well-formed, especially if it came from user input or an unfamiliar external system.

Developer Notes

Version and variant bits are set by directly masking bytes 6 and 8 of the 16-byte buffer per RFC 9562 §4-5, rather than relying on the browser's built-in crypto.randomUUID(), so the same code path can also produce v7 IDs, which no browser API generates natively yet.

UUID Generator & Validator Use Cases

  • Generating primary keys for a new database table
  • Creating unique session or request IDs for logging and tracing
  • Decoding an unfamiliar UUID pasted from a bug report to see its version

Common Mistakes

  • Assuming all UUIDs are random — v1, v6, and v7 all embed a timestamp and can leak creation-time information.
  • Storing UUIDs as generic 36-character strings when the database has a native UUID/binary(16) type, which is far more storage- and index-efficient.

Tips

  • Disable hyphens when the target system expects a compact 32-character hex ID.
  • Uppercase output matches the format some legacy Windows GUID-based systems expect.

References

Frequently Asked Questions