What this UUID generator does
This UUID generator creates identifiers in the formats developers actually ask for: version 4 (random), version 7 (time-ordered), version 1, versions 5 and 3 (name-based), version 6, the nil and max UUIDs, plus ULID and NanoID. Pick a type, choose how many you need (up to 10,000 at once), and copy the result as plain lines, a comma-separated list, a quoted SQL list or a JSON array. Everything is made in your browser with its secure random number generator, so nothing is uploaded and generated IDs are never stored.
The Decode & validate tab works in the other direction. Paste any UUID, GUID or ULID and it reports whether the value is well formed, which version and variant it uses, and, for versions 1, 6, 7 and ULIDs, the exact timestamp hidden inside. Paste a whole list and it checks every line. The Format list tab rewrites UUIDs you already have in one style, for example uppercase, without dashes or as a quoted SQL list.
A UUID (universally unique identifier) and a GUID (globally unique identifier) are the same 128-bit value; "GUID" is Microsoft's name. Both are written as 32 hexadecimal digits in an 8-4-4-4-12 pattern, defined by RFC 9562, which replaced RFC 4122 in 2024 and added versions 6, 7 and 8.
How to use the generator
- Pick an ID type from the chips: v4 · random, v7 · time-ordered, v1 · timestamp, v5 · SHA-1 name, v3 · MD5 name, v6 · sortable v1, Nil, Max, ULID or NanoID.
- Set how many. Type a whole number from 1 to 10,000 into How many. NanoID also shows Length (1 to 128) and Alphabet. For v5 and v3 there is no count: choose a Namespace (DNS, URL, OID, X.500 or your own UUID) and type one name per line under Names. Each line becomes one UUID.
- Choose the format. Uppercase, No dashes and {Braces} change how each UUID is written. Layout wraps the list as one per line, comma separated, a single-quoted list for SQL
IN (...), a double-quoted list for CSV or code, or a JSON array. - Press Generate new (or Generate for v5 and v3). Changing the type or count regenerates automatically, while changing only the format switches restyles the same IDs.
- Copy all puts the output on your clipboard, Download saves a
.txtor.jsonfile, and Decode first opens the first ID in the Decode & validate tab.
Format or convert UUIDs you already have
The Format list tab takes UUIDs in any style: one per line or separated by commas or spaces, with or without dashes, in braces, with a urn:uuid: prefix, in quotes and in any case. ULIDs are converted to the same 128 bits in UUID form, and anything else is skipped with the reason. Load example fills in these four lines:
550E8400E29B41D4A716446655440000
{6BA7B810-9DAD-11D1-80B4-00C04FD430C8}
urn:uuid:017f22e2-79b0-7cc3-98c4-dc0c0c07398f
not-a-uuid
With the default lowercase and the Single-quoted list (SQL) layout, the output is:
'550e8400-e29b-41d4-a716-446655440000',
'6ba7b810-9dad-11d1-80b4-00c04fd430c8',
'017f22e2-79b0-7cc3-98c4-dc0c0c07398f'
The status reads "3 formatted · 1 skipped", and the skipped value's reason is "n" is not a hexadecimal digit (0-9, a-f).
- Add dashes to 32-digit hex copied from logs, or strip them for compact text keys.
- Turn on Uppercase to match how SQL Server prints
uniqueidentifiervalues. - Turn on {Braces} for COM class IDs (CLSIDs) in the Windows registry, which are written inside curly braces.
- Use the urn:uuid: prefix where RFC 9562's URN form is expected. It always keeps the dashes.
- Pick the JSON array layout for test fixtures.
- Turn on Remove duplicates to collapse the same ID written in different cases, or with and without dashes. The first copy is kept.
For one value's Base64, integer or .NET byte order, use the Decode & validate tab instead.
What each version means
| Version | Where uniqueness comes from | Sorts by time? | Typical use |
|---|---|---|---|
| v1 | 60-bit timestamp (100 ns ticks since 1582-10-15), clock sequence, 48-bit node | Not as written | Legacy systems; MySQL's UUID() |
| v3 | MD5 of a namespace UUID and a name | No | Matching an existing v3 scheme |
| v4 | 122 random bits | No | The default GUID |
| v5 | SHA-1 of a namespace UUID and a name | No | Stable IDs derived from names |
| v6 | The v1 timestamp reordered, most significant bits first | Yes | Systems already built on v1 |
| v7 | 48-bit Unix millisecond timestamp plus 74 random bits | Yes | Database primary keys |
| v8 | Whatever the generator defines | Up to you | Vendor-specific layouts |
| Nil / Max | All bits 0 / all bits 1 | n/a | Placeholder and sentinel values |
Every standard UUID carries a 4-bit version and a 2-bit variant (binary 10). That is why the first digit of the third group shows the version and the first digit of the fourth group is always 8, 9, a or b.
How the IDs are built
Version 4. The tool calls crypto.randomUUID() when the browser offers it and falls back to crypto.getRandomValues(). Six of the 128 bits are fixed for version and variant, leaving 122 random bits.
Version 7. The first 48 bits are the current time in Unix milliseconds. Take 017F22E2-79B0-7CC3-98C4-DC0C0C07398F, the version 7 test vector in RFC 9562. Its first 12 hex digits, 017F22E279B0, equal 1,645,557,742,000 milliseconds, which is 2022-02-22 19:22:22 UTC. The 7 starting the third group is the version, and the 9 starting the fourth carries the variant bits. The other 74 bits are random. Within one millisecond this tool treats them as a counter that grows by a random amount, so every UUID in a batch is strictly greater than the one before it, and the output shows a "strictly increasing" badge.
Versions 1 and 6. The timestamp counts 100-nanosecond ticks from 15 October 1582. Classic v1 generators put the machine's MAC address in the node field, which leaks hardware identity. This tool uses a random node with the multicast bit set, RFC 9562's marker for a node that is not a real network address.
Versions 5 and 3. These are deterministic. For v5 the tool computes SHA-1 over the 16 namespace bytes followed by the UTF-8 name, keeps 128 bits and overwrites the version and variant bits. With the DNS namespace 6ba7b810-9dad-11d1-80b4-00c04fd430c8 and the name www.example.com, v5 gives 2ed6657d-e927-568b-95e1-2665a8aea6a2 and v3 gives 5df41881-3aed-3515-88a7-2f4a814cf09e. Any compliant library agrees, for example Python's uuid.uuid5(uuid.NAMESPACE_DNS, "www.example.com").
ULID and NanoID. A ULID is a 48-bit millisecond timestamp plus 80 random bits, written as 26 Crockford Base32 characters (digits and letters without I, L, O and U). NanoID is not a UUID: each character is drawn from an alphabet by rejection sampling, so every symbol is equally likely. Strength is length × log2(alphabet size), so the default 21 characters from 64 symbols give 126 bits, while 21 digits give only about 70.
Version 4 versus version 7 as database keys
A primary key index is a sorted tree. With random v4 keys every insert lands on a random leaf page. Suppose an index has 100,000 leaf pages (an illustrative figure). Inserting 1,000 rows touches about 100,000 × (1 − (1 − 1/100,000)^1,000) ≈ 995 different pages, so nearly every insert reads a page that may not be in memory, and full pages split in the middle. With v7 keys all 1,000 rows land on the right edge of the index. If a page holds around 200 entries, that is roughly 5 pages, and older pages are never touched again.
That is why v7 is usually the better choice for a new table, and why PostgreSQL 18 added a built-in uuidv7(). The trade-off is privacy: anyone who decodes a v7 value learns when the row was created. For public account IDs, expose v4 and keep the v7 or integer key internal. For the bit-by-bit layout, sorting caveats and when to keep existing v4 keys, read UUID v4 vs v7: Which Should You Use?.
How many bytes is a UUID?
A UUID is 128 bits, which is 16 bytes in binary. As text in the standard 8-4-4-4-12 form it is 36 characters: 32 hexadecimal digits plus four dashes. The other text forms of 550e8400-e29b-41d4-a716-446655440000 differ in length:
| Form | Example | Size |
|---|---|---|
Binary (SQL Server uniqueidentifier, BINARY(16)) | 16 raw bytes | 16 bytes |
| Canonical text, either case | 550e8400-e29b-41d4-a716-446655440000 | 36 characters |
| No dashes | 550e8400e29b41d4a716446655440000 | 32 characters |
| Braces | {550e8400-e29b-41d4-a716-446655440000} | 38 characters |
| URN | urn:uuid:550e8400-e29b-41d4-a716-446655440000 | 45 characters |
| Base64 | VQ6EAOKbQdSnFkRmVUQAAA== | 24 characters (22 without padding) |
| ULID form | 2N1T201RMV87AAE5J4CSAM8000 | 26 characters |
| 128-bit integer | 113059749145936325402354257176981405696 | up to 39 digits |
The largest 128-bit integer, 340282366920938463463374607431768211455, also has 39 digits. In a single-byte character set a CHAR(36) key costs 36 bytes, 2.25 times a 16-byte binary column, so 1 million keys take 36 MB of raw key data against 16 MB.
Which ID type should you choose?
- A new database table: v7. It is a standard UUID, so every uuid column, driver and validator accepts it, and it inserts in time order.
- An ID that appears in public URLs, or whose creation time must stay private: v4. It carries no information beyond its randomness.
- The same input must always produce the same ID: v5. Use v3 only to match data that already uses it.
- A shorter string for people to copy: ULID (26 characters) or NanoID (21 by default). Neither is a UUID, so a native
uuidcolumn will not accept them as text. A ULID does hold exactly 128 bits, and the Decode tab shows the UUID form of any ULID. - Existing v1 data, or MySQL's
UUID()output, that you want to sort by time: v6. It is the same timestamp and node with the fields reordered. - A placeholder or an upper bound for a range query: Nil or Max.
How likely is a collision?
The chance that at least one pair among n random v4 UUIDs collides is 1 − e^(−n² ÷ (2 × 2^122)), which for small n is simply n² ÷ (2 × 2^122). The table uses that formula.
| UUIDs generated | Chance of at least one duplicate |
|---|---|
| 1 billion (10^9) | about 9.4 × 10^-20 |
| 103 trillion | about 1 in a billion |
| 10^18 | about 9% |
| 2.7 × 10^18 | 50% |
Reaching 2.7 × 10^18 would take roughly 85 years at one billion UUIDs per second. Real duplicates come from a broken random source or a copied value, not from chance.
Generate a UUID in JavaScript, Python, Java, C#, Go or SQL
crypto.randomUUID(); // v4
// The npm package "uuid" (version 10 or later for v7)
import { v5 as uuidv5, v7 as uuidv7 } from "uuid";
uuidv7();
uuidv5("www.example.com", uuidv5.DNS); // 2ed6657d-e927-568b-95e1-2665a8aea6a2
import uuid
str(uuid.uuid4()) # v4
str(uuid.uuid7()) # v7, Python 3.14 and later
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.UUID;
public class Ids {
public static void main(String[] args) {
UUID id = UUID.randomUUID(); // v4 from a cryptographically strong generator
String guid = "{" + id.toString().toUpperCase() + "}"; // braces and uppercase
UUID parsed = UUID.fromString("550e8400-e29b-41d4-a716-446655440000"); // parsed.version() == 4
// nameUUIDFromBytes makes version 3 (MD5) from only the bytes you pass,
// so put the namespace in front of the name yourself.
UUID ns = UUID.fromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8");
byte[] name = "www.example.com".getBytes(StandardCharsets.UTF_8);
byte[] buf = ByteBuffer.allocate(16 + name.length)
.putLong(ns.getMostSignificantBits())
.putLong(ns.getLeastSignificantBits())
.put(name)
.array();
UUID v3 = UUID.nameUUIDFromBytes(buf); // 5df41881-3aed-3515-88a7-2f4a814cf09e
}
}
Java's standard library has no v5 generator, so use a library for v5. Java 26 added UUID.ofEpochMillis(System.currentTimeMillis()) for v7; on older versions, use a library for v7 as well.
Guid.NewGuid(); // v4
Guid.CreateVersion7(); // .NET 9 and later
id := uuid.New() // github.com/google/uuid, v4
id7, err := uuid.NewV7() // v7
-- PostgreSQL
SELECT gen_random_uuid(); -- v4 (built in since 13)
SELECT uuidv7(); -- v7 (PostgreSQL 18 and later)
-- MySQL: UUID() returns a version 1 value
SELECT UUID_TO_BIN(UUID(), 1); -- BINARY(16), timestamp fields swapped
SELECT BIN_TO_UUID(id, 1) FROM users; -- read back with the same swap flag
-- SQL Server
SELECT NEWID();
Tips and common mistakes
- Store UUIDs in a native
uuidcolumn orBINARY(16), notCHAR(36). A text key is 2.25 times as large (see the size table above) and slower to compare. - Compare case-insensitively, but keep one consistent case if you sort v7 values as text.
- Do not treat a UUID as a secret. RFC 9562 advises against using UUIDs as security capabilities. For tokens and keys use the password generator or a dedicated random token.
- Watch GUID byte order. .NET's
Guid.ToByteArray()stores the first three groups little-endian, and SQL Server ordersuniqueidentifiervalues by their last six bytes first, so v7 does not sort by time there. The Decode tab shows the .NET byte order. - Use v5 for stable IDs, such as hashing a URL with a fixed namespace so re-imports are idempotent. Never use it to hide a value: anyone who can guess the name can recompute the UUID.
- Reshape lists as needed. Remove line breaks turns a column of IDs into one line, and the JSON formatter checks a JSON array before you paste it into a fixture.
Privacy and limitations
IDs are generated and decoded entirely in your browser. Nothing is sent to a server, and generated IDs are never saved. Only your option choices are remembered in this browser, and the names, format and decode boxes last for the current tab only.
- A batch holds at most 10,000 IDs or names, and the Format list and Decode tabs read the first 10,000 values of a paste.
- v7 and ULID ordering is guaranteed within one batch. Across machines it depends on their clocks, and this tool trusts your device's clock for every timestamp.
- v5 uses the browser's SubtleCrypto, available on HTTPS pages and localhost. If it is missing, the tool says so.
- The validator checks structure, not whether an ID exists anywhere, and it cannot tell a genuine v4 from any other 128 random-looking bits.
This tool is independent and not affiliated with Microsoft, PostgreSQL, MySQL, or the ULID and NanoID projects; product names appear only to describe compatibility.
Frequently asked questions
What is a UUID, and is a GUID the same thing?
A UUID (universally unique identifier) is a 128-bit value: 16 bytes in binary, or 36 characters as text (32 hexadecimal digits in an 8-4-4-4-12 pattern plus four dashes), such as 550e8400-e29b-41d4-a716-446655440000. GUID (globally unique identifier) is Microsoft's name for the same thing. The format is identical, although Microsoft tools such as SQL Server Management Studio and the Windows registry often show GUIDs in uppercase or in braces, and .NET's Guid.ToByteArray() and SQL Server storage put the first three groups in little-endian byte order. The current standard is RFC 9562, which replaced RFC 4122 in 2024.
What is the difference between UUID v4 and UUID v7?
Both are 128 bits. Version 4 is 122 random bits, so values arrive in no useful order. Version 7 starts with a 48-bit Unix millisecond timestamp and fills the rest with 74 random bits, so newer IDs sort after older ones. Choose v4 when the ID should reveal nothing, and v7 when IDs become database keys, where ordered inserts are faster. Remember that a v7 value exposes its creation time to anyone who reads it.
Are UUIDs really unique? Can two of them collide?
Collisions are possible in theory and irrelevant in practice. A v4 UUID has 122 random bits, so you would need about 2.7 quintillion (2.7 × 10^18) of them for a 50% chance of one collision, and about 103 trillion for a one-in-a-billion chance. That assumes a strong random source, which is what this page uses. Real-world duplicates almost always come from weak randomness or copied values, not bad luck.
Should I use a UUID as a database primary key?
Often yes, with one caveat. UUIDs let clients create IDs without asking the database, and they never clash across servers or merged datasets. The cost is size (16 bytes against 8 for a bigint) and, for random v4 keys, scattered index inserts that split pages and waste cache. UUID v7 keeps the benefits and inserts in time order, so it is usually the better key. Store it in a native uuid or BINARY(16) column, not as text.
Are the UUIDs made here safe to use, and do you store them?
They are generated in your browser with its cryptographically secure random number generator: crypto.randomUUID for v4 and crypto.getRandomValues for the other types. Nothing is sent to a server, and generated IDs are never saved; only your option choices are remembered in this browser. Version 1 values made here use a random node ID instead of your MAC address, so they reveal nothing about your hardware.
What is a ULID, and how is it different from a UUID?
A ULID is a 128-bit identifier written as 26 Crockford Base32 characters: a 48-bit millisecond timestamp followed by 80 random bits, for example 01ARZ3NDEKTSV4RRFFQ69G5FAV. Like UUID v7 it sorts by creation time, but it is shorter, case-insensitive and URL-safe. It is not a UUID, yet it holds the same number of bits, so it converts to a UUID and back without loss. The Decode & validate tab shows both forms.
How do I generate a UUID in JavaScript, Python, Java, C# or SQL?
JavaScript: crypto.randomUUID(). Python: str(uuid.uuid4()), or uuid.uuid7() from Python 3.14. Java: UUID.randomUUID(). C#: Guid.NewGuid(), or Guid.CreateVersion7() in .NET 9 and later. PostgreSQL: gen_random_uuid(), plus uuidv7() from version 18. MySQL: UUID() returns a version 1 value, best stored with UUID_TO_BIN(). SQL Server: NEWID(). The article on this page has copy-ready snippets for each.
Why does UUID v5 give the same result every time?
Versions 3 and 5 are hashes, not random values. UUID v5 runs SHA-1 over a namespace UUID plus a name and keeps 128 bits, so the same namespace and name always produce the same UUID on any machine. That is useful for stable IDs derived from a URL, email address or filename, and for de-duplicating imports. Prefer v5 over v3, which uses MD5. Neither hides secrets, because anyone who can guess the name can recompute the UUID.