v4 or v7?
A UUID (universally unique identifier, also called a GUID) is a 128-bit value written as 32 hex digits, like 550e8400-e29b-41d4-a716-446655440000. Any system can create one without coordinating with others, with no realistic risk of a duplicate.
- Version 4 is 122 random bits. It reveals nothing about when or where it was made. Use it for anything that should be unguessable or that shouldn't leak timing, such as public IDs.
- Version 7 (RFC 9562, 2024) starts with the creation time in milliseconds, followed by random bits. New IDs sort after old ones, which keeps database indexes compact and inserts fast. Use it for primary keys. Its creation time can be read by anyone who sees it.
How to use the UUID Generator
- Choose version 4 (random) or version 7 (time-ordered).
- Set how many UUIDs you need, up to 1,000.
- Choose a format: uppercase, without hyphens, or in braces.
- Copy them all, or download them as a text file. Press Generate for a new set.
Examples
Five version 7 UUIDs from the same millisecond
Version 7, 5 UUIDs, at 2026-11-10 12:00:00.000 UTC01a1c554-5200-70ae-9337-da3364e0a9d9
01a1c554-5200-70af-a8bf-e4cf7d2df2da
01a1c554-5200-70b0-a486-3815bc8b0f57
01a1c554-5200-70b1-893d-6c2e9425623d
01a1c554-5200-70b2-b652-929c7974ec6eThe first 12 hex digits are the time (01a1c5545200 is 1,794,312,000,000 ms). The 7 starts the third group, and the next three digits count up, so the UUIDs sort in the order they were made even within one millisecond.
Version 4 UUIDs
Version 4, 3 UUIDse7074345-ff94-4a57-af0a-fde4a8fe4535
edda3c2b-3070-43d8-9c45-9457faa13597
aa71df56-c9e8-4587-a6ea-4c8cff8d33d6Each third group starts with 4 (the version), and each fourth with 8, 9, a or b (the variant). Everything else is random.
Uppercase, in braces, without hyphens
e7074345-ff94-4a57-af0a-fde4a8fe4535{E7074345FF944A57AF0AFDE4A8FE4535}The value is the same; only the way it's written changes. RFC 9562 recommends lowercase, but parsers must accept either.
In code
In browsers and Node.js, crypto.randomUUID() returns a version 4 UUID. Version 7 isn't built in yet: use the uuid package (import { v7 } from "uuid"), or your database's function where available, such as uuidv7() in PostgreSQL 18.
Never generate UUIDs with Math.random(): it isn't cryptographically secure, and its output can be predicted.
Options
- Version
- 4 for random UUIDs, 7 for time-ordered UUIDs.
- How many
- From 1 to 1,000 UUIDs at once, one per line.
- Uppercase, Hyphens, Braces
- Formatting only: uppercase hex digits, the four hyphens, and
{…}around each UUID as Microsoft GUIDs are often written.
Limitations
- Up to 1,000 UUIDs at once. For more, generate them in your code.
- Version 7 UUIDs use your device's clock; if it's wrong, the embedded time is too.
- Versions 1 and 6 (based on time and a MAC address) aren't offered: v7 replaces them for new systems.
Frequently asked questions
Are these UUIDs unique?
For all practical purposes, yes. A version 4 UUID has 122 random bits: you would need to generate about a billion per second for 85 years to have a 50% chance of a single duplicate. Version 7 adds the time, which makes collisions even less likely.
Are they sent to or stored on a server?
No. They're generated in your browser with crypto.getRandomValues() and never leave the page.
Should I use UUID v7 as a database primary key?
It's a good choice: v7 values increase over time, so new rows go at the end of the index instead of random positions, which keeps inserts fast. Avoid it where the creation time must stay private, since anyone can read it from the ID.
What's the difference between a UUID and a GUID?
Nothing important: GUID is Microsoft's name for the same 128-bit identifier. GUIDs are often written in uppercase and in braces, which the format options produce.