FormatterHQ

UUID Generator (v4 and v7)

Generate UUID v4 and v7 values: one or up to 1,000 RFC 9562 UUIDs at once. Pick random version 4 or time-ordered version 7, format them the way your code expects and copy the list.

Loading tool…
Ready.

How to use the UUID Generator

  1. Choose how many UUIDs you need (1 to 1,000).
  2. Select the version: v4 for fully random IDs or v7 for IDs that sort by creation time; ULID and NanoID are also available.
  3. Set the output format: lowercase or uppercase, with or without hyphens, optionally wrapped in braces.
  4. Generate the list, then copy it or download it as a text file.

UUID generator for databases, APIs and tests

This UUID generator creates universally unique identifiers directly in your browser. A UUID (called a GUID in the Microsoft world) is a 128-bit number written as 32 hexadecimal digits in five hyphen-separated groups (8-4-4-4-12). Because the values are so large and random, independent systems can create IDs without talking to each other and still avoid collisions.

Every value is built from the Web Crypto API (crypto.getRandomValues), the same cryptographically secure source browsers use for key generation. Nothing is sent to a server, so you can safely generate IDs for private projects.

Anatomy of a UUID

f47ac10b-58cc-4372-a567-0e02b2c3d479
              ^    ^
              |    variant (8, 9, a or b = RFC 9562)
              version (4 = random, 7 = time-ordered)

The first digit of the third group is the version, and the first digit of the fourth group encodes the variant. Everything else is data: random bits for v4, a timestamp plus random bits for v7. You can use these two positions to check which kind of UUID a system produced.

UUID v4 vs UUID v7

Version 4Version 7
Content122 random bits48-bit Unix timestamp in milliseconds + 74 random bits
Sort orderRandomRoughly by creation time
Reveals creation time?NoYes, to the millisecond
Best forTokens, public IDs, general useDatabase primary keys, event logs

Version 4 is the default almost everywhere and is the safest choice when you do not want an ID to leak information. Version 7, standardized in RFC 9562 (2024), puts the timestamp first. New rows then land at the end of a B-tree index instead of at random positions, which reduces page splits and keeps inserts fast in PostgreSQL, MySQL and similar databases.

How unique is "unique"?

With 122 random bits, you would need to generate roughly 2.7 quintillion (2.7 × 1018) version 4 UUIDs before the chance of a single duplicate reaches 50%. For practical purposes a well-generated v4 UUID will not collide. The real risk comes from weak random sources, which is why this tool never uses Math.random().

Formatting options explained

  • Case – RFC 9562 recommends lowercase output, but parsers must accept both. Some Windows tools and older .NET code print uppercase.
  • Hyphens – remove them to get a compact 32-character string, handy for file names or when storing UUIDs in a CHAR(32) column.
  • Braces – wrap each value as {…}, the registry format used for Windows COM class IDs and in many .NET config files.

Common uses

  • Seeding test databases and fixtures with realistic primary keys.
  • Idempotency keys for payment or messaging APIs, so a retried request is not processed twice.
  • Correlation IDs that follow a request through logs of several services.
  • Names for uploaded files that must never overwrite each other.

Need other kinds of test values? The random string generator creates tokens from any character set, and the random JSON generator builds full fake records that can include a UUID field.

Things a UUID is not

A UUID is an identifier, not a secret. Do not use v7 values as password-reset tokens, because part of the value is a predictable timestamp. For secrets, generate raw random bytes with the random byte generator instead.

Generate a UUID in Python

The uuid module is part of the standard library, and uuid.uuid4() returns a random version 4 UUID, the same kind this page generates by default. What trips people up is that the result is a UUID object, not a string: json.dumps() rejects it with a TypeError, and comparing it with a string is False even when the text matches, so call str() first. uuid.UUID() goes the other way and accepts uppercase, braces and missing hyphens. Python 3.12 has no uuid.uuid7(); for time-ordered version 7 values, switch the ID type above to UUID v7.

import json
import uuid

u = uuid.uuid4()             # random, version 4
print(u)                     # e.g. 0b0a3f7e-5d0c-4c56-9d3b-6f1f6f3f2a10
print(u.version)             # 4
print(str(u).upper())        # uppercase with hyphens
print(u.hex)                 # 32 hex digits, no hyphens
print("{" + str(u) + "}")    # wrapped in braces

# A UUID object is not a string: convert it before JSON or string comparison
print(json.dumps({"id": str(u)}))

# Five at once
print([str(uuid.uuid4()) for _ in range(5)])

# Parse and validate text in any of the common spellings
print(uuid.UUID("{0B0A3F7E-5D0C-4C56-9D3B-6F1F6F3F2A10}"))

When you only need a few IDs for a fixture or a database row, generating them on this page is quicker than opening a REPL.

Frequently asked questions

What is the difference between a UUID and a GUID?
They are the same thing. GUID (globally unique identifier) is the name Microsoft uses; the format and the version rules are identical. Windows tools often display GUIDs in uppercase and wrapped in braces, which you can reproduce with the formatting options.
Should I use UUID v4 or v7 as a database primary key?
Version 7 is usually better for primary keys because new values sort after older ones, which keeps B-tree indexes compact and inserts fast. Use v4 when the ID is exposed publicly and you do not want it to reveal when the record was created.
Can two generated UUIDs ever be the same?
In theory yes, in practice no. A version 4 UUID has 122 random bits, so duplicates are astronomically unlikely when the random source is cryptographically secure, as it is here.
Are the UUIDs sent to your server or stored?
No. They are generated by JavaScript running in your browser using the Web Crypto API. Nothing leaves your device unless you copy or download it yourself.
How do I tell which version a UUID is?
Look at the first character of the third group. For example, in 018f3c2a-7b1e-7c3d-9a2b-1f0e4d5c6b7a it is 7, so the value is a version 7 UUID.

Last updated October 3, 2026

Guides

Related tools

UUID Validator & Decoder Validate UUIDs/GUIDs and decode version, variant and embedded timestamps for v1, v6 and v7 — many at once. Lorem Ipsum Generator Generate lorem ipsum placeholder text by paragraphs, sentences or words, optionally wrapped in HTML <p> tags. Memorable Password Generator Generate easy-to-remember passphrases from random English words, with separators, numbers and symbols. Nano ID Generator Generate secure, URL-friendly Nano IDs with custom length and alphabet, plus a collision-probability estimate. MongoDB ObjectId Generator Generate valid 12-byte MongoDB ObjectIds for the current time or any date, as hex, ObjectId() or Extended JSON. Password Generator Generate strong random passwords with custom length and character sets, using a cryptographically secure source. Random Alphanumeric Generator Generate letters-and-digits codes for vouchers, reference IDs and usernames in mixed, upper or lower case. Random Binary Generator Generate random binary numbers (strings of 0s and 1s) of any bit length. Random Byte Generator Generate cryptographically secure random bytes as hex, Base64, decimal, binary or a code array. Random Color Generator Generate random colours as HEX, RGB or HSL codes with a swatch preview for inspiration and testing. Random CSV Generator Generate realistic fake CSV test data — names, emails, addresses, dates and more — with custom fields. Random Data from Regex Generate random strings that match a regular expression — ideal for test data such as IDs, codes and formats.