Skip to content
HNarzędzia
en
Categories

UUID generator - random v4 and time-ordered v7, plus validator

Create UUIDs with a cryptographic random generator, copy them or download a .txt file, and paste any UUID or GUID into the validator to see its version, variant and creation time.

  • Free
  • No sign-up
  • Private
  • Runs locally

Generator

122 random bits - the most common, general-purpose choice.

UUID validator

How to generate UUIDs

  1. 1.

    Pick a version

    v4 is fully random and the most widely used. v7 starts with a timestamp, so the IDs sort chronologically.

  2. 2.

    Set the count and format

    Generate 1 to 1000 UUIDs, optionally uppercase, without hyphens or wrapped in braces like a Windows GUID.

  3. 3.

    Copy or download

    Copy a single UUID, copy all of them, or download a .txt file with one UUID per line.

  4. 4.

    Validate a UUID

    Paste any UUID into the validator to check its format and see the version, variant and, for v1, v6 and v7, the timestamp.

What a UUID is

A UUID (Universally Unique Identifier, called a GUID in the Microsoft world) is a 128-bit number written as 32 hexadecimal digits in groups of 8-4-4-4-12, e.g. 017f22e2-79b0-7cc3-98c4-dc0c0c07398f. The format is defined by RFC 9562 (May 2024), which replaced RFC 4122.

  • The 13th character is the version (here 7).
  • The 17th character is the variant - for standard UUIDs it is always 8, 9, a or b (bits 10).

The special Nil UUID (all zeros) and Max UUID (all F) are recognised by the validator too.

UUID v4 or v7?

UUID v4UUID v7
Contents122 random bits48-bit Unix time (ms) + 74 random bits
Sort orderrandomchronological
Database index (B-tree)fragmentation, slower insertsappends at the end - fast
Reveals creation timenoyes (to the millisecond)
Best fortokens, public identifiersprimary keys, logs, events

In this generator, UUID v7 values keep their order even when many are created within the same millisecond: the 12-bit rand_a field works as a counter (method 1 from RFC 9562, section 6.2).

Can a UUID ever repeat?

In theory yes, in practice no. UUID v4 has 2122 ≈ 5.3 × 1036 possible values. For a 50% chance of even one collision you would need about 2.7 × 1018 identifiers - generating a billion UUIDs per second, that would take around 85 years. The condition is a good source of randomness: this tool uses crypto.randomUUID() and crypto.getRandomValues(), never Math.random().

UUIDs in databases and code

  • PostgreSQL - the uuid type takes 16 bytes; gen_random_uuid() generates v4 without extensions since version 13, and uuidv7() is built in since version 18.
  • MySQL / MariaDB - store UUIDs as BINARY(16) instead of CHAR(36) to save 20 bytes per row and in every index.
  • JavaScript - crypto.randomUUID() returns v4; v7 needs a library or a small custom function.
  • Python - uuid.uuid4(); uuid.uuid7() is available since Python 3.14.
  • SQL Server - uniqueidentifier sorts bytes in an unusual order, so the benefit of v7 there is smaller.

The hyphenated form is 36 characters long, without hyphens 32. The braces option gives the format used in the Windows registry and Visual Studio project files.

Frequently asked questions

What is the difference between a UUID and a GUID?

+
They are the same 128-bit structure. GUID is Microsoft’s name (Windows, .NET, SQL Server), often written in uppercase inside braces, e.g. {017F22E2-79B0-7CC3-98C4-DC0C0C07398F}.

Is a UUID v4 safe to use as a secret token?

+
A v4 UUID from a cryptographic generator has 122 bits of entropy, which makes it hard to guess. For session or password-reset tokens, a dedicated longer token (for example 256 bits) is still the better choice.

How do I read the date from a UUID v7?

+
The first 12 hex digits are the Unix time in milliseconds. Paste the UUID into the validator below the generator to see the creation date and time. It works for v1 and v6 as well.

How should I store UUIDs in a database?

+
Use the native type where available (uuid in PostgreSQL, uniqueidentifier in SQL Server) or BINARY(16) in MySQL - 16 bytes instead of 36 characters of text.

Should I use UUID v7 for primary keys?

+
Usually yes. v7 values arrive in increasing order, so B-tree indexes stay compact and inserts are fast. Keep v4 when the ID is public and must not reveal when the record was created.

Are the UUIDs sent anywhere?

+
No. Identifiers are generated locally in your browser and are never sent to a server.

Updated: