About this tool
A UUID (Universally Unique Identifier) is a 128-bit ID that you can create anywhere, without asking a central database for the next number, and still be practically certain no one else will ever create the same one. It’s written as 32 hexadecimal digits in five groups, 8-4-4-4-12, like 0193a5e2-7c41-7b1e-9f2a-4d8c51e0b7a3. UUIDs are used as database keys, request and trace IDs, file names, idempotency keys and message IDs.
How to use this UUID generator
- Choose v4 (random) or v7 (time-ordered).
- Set how many you need, up to 100 at a time, and pick a format: uppercase, with or without hyphens, or wrapped in
{braces}like a Windows GUID. - Copy the whole list or download it as a text file. Press G to generate a fresh batch.
- To check an existing ID, paste it into Inspect a UUID. It shows the version, the variant and, for v7 and v1, the date and time it was created.
Every UUID is generated in your browser with the Web Crypto API’s secure random generator. Nothing is sent to a server, and a batch of v7 IDs is strictly increasing, even within the same millisecond.
UUID v4 vs. UUID v7
| UUID v4 | UUID v7 | |
|---|---|---|
| Made from | 122 random bits | 48-bit Unix timestamp (ms) + 74 random bits |
| Sort order | Random | Creation order |
| Database index | Inserts land all over the index, causing page splits and a larger index | Inserts go to the end, like an auto-increment key |
| Reveals creation time | No | Yes, to the millisecond |
| Best for | Public tokens, IDs that must not leak timing | Primary keys, event and log IDs, anything sorted by time |
Both versions are defined in RFC 9562 (2024), which replaced RFC 4122. A rule of thumb: use v7 for database primary keys and v4 when the ID is shown to users and shouldn’t reveal when something was created.
Anatomy of a UUID
Two positions tell you what kind of UUID you have. In 0193a5e2-7c41-7b1e-9f2a-4d8c51e0b7a3:
- The first digit of the third group is the version:
4for random,7for time-ordered,1for the old MAC-address-and-time format. - The first digit of the fourth group is the variant. For standard UUIDs it’s
8,9,aorb. - In a v7 UUID, the first 12 hex digits are the creation time in milliseconds since 1970. Paste one into the inspector to see it as a date.
All UUID versions
| Version | Based on | Use today? |
|---|---|---|
| v1 | Timestamp + MAC address | Legacy systems. Classic v1 leaks the machine’s MAC address; this tool uses a random node ID instead |
| v3 | MD5 hash of a namespace and name | Prefer v5 |
| v4 | Random | Yes, the general-purpose default |
| v5 | SHA-1 hash of a namespace and name | Yes, when the same input must always give the same UUID |
| v6 | v1 reordered to sort by time | Only for compatibility with v1 systems |
| v7 | Unix timestamp (ms) + random | Yes, for sortable IDs and database keys |
| v8 | Custom, vendor-defined layout | Special cases only |
There are also two special values: the nil UUID (all zeros) and the max UUID (all fs), often used as placeholders.
Generate UUIDs in code
// v4: built into browsers and Node.js 19+ (or require('node:crypto') in 14.17+)
const id = crypto.randomUUID();
// v7: npm install uuid
import { v7 as uuidv7 } from 'uuid';
const sortableId = uuidv7();import uuid
uuid.uuid4() # random
uuid.uuid7() # time-ordered, Python 3.14+-- v4, built in since PostgreSQL 13
CREATE TABLE orders (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
created_at timestamptz NOT NULL DEFAULT now()
);
-- v7, built in since PostgreSQL 18
-- id uuid PRIMARY KEY DEFAULT uuidv7()import java.util.UUID;
UUID id = UUID.randomUUID(); // v4Guid id = Guid.NewGuid(); // v4
Guid sortable = Guid.CreateVersion7(); // v7, .NET 9+import "github.com/google/uuid"
id := uuid.New() // v4
sortable, err := uuid.NewV7() // v7uuidgen # macOS / Linux
[guid]::NewGuid().ToString() # PowerShellTo check whether a string is a valid UUID, this regular expression matches versions 1 to 8 in the standard variant: ^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ (case-insensitive). Try it in the regex tester.
UUIDs as database keys
- Store them as a native type, not text:
uuidin PostgreSQL,BINARY(16)in MySQL,uniqueidentifierin SQL Server. That’s 16 bytes instead of 36. - Prefer v7 for primary keys. Random v4 keys scatter inserts across the index, which slows large tables down.
- UUIDs are not secrets. They’re hard to guess but not designed as access tokens. For API keys or reset links, use the API key generator or a random string instead.
FAQ
Should I use UUID v4 or v7?
Use v7 for database primary keys and anything you will sort by creation time. Use v4 when the identifier must not reveal when it was created.
Can two UUIDs collide?
In practice, no. You would need to generate about 2.7 quintillion v4 UUIDs to have a 50% chance of a single collision.
What is a GUID?
GUID is Microsoft’s name for the same 128-bit format. Use the braces and uppercase options to match the common Windows notation.
How do I generate a UUID in JavaScript?
Call crypto.randomUUID(). It is built into modern browsers and Node.js and returns a random v4 UUID. For v7, use the uuid package from npm.
How can I tell which version a UUID is?
Look at the first digit of the third group: 0193a5e2-7c41-7b1e-… is version 7. Or paste it into the inspector on this page.
Can I get the creation time from a UUID?
Only from time-based versions. A v7 UUID stores the creation time in milliseconds in its first 48 bits, and v1 and v6 store a timestamp too. A v4 UUID contains no time information.
Are UUIDs case-sensitive?
No. RFC 9562 says UUIDs should be output in lowercase but compared case-insensitively, so 0193A5E2-… and 0193a5e2-… are the same UUID.
Are these UUIDs generated on a server?
No. They are created in your browser with the Web Crypto API, and nothing is sent anywhere.