How to Generate UUIDs (v4 and v7) and Pick the Right Version
UUIDs feel like a solved problem until you choose one for a primary key and your database index starts bloating, or until someone asks whether a GUID is the same thing. UUID generator makes v4 or v7 UUIDs in bulk, in whatever format you need, and decodes any UUID you paste.
Steps
- Pick version 4 or version 7.
- Choose how many and the format.
- Press Generate, then copy or download.
Formats include standard lowercase, uppercase, no hyphens, and braces (the Windows GUID style).
v4 or v7?
Version 4 is 122 random bits from your browser's cryptographically secure generator (crypto.getRandomValues). It reveals nothing about when or where it was made. That's the right choice for public-facing IDs, invite tokens or anything where leaking creation time is a concern.
Version 7 starts with the current Unix time in milliseconds, followed by random bits. Because they sort by creation time, new rows go to the end of a B-tree index instead of random locations. That keeps indexes compact and inserts fast in PostgreSQL, MySQL and similar databases. For database primary keys, v7 is the better default today.
Both follow RFC 9562, the 2024 standard that replaced RFC 4122.
The checker
Paste any UUID and the page shows its version and variant, and for version 7 and version 1 it decodes the creation time. Useful when debugging: "when was this record created?" can be answered from a v7 ID alone, even if the created_at column is missing.
That's also the privacy trade-off: if you use v7 in public URLs, anyone can read when each object was created.
Collisions
People worry about this more than they need to. With 122 random bits, you'd need to generate billions of v4 UUIDs per second for many years before a collision became likely. The real risks are bugs: copying the same ID twice in a test fixture, or using a non-cryptographic random function in some library.
GUID vs UUID
Same thing. GUID is Microsoft's name for the 128-bit format. If you're pasting into a Windows registry file, C# code or SQL Server, the braces format gives you {...} style.
Example uses
- Seeding a test database with 500 v7 IDs that sort naturally.
- Idempotency keys for payment API calls; a v4 per request.
- Mock data for a front-end prototype.
- Correlation IDs in logs to trace a request across services.
Tips
- Store UUIDs as native types (
uuidin PostgreSQL,BINARY(16)in MySQL), not as 36-character strings. It halves storage and speeds comparisons. - Don't treat a UUID as a secret. v4 is hard to guess, but it isn't designed as an authentication token. Use a proper token for that.
- Be consistent with case. Some systems compare UUIDs as strings, so
ABC...andabc...won't match.
When not to use a UUID
For small internal tables, an auto-incrementing integer is simpler, smaller and perfectly fine. UUIDs shine when IDs are created in many places at once (multiple servers, mobile apps offline, data merged from different systems) or when you don't want sequential IDs exposing how many orders or users you have. Choose them for those reasons, not by default.
Privacy
The page says UUIDs are generated inside the page and stay on your device. Like every page on the site, it carries Google ads.
FAQ
Can two UUIDs be the same? In practice, no.
v4 or v7 for database keys? v7, because it sorts by time and keeps indexes compact.
Is a GUID a UUID? Yes, same format; use the braces option for Windows style.
How random are they?
They come from crypto.getRandomValues, the browser's secure generator.
Need IDs? Generate them with UUID generator.
— Alok Kumar Singh