Skip to content

UUID generator: random v4 and time-ordered v7 UUIDs in bulk

A UUID (universally unique identifier) is a 128-bit value written as 32 hexadecimal digits in five groups, such as 3f2504e0-4f89-41d3-9a0c-0305e82c3301. Version 4 UUIDs are generated from random numbers; with 122 random bits the chance of two ever colliding is negligible. Version 7 UUIDs put a millisecond timestamp in the first 48 bits so they sort by creation time, which suits database keys. This generator produces v4 and v7 UUIDs using your browser’s cryptographic random source, in bulk, with uppercase, braces and no-hyphen options.

C9UUID generator — ToolsBoxx
Ready0 B sent to server

Your files never leave your device. Processing happens in your browser.How that works.

How it works

  1. Choose version 4 or 7 and how many you need.
  2. Click Generate.
  3. Copy the list or download it as a text file.

Runs as JavaScript inside this tab. Turn off your connection after the page loads and it still works.

UUID reference

Layout

A UUID is 128 bits shown as 32 hexadecimal digits in groups of 8-4-4-4-12:

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
  • M (first digit of the third group) is the version.
  • N (first digit of the fourth group) encodes the variant: 8, 9, a or b for RFC 4122 / RFC 9562 UUIDs.

Versions

Version Name Contents Use
1 Time-based 60-bit timestamp (100 ns since 1582), clock sequence, 48-bit node (MAC) Legacy; leaks hardware identity, does not sort
2 DCE Security v1 with POSIX UID/GID Rare
3 Name-based, MD5 Hash of namespace + name Deterministic ids from names; superseded by v5
4 Random 122 random bits General purpose default
5 Name-based, SHA-1 Hash of namespace + name Deterministic ids from names
6 Reordered time v1 fields reordered to sort Migrating v1 systems
7 Unix time + random 48-bit ms timestamp, 74 random bits Database primary keys
8 Custom Vendor-defined Experimental

Special values: the Nil UUID 00000000-0000-0000-0000-000000000000 and the Max UUID ffffffff-ffff-ffff-ffff-ffffffffffff.

v4 versus v7 for database keys

Random v4 keys insert at random positions in a B-tree index, which fragments the index and evicts useful pages from cache. v7 keys are monotonically increasing by millisecond, so inserts append at the end like an auto-increment key, while still being globally unique and unguessable enough for most purposes (74 random bits per millisecond). PostgreSQL 18 ships uuidv7() natively; MySQL, SQL Server and SQLite store either as 16 bytes or 36 characters.

Trade-off: v7 reveals creation time. If that is sensitive, use v4.

Collision probability

For random v4 UUIDs the birthday bound gives a 50% chance of one collision after about 2.7 × 10¹⁸ UUIDs. Generating one billion per second, that takes roughly 86 years. In practice, collisions come from bad random sources, not from the format.

Formats you will meet

Form Example
Canonical 3f2504e0-4f89-41d3-9a0c-0305e82c3301
Uppercase 3F2504E0-4F89-41D3-9A0C-0305E82C3301
Braces (Microsoft GUID) {3f2504e0-4f89-41d3-9a0c-0305e82c3301}
No hyphens (32 hex) 3f2504e04f8941d39a0c0305e82c3301
URN urn:uuid:3f2504e0-4f89-41d3-9a0c-0305e82c3301
Binary 16 bytes, e.g. BINARY(16) or uuid column types

Generating in code

Language v4 v7
JavaScript crypto.randomUUID() uuid package v7()
Python uuid.uuid4() uuid.uuid7() (3.14+) or uuid6 package
Go uuid.New() (google/uuid) uuid.NewV7()
Java UUID.randomUUID() UuidCreator.getTimeOrderedEpoch()
C# Guid.NewGuid() Guid.CreateVersion7() (.NET 9)
PostgreSQL gen_random_uuid() uuidv7() (18+)
Bash uuidgen —

Worked examples

Five v4 UUIDs, one per line (yours will differ; they are random):

9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d
1c3e5a7f-2d4b-4e6f-8a9c-0b1d2e3f4a5b
…

Every one has 4 as the first digit of the third group and 8, 9, a or b starting the fourth.

Three v7 UUIDs generated in the same millisecond share their first 12 hex digits (the timestamp) and differ only in the random tail, so they sort together and in order:

0199371c-6d00-7a1b-8f3e-4c2d1b0a9f8e
0199371c-6d00-7c42-9a17-0d6e5f4a3b2c
0199371c-6d00-7e93-b5d2-8e7f6a5b4c3d

Validate {3F2504E0-4F89-41D3-9A0C-0305E82C3301} → valid, version 4, RFC 4122 variant. Braces and uppercase are accepted and the canonical lowercase form is shown.

Validate 0199371c-6d00-7a1b-8f3e-4c2d1b0a9f8e → version 7, with the embedded timestamp decoded to an ISO date.

JSON array output for seeding fixtures:

[
  "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  "1c3e5a7f-2d4b-4e6f-8a9c-0b1d2e3f4a5b"
]

Frequently asked questions

What is the difference between UUID and GUID?

None in practice. GUID is Microsoft’s name for the same 128-bit format.

Are v4 UUIDs really unique?

They are random, not registered, but with 2^122 possibilities you would need to generate about a billion UUIDs per second for 85 years to reach a 50% chance of one collision.

When should I use v7 instead of v4?

When UUIDs are primary keys in a database. v7 values sort by time, which keeps B-tree indexes compact and makes recent rows adjacent.

What do the version and variant digits mean?

The first digit of the third group is the version (4 or 7). The first digit of the fourth group is 8, 9, a or b, marking the RFC 4122 variant.

UUID generator · last updated · changelog · part of Canned Tuna