About UUID Generator
Reach for this whenever you need an identifier that will not collide: replacing auto-increment keys with something usable across services, deduplicating messages, tagging log traces, naming temporary uploads, or filling test fixtures. The 128-bit space makes collisions negligible, so no central authority is required and values can be generated offline, which is exactly why UUIDs displaced sequential IDs in multi-service systems. This tool calls the browser-native crypto.randomUUID() to produce RFC 4122 version 4 random UUIDs, and also generates RFC 9562 version 7 locally, which is sortable by time. The only difference that matters: v4 uses 122 random bits, so inserts land anywhere; v7 puts a millisecond timestamp in the high bits, so values created close in time sit next to each other. On key selection: with v4 as a primary key, B-tree inserts wander across the whole tree, causing frequent page splits, a lower cache hit rate, and eventually throughput decay plus storage fragmentation on write-heavy tables. Because v7 has an ordered time prefix, inserts land near the end of the index, behaving much like a sequential ID while still being unpredictable. Reserve v4 for pure random identifiers such as sessions, tokens and filenames. Limits: Randomness is not the same as unguessability: v1 encodes the MAC address and timestamp directly, so anyone can derive the generating machine and moment, which is why v1 should never be an externally visible identifier. And v4 is only as strong as its randomness source, so generating it with a math library defeats the cryptographically secure requirement. On storage, the 36-character text form is bulky, roughly 360 MB for ten million rows, while a 16-byte binary column brings that to about 160 MB and compares faster, at the cost of readability in queries and logs. A common compromise is binary internally and hyphenated text at the edges. UUID hex is case-insensitive, so normalize to lowercase before equality comparisons. Data and privacy: generated UUIDs usually act as session identifiers, trace numbers or temporary resource names, and are not secrets in themselves, though showing the mapping between an ID and a user identity on the page would be a risk. This tool runs entirely in the browser using the system random source and clock, contacting no server and recording no results. Batch generation and alternatives deserve a decision up front. For volume, the main question is which side should produce the values: when you need hundreds of thousands to seed test data, a command-line tool fits better, whereas generating a few samples on a page is fine in the browser. Beyond UUID there are several established options. ULID encodes 128 bits in 26 Crockford characters, is likewise time-ordered and shorter, which suits storage- and readability-sensitive cases. Snowflake-style schemes guarantee ordering through machine bits plus a sequence, but require managing machine IDs. A plain auto-increment column remains the simplest choice on a single database and table, and only becomes unacceptable once you shard or must generate offline. Comparing candidates on three explicit criteria, whether they are ordered, whether they can be generated offline, and what they cost in length and storage, beats choosing from intuition. The practical split is simple: store 16-byte binary internally with a unique index, expose lowercase hyphenated strings through APIs and logs, and never truncate at the presentation layer. That keeps the storage and index benefits without giving up readability while debugging.
How It Works Internally
v4 fills 122 of the 128 bits with randomness and uses the rest to mark the version (the 13th hex digit is always 4) and the variant (the next digit comes from a fixed set). v7 is the opposite: the high 48 bits carry a millisecond timestamp and the rest is random, so identifiers created in the same millisecond sit adjacent and insert near the end of an index instead of at random.
Generate any v4 UUIDf47ac10b-58cc-4372-a567-0e02b2c3d479 (13th hex digit is always 4; 17th is always 8/9/a/b)Measured on This Page
| v4 correctness | All 10 report version=4 and variant=10xx, all distinct (produced by crypto.randomUUID) |
|---|---|
| v7 timestamp | The leading 48-bit millisecond field lands within ±60 s of generation (measured 1,793,404,170,398 → 2026-10-30); UUIDs in the same millisecond share the prefix and differ in the random suffix, matching RFC 9562 |
| nil | 00000000-0000-0000-0000-000000000000 is all zeros (the reserved nil semantics) |
| Format options | No hyphens (32 chars), uppercase and braces can be combined |
| Randomness source | crypto.getRandomValues / crypto.randomUUID, with a Math.random fallback only when unavailable |
The version nibble is not decoration: the 13th hex digit is the version (4=random, 7=time-ordered) and the 17th is the variant (8/9/a/b all mean RFC variant). v7's value is time ordering — as a database primary key it keeps B-tree inserts at the tail and avoids the page splits random v4 causes; the cost is leaking creation time down to the millisecond, so avoid v7 when the timeline must stay private. v4 randomness comes from crypto; the Math.random fallback only fires in very old environments and is not a cryptographically secure source for security-sensitive use.
How to Use
- Open the UUID Generator page
- Select the number of UUIDs to generate (1-1000)
- Click the Generate button or customize options (uppercase, hyphens, braces)
- Click the copy button next to any UUID or 'Copy All' to copy all results
Use Cases
- Database primary keys — Replace auto-increment IDs in distributed systems to avoid key collisions across shards or merge writes.
- API request IDs — Tag each HTTP request with a unique marker for logging, tracing, and distributed correlation.
- Frontend list keys — Assign keys to Vue/React list items that lack a stable ID, preventing unnecessary re-renders.
- File naming — Avoid name collisions during batch uploads or caching — UUID-named files virtually never clash.
- Session tokens — Combined with a signature, build unguessable session IDs or one-time tokens.
- Correlation identifiers — Assign unique IDs to log entries, trace spans, or events across microservices to correlate distributed activity.
- Database replication — Use UUIDs as primary keys in multi-master or offline-first databases to avoid conflicts when merging writes from different nodes.
FAQ
Can UUID v4 collide?
In theory yes, but the probability is negligible. UUID v4 has 122 random bits — generating 10 billion UUIDs gives roughly 50% chance of one collision. Treat it as never colliding in practice.
Are UUID and GUID the same?
Yes. GUID is Microsoft's name for UUID; the formats are identical and interchangeable.
Why does my UUID always start the 13th character with 4?
That digit encodes the UUID version, fixed to 4 for v4. If you need time-sortable IDs, try our ULID generator.
Is UUID safe to use as a secret key?
v4 was not designed for cryptography, but 122 bits of entropy exceeds typical session tokens. For higher security, use our Token Generator instead.
How can it generate UUIDs without a server?
The browser provides crypto.getRandomValues(), a cryptographically reviewed secure random source — equivalent in quality to a server's /dev/urandom.
Which should I choose, UUID v4 or v7?
Choose v4 for pure randomness when you want to avoid leaking generation time or need maximum library compatibility. Choose v7 when you want new records to naturally sort to the end of an index — its first 48 bits are a millisecond timestamp, so you can read creation time back from it. For high-throughput writes into B+Tree primary keys like InnoDB, v7's near-sequential values improve index locality and cut page splits, so many new projects prefer it. Both share the same canonical display format.
Is a UUID without hyphens still valid?
Yes. A UUID is fundamentally 128 bits of hex data; the hyphens are only a conventional formatting choice. Removing them yields a 32-character hex string that is the same identifier, and many databases store it in compact forms like BINARY(16). Any mismatch only matters if one layer expects one format and another expects the other — so keep ends consistent and reformat to 8-4-4-4-12 when an API or library requires the canonical shape.
Can UUIDv4 collide? How likely is it?
Collision is theoretically possible (122 random bits) but astronomically unlikely: after a billion UUIDs the chance is about one in a billion. Still add a unique constraint in the database — not because it will happen, but because the constraint costs far less than the "what if".