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
- Pick a version. v4 gives fully random UUIDs. v7 gives UUIDs that sort by the time they were created.
- Choose how many you need, from 1 to 100. Each UUID goes on its own line.
- 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.
- Press Generate or
Ctrl+Enterfor 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. - 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 digits | Version 4 | Version 7 |
|---|---|---|
| 1–12 | Random | Unix time in milliseconds (01a11ad921c0 = 1791451800000) |
| 13 | 4, the version | 7, the version |
| 14–16 | Random | Random (this tool uses them as a counter so same-millisecond IDs stay in order) |
| 17 | 8, 9, a or b, the variant | Same |
| 18–32 | Random | Random |
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
| Version | How it’s built | Typical use |
|---|---|---|
| v1 | 60-bit timestamp (100 ns ticks since 1582) + node ID, usually the MAC address | Legacy systems. It leaks the machine’s MAC address and creation time |
| v2 | v1 variant for DCE Security | Almost never used |
| v3 | MD5 hash of a namespace UUID + a name | Deterministic IDs (prefer v5) |
| v4 | 122 random bits | The default almost everywhere |
| v5 | SHA-1 hash of a namespace UUID + a name | Deterministic IDs, for example from a URL or domain name |
| v6 | v1 with the timestamp fields reordered so it sorts by time | Migrating v1 systems |
| v7 | 48-bit Unix millisecond timestamp + random bits | New database keys and event IDs |
| v8 | Layout defined by the vendor | Custom or experimental schemes |
| Nil / Max | All zeros / all f | Placeholder 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 v4 | UUID v7 | |
|---|---|---|
| Random bits | 122 | 74 (some may be used as a counter) |
| Sort order | Random | By creation time, to the millisecond |
| What it reveals | Nothing | When it was created |
| B-tree index inserts | Scattered across the index | Appended near the end |
| Built-in support | Nearly every language and database | Growing: 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
uuidtype.gen_random_uuid()creates a v4 (built in since PostgreSQL 13), and PostgreSQL 18 addsuuidv7(). - MySQL has no UUID column type. Store
BINARY(16)and convert withUUID_TO_BIN()andBIN_TO_UUID(). MySQL’s ownUUID()function returns a v1 UUID, andUUID_TO_BIN(uuid, 1)reorders its time fields so the values index in time order. - SQL Server has
uniqueidentifier(16 bytes) andNEWID()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, useNEWSEQUENTIALID(). - A
CHAR(36)orVARCHAR(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
| Language | Version 4 | Version 7 |
|---|---|---|
| JavaScript (browser, Node.js) | crypto.randomUUID() | v7() from the uuid npm package |
| Python | uuid.uuid4() | uuid.uuid7() (Python 3.14+) |
| Java | UUID.randomUUID() | No built-in, use a library |
| Go | uuid.New() (github.com/google/uuid) | uuid.NewV7() |
| C# / .NET | Guid.NewGuid() | Guid.CreateVersion7() (.NET 9+) |
| Rust | Uuid::new_v4() (uuid crate) | Uuid::now_v7() |
| PostgreSQL | gen_random_uuid() | uuidv7() (PostgreSQL 18+) |
| Shell | uuidgen | Depends on the platform |
Common UUID Mistakes
- Building UUIDs with
Math.random(). A popular old snippet fills the templatexxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxxwithMath.random(). That isn’t a cryptographic random source, and some engines have produced real duplicates with it. Usecrypto.randomUUID(). crypto.randomUUID is not a function. The browser only exposes it in a secure context: HTTPS orlocalhost. On a plain-HTTP page, build the UUID fromcrypto.getRandomValues(), which is what this tool falls back to.- Case-sensitive comparisons. RFC 9562 says to output lowercase and accept either case.
F47AC10B-…andf47ac10b-…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. PassbigEndian: truewhere 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-increment | UUID v4 | UUID v7 | ULID | |
|---|---|---|---|---|
| Size | 4–8 bytes | 16 bytes | 16 bytes | 16 bytes |
| Text form | 42 | 36 chars, hex | 36 chars, hex | 26 chars, Crockford Base32 |
| Generated | By the database | Anywhere | Anywhere | Anywhere |
| Sortable | Yes | No | Yes | Yes |
| Guessable | Yes, sequential | No | Partly (timestamp) | Partly (timestamp) |
| Standard | — | RFC 9562 | RFC 9562 | Community 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.