UUID Generator
Generates cryptographically secure UUIDs — random v4 or time-ordered v7. Uses the browser's Web Crypto API; no value is sent to a server.
Last updated:
Generated UUIDs
Press "Generate".
Count must be between 1 and 100.
When a UUID is the right tool
Minting IDs before the server sees them
Offline-first apps and optimistic UIs need a primary key at the moment the user acts, not after a round-trip. Client-generated UUIDs make the local record and the eventual server record the same record.
Choosing a key strategy for insert-heavy tables
The v4-versus-v7 decision is mostly an index decision. The worked example below shows what the v7 timestamp actually looks like on the wire and why a B-tree loves it.
Correlating one request across many services
A request ID generated at the edge and logged by every downstream service turns a scattered failure into a single grep. UUIDs fit because any service can mint one without asking anyone.
Worked example: reading the clock inside a v7
A v7 is not opaque: its first 48 bits are a plain Unix millisecond timestamp. You can decode one by hand.
- Take the instant 2025-08-08 10:46:40 UTC, which is 1754650000000 in epoch milliseconds.
- In hexadecimal, 1754650000000 is 0x198894a3a80; padded to 48 bits: 0198894a3a80.
- Every v7 minted at that millisecond therefore starts 0198894a-3a80-7xxx-…
- Lexicographic order equals chronological order, so a B-tree index appends at the end instead of splitting pages.
- The remaining 74 random bits keep values minted within the same millisecond distinct.
The property that makes v7 index-friendly is also a disclosure: anyone holding the ID can read its creation time back out, exactly as done above. For internal keys that is irrelevant. For public identifiers that must not reveal when an account or order came into existence, v4 remains the right default.
Four mistakes worth avoiding
Truncating a UUID for readability
The first group is 8 hex characters, only 32 bits. By the birthday bound, collisions reach a coin flip at roughly 77,000 values — trivially reachable in any real dataset. Shorten for display if you like, but never for the key.
Treating any UUID as a security token
A crypto-random v4 is unguessable, but that is a property of the generator, not the format: v1 embedded MAC addresses, v7 embeds time, and some libraries default to weak randomness. Password-reset and session tokens deserve a purpose-built generator, not whatever UUID happens to be around.
Expecting global ordering from v7
v7 is monotonic per generator. Two servers with slightly skewed clocks will interleave out of order, so "sort by ID" is not "sort by true event time" across a fleet. For audit-grade ordering keep an authoritative timestamp column.
Mixing braces, case and hyphens across systems
{B85CF32F-…} in one store and b85cf32f-… in another is the same identity that no string comparison will ever match. Normalise at the boundary or store the 16 raw bytes and format only on output.
Tools commonly used alongside this one
- Hash Generator (SHA) Compute SHA-1, SHA-256, SHA-384 and SHA-512 digests of text instantly. Via the Web Crypto API, in the browser.
- Base64 Encoder-Decoder Encode text to Base64 or decode it back. Standard and URL-safe (base64url) variants; UTF-8 aware, in the browser.
- CIDR / Subnet Calculator Compute the network address, broadcast, subnet mask, usable host range and address type from CIDR notation.
- Cron Expression Parser Parse a cron expression field by field and see the next run times. For Kubernetes CronJobs and scheduled tasks.
- Epoch / Unix Timestamp Converter Convert Unix epoch timestamps to readable dates and back. Seconds and milliseconds are auto-detected.
Frequently Asked Questions
What is a UUID v4?
A UUID v4 is a 128-bit identifier with 122 randomly generated bits. It is unique without a central authority and is ideal for database primary keys, session IDs and file names. The collision probability is negligible in practice.
What is the difference between v4 and v7?
v4 is fully random; the generated values are not ordered. v7 carries a Unix millisecond timestamp in its first 48 bits — it is time-ordered. That makes v7 far more efficient as a database primary key: index fragmentation drops and inserts stay sequential.
Are these UUIDs generated securely?
Yes. The randomness comes from the browser's crypto.getRandomValues / crypto.randomUUID API, a cryptographically secure source. No predictable generator such as Math.random is used, and no value is sent to a server.
What is the collision probability of two UUIDs?
A v4 has 122 bits of randomness. You would need to generate billions of UUIDs to see a collision — across 103 trillion UUIDs the collision chance is about one in a billion. In practical systems collisions are ignored.
How do I generate a UUID in .NET?
In .NET, Guid.NewGuid() produces a random v4-like GUID. With .NET 9+, Guid.CreateVersion7() produces a time-ordered v7 — preferred as a primary key for insert-heavy tables.