UUID Generator

Generate random v4 or time-ordered v7 UUIDs — in bulk, in any format

What Is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit value used to label a record, a file, a message, or anything else that needs an ID nobody else will pick. Microsoft calls the same thing a GUID (Globally Unique Identifier). The usual text form is 32 hexadecimal digits in five groups, 8-4-4-4-12, for a total of 36 characters:

f47ac10b-58cc-4372-a567-0e02b2c3d479

The point of a UUID is that any machine can create one on its own, offline, without asking a database or a central server for the next number, and still be confident nobody else will create the same value. The format was first standardized in RFC 4122 (2005). RFC 9562, published in May 2024, replaced it and added three new versions: v6, v7, and v8.

This generator creates version 4 (random) and version 7 (time-ordered) UUIDs, the two versions new code should normally use.

How to Use the UUID Generator

  1. Pick a version. v4 gives fully random UUIDs. v7 gives UUIDs that sort by the time they were created.
  2. Choose how many you need, from 1 to 100. Each UUID goes on its own line.
  3. Pick a format. The standard form uses hyphens (8-4-4-4-12). No hyphens gives a 32-character string, and {Braces} gives the registry-style GUID used in Windows and .NET. Tick Uppercase if your system expects capital letters.
  4. Press Generate or Ctrl+Enter for a fresh batch. Changing the version or count also generates a new batch. Changing the format or case restyles the UUIDs you already have, so you can copy the same values in another shape.
  5. Copy with the Copy button or Ctrl+Shift+C.

Anatomy of a UUID

Every standard UUID reserves a few bits to say what kind of UUID it is. Here is a v7 UUID created on October 8, 2026 at 09:30:00 UTC:

01a11ad9-21c0-703d-b5fe-5a02079de337
Hex digitsVersion 4Version 7
1–12RandomUnix time in milliseconds (01a11ad921c0 = 1791451800000)
134, the version7, the version
14–16RandomRandom (this tool uses them as a counter so same-millisecond IDs stay in order)
178, 9, a or b, the variantSame
18–32RandomRandom

So you can always tell a UUID’s version from its 13th digit. To read the creation time out of a v7 UUID, take its first 12 hex digits, convert them to decimal with the Number Base Converter, and paste the result into the Unix Timestamp Converter.

UUID Versions Explained

VersionHow it’s builtTypical use
v160-bit timestamp (100 ns ticks since 1582) + node ID, usually the MAC addressLegacy systems. It leaks the machine’s MAC address and creation time
v2v1 variant for DCE SecurityAlmost never used
v3MD5 hash of a namespace UUID + a nameDeterministic IDs (prefer v5)
v4122 random bitsThe default almost everywhere
v5SHA-1 hash of a namespace UUID + a nameDeterministic IDs, for example from a URL or domain name
v6v1 with the timestamp fields reordered so it sorts by timeMigrating v1 systems
v748-bit Unix millisecond timestamp + random bitsNew database keys and event IDs
v8Layout defined by the vendorCustom or experimental schemes
Nil / MaxAll zeros / all fPlaceholder values that mean “no UUID” or “the largest UUID”

Versions 3 and 5 are different from the others: they’re deterministic. The same namespace and name always give the same UUID, so two services can derive the same ID for https://example.com without talking to each other. In Python that’s uuid.uuid5(uuid.NAMESPACE_URL, "https://example.com"). Their hashes, MD5 and SHA-1, are broken for security purposes (see the Hash Generator for how they compare), but that doesn’t matter for building IDs.

UUID v4 vs v7: Which Should You Use?

UUID v4UUID v7
Random bits12274 (some may be used as a counter)
Sort orderRandomBy creation time, to the millisecond
What it revealsNothingWhen it was created
B-tree index insertsScattered across the indexAppended near the end
Built-in supportNearly every language and databaseGrowing: Python 3.14, .NET 9, PostgreSQL 18

Use v7 for new primary keys, event and message IDs, and anything you’ll often sort or query by time. You get the uniqueness of a UUID with the insert pattern of an auto-increment key.

Use v4 when the ID is public and the creation time is sensitive. For example, a v7 user ID tells anyone who sees it exactly when the account was created. Also use v4 when you need maximum compatibility with older libraries.

Remember that v7 order is only as good as the clocks producing it. UUIDs from one generator come out strictly increasing, and this tool keeps them sorted even within a single millisecond. UUIDs from different machines interleave according to each machine’s clock.

UUIDs as Database Primary Keys

The main problem with random v4 keys is the index. A B-tree keeps keys sorted, so each new random key lands on a random page. Once the table is bigger than memory, inserts keep pulling old pages back into cache and splitting them. A v7 key behaves like an auto-increment column: new rows go at the right-hand edge of the index, and the recently used pages stay in memory.

Storage matters too:

  • PostgreSQL has a native 16-byte uuid type. gen_random_uuid() creates a v4 (built in since PostgreSQL 13), and PostgreSQL 18 adds uuidv7().
  • MySQL has no UUID column type. Store BINARY(16) and convert with UUID_TO_BIN() and BIN_TO_UUID(). MySQL’s own UUID() function returns a v1 UUID, and UUID_TO_BIN(uuid, 1) reorders its time fields so the values index in time order.
  • SQL Server has uniqueidentifier (16 bytes) and NEWID() for random values. It compares GUIDs starting with the last six bytes, so a v7 GUID doesn’t sort by time there. For sequential keys generated by the server, use NEWSEQUENTIALID().
  • A CHAR(36) or VARCHAR(36) column takes at least 36 bytes instead of 16, makes every index on it wider, and compares more slowly. Avoid it unless you have no choice.

Generate a UUID in Code

LanguageVersion 4Version 7
JavaScript (browser, Node.js)crypto.randomUUID()v7() from the uuid npm package
Pythonuuid.uuid4()uuid.uuid7() (Python 3.14+)
JavaUUID.randomUUID()No built-in, use a library
Gouuid.New() (github.com/google/uuid)uuid.NewV7()
C# / .NETGuid.NewGuid()Guid.CreateVersion7() (.NET 9+)
RustUuid::new_v4() (uuid crate)Uuid::now_v7()
PostgreSQLgen_random_uuid()uuidv7() (PostgreSQL 18+)
ShelluuidgenDepends on the platform

Common UUID Mistakes

  • Building UUIDs with Math.random(). A popular old snippet fills the template xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx with Math.random(). That isn’t a cryptographic random source, and some engines have produced real duplicates with it. Use crypto.randomUUID().
  • crypto.randomUUID is not a function. The browser only exposes it in a secure context: HTTPS or localhost. On a plain-HTTP page, build the UUID from crypto.getRandomValues(), which is what this tool falls back to.
  • Case-sensitive comparisons. RFC 9562 says to output lowercase and accept either case. F47AC10B-… and f47ac10b-… are the same UUID, so normalize case before comparing strings or using them as map keys.
  • Mixed-up byte order. .NET’s Guid.ToByteArray() writes the first three groups little-endian. If one system writes those bytes and another reads them in RFC order, the UUID silently changes. Pass bigEndian: true where your .NET version supports it, or exchange UUIDs as strings.
  • Using UUIDs as secrets. RFC 9562 says implementations should not assume UUIDs are hard to guess, and v1, v6, and v7 are partly predictable by design. For API keys, session tokens, and reset links, generate a dedicated random token, for example with the Password Generator.
  • Leaking creation times. A v7 UUID in a public URL shows when the record was created. Sometimes that’s harmless, but for user accounts it can leak more than you meant to.

UUID vs ULID vs Auto-Increment IDs

Auto-incrementUUID v4UUID v7ULID
Size4–8 bytes16 bytes16 bytes16 bytes
Text form4236 chars, hex36 chars, hex26 chars, Crockford Base32
GeneratedBy the databaseAnywhereAnywhereAnywhere
SortableYesNoYesYes
GuessableYes, sequentialNoPartly (timestamp)Partly (timestamp)
Standard—RFC 9562RFC 9562Community spec

ULID solved the sortable-random-ID problem before UUID v7 existed: a 48-bit millisecond timestamp followed by 80 random bits, written in a compact, URL-friendly alphabet. Now that v7 is standardized and lands in databases’ native uuid columns, it’s usually the simpler choice for new projects. Auto-increment integers remain the smallest and fastest option when a single database hands out every ID and exposing the count doesn’t matter. Where IDs end up in tokens, the jti claim of a JWT is a common place for a v4 UUID. You can try that with the JWT Generator.

Your UUIDs Stay in Your Browser

Every UUID on this page is created by JavaScript in your browser using the Web Crypto API, which draws from a cryptographically secure random number generator. Nothing is requested from or sent to a server, and nothing is saved. Reload the page and you get a fresh UUID.

Frequently Asked Questions

What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit value used to identify something without asking a central authority for the next number. It's written as 32 hexadecimal digits in five hyphen-separated groups (8-4-4-4-12), for example f47ac10b-58cc-4372-a567-0e02b2c3d479. GUID (Globally Unique Identifier) is Microsoft's name for the same thing. The format is defined in RFC 9562, which replaced RFC 4122 in 2024.

What is the difference between UUID v4 and UUID v7?

A v4 UUID is 122 random bits plus 6 fixed version and variant bits, so it carries no information and sorts randomly. A v7 UUID starts with a 48-bit Unix timestamp in milliseconds and fills the rest with random bits, so UUIDs sort by creation time. That makes v7 much friendlier to database indexes. The trade-off is that anyone holding a v7 UUID can read the millisecond it was created.

Which UUID version should I use for a database primary key?

For a new table, use v7. Its values arrive in roughly increasing order, so inserts append to the end of the index the way an auto-increment key does, instead of landing on random pages. Use v4 when the ID is public and the creation time should stay private, or when your platform can't generate v7 yet. Either way, store it in a native 16-byte column (uuid in PostgreSQL, BINARY(16) in MySQL), not a 36-character string.

Can two UUIDs ever be the same?

In theory yes, in practice no. A v4 UUID has 122 random bits. You'd need about 2.71 quintillion (2.71 x 10^18) of them for a 50% chance of a single duplicate, which is a billion UUIDs per second for 86 years. Real-world duplicates come from broken random sources, such as Math.random-based snippets or cloned virtual machines that start with the same seed, not from the math.

Is a GUID the same as a UUID?

Yes. GUID is the name used in Windows, COM, and .NET, and the string format is identical. Guid.NewGuid() in .NET returns a random version 4 UUID. Two differences show up in practice: Windows tools often wrap GUIDs in braces, like {F47AC10B-58CC-4372-A567-0E02B2C3D479}, and .NET's Guid.ToByteArray() writes the first three groups in little-endian byte order, so the raw 16 bytes differ from the RFC layout.

How can I tell which version a UUID is?

Look at the 13th hex digit, the first character of the third group. In f47ac10b-58cc-4372-a567-0e02b2c3d479 it's 4, so that's a version 4 UUID. A v7 UUID has a 7 in that spot. The 17th digit, the first character of the fourth group, is 8, 9, a, or b for every standard RFC 9562 UUID.

Can I use a UUID as a secret token or API key?

Not as a rule. RFC 9562 says implementations should not assume UUIDs are hard to guess. Version 1, 6, and 7 UUIDs are partly predictable because they contain a timestamp. A v4 UUID from a cryptographic generator has 122 unpredictable bits, which is fine for an unguessable ID, but for API keys, session tokens, and password-reset links use a purpose-built random token instead.

Is my data safe?

Yes. UUIDs are generated entirely in your browser with the Web Crypto API (crypto.getRandomValues and crypto.randomUUID). Nothing is sent to a server, and the generated values aren't stored anywhere.