UUID Generator Comparison: v1 vs v4 vs v7

Updated 2026-08-31 · 3 min read

Which UUID version should you generate?

A UUID is a 128-bit identifier written as 36 characters, for example 3f2504e0-4f89-41d3-9a0c-0305e82c3301. All versions share that shape, but they differ in how the bits are filled — and that decides whether your identifiers are random, sortable, or leak information about the machine that created them.

For nearly all application code the answer is v4 (fully random) or v7 (time-ordered). Choose v4 when the identifier is public and must reveal nothing. Choose v7 when the identifier is a database primary key and you care about index locality and chronological sorting.

Version comparison table

The practical differences that matter when picking a generator:

Practical example: UUIDs as primary keys

Say you are creating an orders table and want IDs that are safe to expose in a URL. With random v4 keys, every insert lands at a random point in the index, which fragments pages and slows writes on large tables. With v7 keys, inserts append near the end and range scans by time become cheap.

A concrete pair generated for this example — note the shared prefix on the v7 values, which is exactly what makes them sortable:

Generating them in code

In modern browsers and Node.js, crypto.randomUUID() returns a v4 UUID with no dependency. In PostgreSQL, gen_random_uuid() does the same server-side, so a column can default to it. For v7 you currently need a small library (for example uuid v10+ with uuidv7()) or a SQL function, because it is newer than most built-ins.

Store UUIDs in a native uuid column, never as varchar(36): the binary form is 16 bytes instead of 36 and compares far faster.

How online UUID generators differ

Most 'UUID generator' pages fall into three groups. Server-side generators build the value on their backend, which means the identifier travelled the network before you used it. Ad-heavy generators wrap a one-line call in trackers. Client-side generators run crypto.randomUUID() in your own tab, so the value never leaves your machine.

When you are generating a key that will protect a resource, the third group is the only defensible choice — and it is also the fastest, since there is no round trip.

Are collisions a real risk?

For v4, no. There are 2^122 possible values; you would need to generate roughly 2.6 × 10^18 UUIDs before a 50% chance of a single collision. The realistic failure mode is not mathematics but a weak random source — a generator falling back to Math.random() instead of the cryptographic API. That is why the implementation matters more than the version.

Generate UUIDs now

Use the UUID Generator to create single or bulk UUIDs in your browser, then validate their shape with the Regex Tester or hash them with the Hash Generator if you need a shorter derived key.

Try the UUID Generator →Generate random UUID v4 (GUID) values in bulk — lowercase, uppercase, or without dashes. Free online UUID generator using the Web Crypto API.

Frequently asked questions

Is UUID v7 production ready?

Yes — it is standardised in RFC 9562 and supported by mainstream libraries. Only some databases still lack a built-in function.

Can I shorten a UUID?

You can base64url- or base32-encode the 16 bytes to get a 22–26 character string, but keep the canonical form in storage so tooling still recognises it.

Should UUIDs be uppercase or lowercase?

Lowercase is the canonical output. Parsers accept both, but mixing cases breaks naive string comparisons.

Are online UUID generators safe?

Only if they generate in your browser with the Web Crypto API. Anything produced on someone else's server should not be used as a secret.

More guides

How Many Words Is a 5-Minute Speech?A 5-minute speech is roughly 625–750 words at a normal speaking pace. See word counts for 1, 3, 5, 10 and 20-minute talks, plus how to check yours instantly.How to Validate JSON and Fix Common Syntax ErrorsLearn how to validate JSON and fix the most common errors: trailing commas, single quotes, unquoted keys, comments and unescaped characters — with examples.Base64 Is Not Encryption: What It Actually DoesBase64 is reversible encoding, not encryption. Learn what Base64 is for, when to use it, its 33% size cost, and safe alternatives for protecting data.How to Decode a JWT SafelyLearn what is inside a JSON Web Token, how to decode the header and payload, how to read exp and iat claims, and why decoding is not verification.