UUID Generator
Generate random (v4) or time-based (v1) UUIDs instantly.
Configuration
UUIDs explained: versions, collisions and where they belong
A UUID (Universally Unique Identifier) is a 128-bit number. In text form it is written as 32 hexadecimal digits in five groups of 8-4-4-4-12, for example 550e8400-e29b-41d4-a716-446655440000, which is 36 characters with the hyphens. Microsoft calls the same layout a GUID. The current specification is RFC 9562 (May 2024), which replaced RFC 4122 and defines versions 1 through 8. Two fields are fixed inside every RFC UUID: the first hex digit of the third group is the version, and the first hex digit of the fourth group is 8, 9, a or b, which marks the RFC variant. So a random UUID always looks like xxxxxxxx-xxxx-4xxx-[89ab]xxx-xxxxxxxxxxxx.
Version 4: random
A v4 UUID is 122 random bits plus the 6 fixed version and variant bits. This page draws the random bytes from crypto.getRandomValues(), the browser's cryptographic random source, through the uuid npm package. The collision arithmetic is the birthday problem: you would need to generate roughly 2.7 x 10^18 v4 UUIDs before the probability of a single duplicate reaches 50 percent. At one billion per second that takes about 86 years, which is why v4 identifiers can be created by independent services with no coordination and no central counter.
Version 1: time-based
A v1 UUID packs a 60-bit timestamp (100-nanosecond intervals since 15 October 1582, the start of the Gregorian calendar), a 14-bit clock sequence and a 48-bit node field. The original design put the machine's MAC address in the node field, which is why v1 UUIDs got a reputation for leaking hardware identity. A browser cannot read your MAC address, so the library used here fills the node with random bytes and sets the multicast bit, as the RFC allows; the result still embeds the exact time of generation. Note that v1 stores the timestamp low bits first, so v1 strings do not sort in time order. That defect is what versions 6 and 7 were created to fix.
Version 7 and database indexes
A v7 UUID starts with a 48-bit Unix timestamp in milliseconds followed by random bits, so values sort by creation time as plain strings or bytes. That matters for primary keys. B-tree indexes on random v4 keys receive inserts at random positions, which causes page splits, poor cache locality and more write amplification on busy tables. Time-ordered v7 keys append at the right edge of the index, like an auto-increment integer, while keeping the "generate anywhere" property. PostgreSQL 18 ships a built-in uuidv7()function, and the uuid npm package and most language libraries offer v7 generators. This page generates v1 and v4 only; the differences are covered in depth in the UUID v1 vs v4 vs v7 guide.
| Version | Built from | Sortable by time | Typical use |
|---|---|---|---|
| v1 | Timestamp + clock sequence + node | No (byte order is scrambled) | Legacy systems, COM, older databases |
| v4 | 122 random bits | No | Opaque identifiers, upload names, idempotency keys |
| v5 | SHA-1 of a namespace + name | No | Deterministic IDs derived from a URL or DNS name |
| v7 | Unix millisecond timestamp + random bits | Yes | Primary keys in tables that are range-scanned |
Storing and formatting UUIDs
RFC 9562 says generators should emit lowercase hex and parsers must accept either case, so treat 550E8400... and 550e8400... as the same value. Store UUIDs as 16 raw bytes rather than 36-character strings: PostgreSQL has a native uuidtype, MySQL users typically use BINARY(16) with UUID_TO_BIN(), and SQL Server has uniqueidentifier (whose sort order is unusual, so do not rely on it for ordering). The special nil UUID is all zeros (00000000-0000-0000-0000-000000000000) and RFC 9562 also defines a max UUID of all fs. The URN form is urn:uuid:<value>.
Validating a UUID in code
Input validation only needs to check the shape, not the randomness. This pattern accepts any RFC version (1 to 8) and the RFC variant, in either case, and rejects the common mistakes of missing hyphens, wrong group lengths and non-hex characters:
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$Try it against your own values in the Regex Tester. Most languages also ship a parser that does the same job with clearer errors: Python's uuid.UUID(text) raises ValueError on bad input, Java has UUID.fromString(), and the uuid npm package exports validate() and version(). Accept the nil UUID only if your application has a meaning for it; it usually signals an uninitialised value.
Command-line equivalents
uuidgen # Linux (util-linux) and macOS: random v4
uuidgen -t # util-linux: time-based v1
cat /proc/sys/kernel/random/uuid # Linux kernel, v4
python3 -c "import uuid; print(uuid.uuid4())"
node -e "console.log(require('crypto').randomUUID())"
[guid]::NewGuid() # PowerShellNothing leaves your browser
The values are generated locally and are not logged or stored. Because this page's v1 output uses a random node field, it never contains your network card's MAC address.How to use
- Choose Version 4 (random) or Version 1 (time-based) with the toggle.
- Set the quantity, from 1 to 50 per batch.
- Press Generate. The list appears instantly because generation happens in your browser.
- Click the copy button beside any UUID, or use Copy All to copy the whole batch as a newline-separated list.
- Press Clear to discard the batch before generating a fresh one.
Common use cases
- Primary keys for new tables when auto-increment integers would leak record counts or block multi-region writes.
- Idempotency keys sent in a header so a retried payment or order request cannot be applied twice.
- Correlation and trace identifiers propagated across microservices and log lines for distributed debugging.
- Object names for user uploads in S3 or a CDN, avoiding collisions and path traversal from user-supplied filenames.
- Seed data for fixtures and tests when you need many syntactically valid identifiers quickly.
- Anonymous device or installation identifiers in analytics pipelines that must not reveal personal data.
Frequently asked questions
Are these UUIDs cryptographically secure?
Can two random v4 UUIDs collide?
When should I use v1 instead of v4?
Does this tool generate v7 UUIDs?
Are UUIDs case sensitive?
What is the difference between a UUID and a GUID?
Should I store UUIDs as text or binary in my database?
Is a UUID good enough as a secret token, for example in a password reset link?
Advertisement