UUID Generator

Generate cryptographically random version 4 or time-ordered version 7 UUIDs, one at a time or in bulk.

Runs 100% in your browser. Nothing you paste is uploaded or stored.

How to use the UUID generator

  1. Choose the version: v4 (random) or v7 (time-ordered).
  2. Set how many UUIDs you need, from one to a bulk list.
  3. Optionally switch to uppercase or remove the hyphens.
  4. Copy a single value or the whole list.

UUIDs are generated in your browser using its cryptographically secure random number generator. They are never sent to or stored on our servers, so nobody else knows which identifiers you created.

What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit value that can be generated independently on any machine with a negligible chance of clashing with any other. No central registry or database round trip is needed, which makes UUIDs ideal for distributed systems, offline clients and merging data from several sources. They are also a common choice for request IDs and for the jti claim inside tokens you can inspect with the JWT decoder. GUID (Globally Unique Identifier) is Microsoft's name for the same thing.

UUIDs are written as 32 hexadecimal digits in five groups separated by hyphens, in the pattern 8-4-4-4-12 (36 characters in total):

f47ac10b-58cc-4372-a567-0e02b2c3d479
              ^    ^
              |    variant (8, 9, a or b)
              version (4)

The first digit of the third group is the version; the first digit of the fourth group encodes the variant. The current specification is RFC 9562 (2024), which replaced RFC 4122 and added versions 6, 7 and 8.

Version 4 vs version 7

UUID v4UUID v7
Content122 random bits (6 bits fixed for version and variant)48-bit Unix timestamp in milliseconds, then random bits
Sort orderRandomRoughly chronological
RevealsNothingIts creation time
Best forTokens, public IDs, general useDatabase primary keys, event logs

Why v7 is better for database indexes

Primary keys are usually stored in a B-tree index. Random v4 values land at random positions, so every insert touches a different page, which causes page splits, poor cache locality and index bloat on large tables. Because v7 UUIDs begin with a timestamp, new values are appended near the end of the index, much like an auto-increment integer, while keeping the benefits of globally unique, client-generated IDs.

Common pitfalls

  • Storing UUIDs as text. A 36-character string takes more than twice the space of the 16 raw bytes. Use a native uuid type (PostgreSQL) or BINARY(16) (MySQL).
  • Using UUIDs as secrets. v4 values are hard to guess, but they are identifiers, not credentials. v7 values expose their creation time and are partly predictable. Use a dedicated random token for password resets and API keys.
  • Case-sensitive comparisons. RFC 9562 specifies lowercase output but requires that input be accepted in either case. Normalise before comparing strings.
  • Weak random sources. Generating v4 UUIDs with Math.random() undermines their uniqueness. Use a cryptographically secure generator.

Generating UUIDs in code

// JavaScript (browsers and Node.js)
crypto.randomUUID();                 // v4

# Python
import uuid
uuid.uuid4()
uuid.uuid7()                         # Python 3.14+

-- PostgreSQL
SELECT gen_random_uuid();            -- v4 (PostgreSQL 13+)
SELECT uuidv7();                     -- PostgreSQL 18+

// Java
java.util.UUID.randomUUID();

// C# / .NET
Guid.NewGuid();                      // v4
Guid.CreateVersion7();               // .NET 9+

# Shell (Linux, macOS)
uuidgen
Tip: Need a timestamp from a v7 UUID? The first 12 hex digits (without hyphens) are the Unix time in milliseconds. Convert them from hex to decimal and paste the result into the Unix timestamp converter.

Frequently asked questions

Can two UUIDs ever be the same?

In theory, yes; in practice, no. With 122 random bits, the number of possible v4 values is so large that you would need to generate billions of UUIDs every second for many decades before a single duplicate became likely. Collisions in real systems almost always come from a broken random number generator or copied data, not from chance.

What is the difference between a UUID and a GUID?

None in practice. GUID is the term used in Microsoft technologies; the format and size are the same.

Should I use v4 or v7?

Use v7 for database primary keys and anything you want sorted by creation time. Use v4 when the ID should reveal nothing, such as identifiers exposed in public URLs.

Is the nil UUID valid?

Yes. 00000000-0000-0000-0000-000000000000 is the special nil UUID, and RFC 9562 also defines a max UUID of all f digits. Both are often used as placeholders.

Copied to clipboard