UUID Generator (v4 and v7)

Generate random UUID v4 or time-ordered UUID v7 values in bulk, and inspect any UUID.

UUID Generator: Random v4 and Time-Ordered v7 UUIDs, GUID Format

Choose a version and how many UUIDs you need, up to 50, and this UUID generator creates them with your browser's cryptographically secure random number generator. Click any UUID to copy it, or Copy all for a newline-separated list. The Format menu switches between the standard lowercase form, UPPERCASE, a `{GUID}` in braces as used in Windows and .NET, and a compact form without hyphens. Paste an existing UUID into the inspector to see its version and, for v7, the time it was created.

What a UUID is

A UUID (universally unique identifier) is a 128-bit value written as 32 hexadecimal digits in five groups: 8-4-4-4-12. The first digit of the third group is the version, and the first digit of the fourth group encodes the variant, which is 8, 9, a or b for standard UUIDs. The format is defined in RFC 9562, published in May 2024, which replaced RFC 4122 and added versions 6, 7 and 8.

f47ac10b-58cc-4372-a567-0e02b2c3d479
              ^    ^
              |    variant: 8, 9, a or b
              version: 4 = random

GUID, globally unique identifier, is Microsoft's name for the same thing. A GUID from Guid.NewGuid() in .NET or NEWID() in SQL Server is a version 4 UUID; the only differences are conventions such as uppercase letters and curly braces, which the Format menu reproduces.

UUID v4 or v7?

Version 4 is 122 random bits plus the version and variant markers. It reveals nothing about when or where it was created and is the right default for identifiers exposed to users, public record IDs and anything where order does not matter.

Version 7 starts with a 48-bit Unix timestamp in milliseconds, followed by random bits. UUIDs generated later sort after earlier ones, so new rows are appended at the end of a B-tree index instead of being scattered across it. That makes v7 the better choice for database primary keys: inserts touch fewer index pages, and ordering by ID roughly equals ordering by creation time. The trade-off is that anyone who sees a v7 UUID can read its creation time.

01926b8a-7c4e-7d3a-9f21-3b8e5c0a4d17
└──────────┘
48-bit timestamp 0x01926b8a7c4e = 2024-10-08T09:51:30.894Z

Paste a v7 UUID into the inspector to decode its timestamp. Versions 1 and 6 also contain time, but they embed a node identifier, historically the MAC address, and are rarely a good choice for new systems.

One limitation to know about: this generator's v7 does not add a counter inside a millisecond. A batch of 50 created with one click usually shares the same timestamp, so those 50 are not sorted among themselves. Library implementations such as Python 3.14's uuid.uuid7() add a counter for exactly this case; when rows are inserted one at a time, the difference rarely shows.

Can two UUIDs collide?

In practice, no. A v4 UUID has 122 random bits, about 5.3 × 10^36 possible values. By the birthday bound, you would need to generate roughly 2.7 × 10^18 UUIDs, 2.7 quintillion, before the chance of a single duplicate reached 50 percent. Generating a billion per second, that takes about 86 years.

Real duplicates come from bad randomness, not from the format: a random generator seeded identically in cloned virtual machines, or code that uses Math.random() instead of a cryptographic source. The generator uses crypto.randomUUID() for v4 and crypto.getRandomValues() for v7, both backed by the operating system's secure random source. Still, keep a unique constraint on UUID columns; it costs little and turns a bug into an error instead of silent data corruption.

Generating UUIDs in code

Every mainstream language can generate UUIDs without a third-party dependency:

crypto.randomUUID()                         // JavaScript: browsers and Node.js 14.17+
import uuid; uuid.uuid4(); uuid.uuid7()     # Python (uuid7 since Python 3.14)
Guid.NewGuid(); Guid.CreateVersion7()       // C# (.NET 9+ for v7)
UUID.randomUUID()                           // Java, version 4
Str::uuid(); Str::uuid7()                   // Laravel
SELECT gen_random_uuid();                   -- PostgreSQL 13+, v4
SELECT uuidv7();                            -- PostgreSQL 18+
SELECT NEWID();                             -- SQL Server
uuidgen                                     # macOS and Linux shell

Store UUIDs in a native type where one exists, such as PostgreSQL uuid or SQL Server uniqueidentifier, or as BINARY(16) in MySQL, rather than as 36-character strings. The binary form takes 16 bytes instead of 36 and compares faster.

Formats and validation

The canonical form is lowercase with hyphens, and RFC 9562 says UUIDs should be output in lowercase and accepted in either case. Microsoft tools often show uppercase in braces; some systems store the 32 digits without hyphens. They all represent the same 128 bits, and the inspector accepts each of these forms.

To validate a UUID string, check the shape and, if needed, the version digit:

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

The nil UUID, all zeros, and the max UUID, all f, are special values defined by the RFC and fail this pattern on purpose.

The inspector applies the same check, so it rejects the nil and max UUIDs too. For a valid value it reports the version, the variant and, for v7, the embedded creation time as an ISO 8601 date in UTC.

Private and offline

UUIDs are generated in your browser and never sent to or logged by a server, so the values are known only to you. Once the page has loaded, the generator also works without a network connection.

Frequently asked questions

How do I generate a UUID?

Choose v4 or v7, set how many you need (up to 50) and click Generate. Click a UUID to copy it, or use Copy all for the whole list.

What is the difference between UUID and GUID?

None in substance. GUID is Microsoft's name for a UUID. .NET and SQL Server generate version 4 UUIDs and usually display them in uppercase, sometimes in curly braces.

Should I use UUID v4 or v7?

Use v7 for database primary keys, because its time-ordered values keep indexes compact. Use v4 when an identifier should not reveal when it was created.

Are UUIDs really unique?

Collisions are practically impossible with a good random source: you would need about 2.7 quintillion v4 UUIDs for a 50 percent chance of one duplicate. Duplicates in practice come from broken random number generators.

Can I get the creation time from a UUID?

Only for time-based versions. Paste a v7 UUID into the inspector to see its timestamp; a v4 UUID contains no time information.

Is a UUID secure enough to use as a token?

A v4 UUID from a cryptographic generator has 122 random bits, which is hard to guess, but it is an identifier, not a secret. For session tokens and password resets, use a dedicated random token and store only its hash.