UseToolSuite UseToolSuite

UUID Generator

Generate UUID v1, v4, v7 or ULID in bulk. Includes the v7-vs-ULID comparison — string length, database type support, and same-millisecond ordering.

The version landscape in two minutes

VersionSource of uniquenessSortableNotes
v1Timestamp + MAC addressPartlyLeaks machine identity; legacy
v4122 random bitsNoThe general-purpose default
v5SHA-1 of namespace + nameNoDeterministic — same input, same UUID
v7Timestamp + randomYesBest for DB keys (RFC 9562)

v5 deserves more fame: when you need the same identifier every time for the same input — deduplicating imported records, stable IDs derived from URLs — a name-based UUID does it without coordination or storage.

Collision math, concretely

A v4 UUID has 122 random bits. Generating one billion UUIDs per second continuously, you’d expect roughly 85 years before a 50% chance of a single collision. The practical engineering consequence: generate freely on clients, in parallel, across services, without coordination — and treat any “duplicate UUID” bug as what it actually is, a code path reusing a value or a faulty random source, never genuine bad luck.

Storage and indexing done right

Store UUIDs in native types, not strings: PostgreSQL’s uuid type and MySQL’s BINARY(16) use 16 bytes, while a VARCHAR(36) burns 37+ bytes and compares slower. With random v4 keys on large, write-heavy tables, expect index page splits and cache misses — the problem v7’s time-ordering exists to solve. If you’re stuck on v4 for compatibility, MySQL 8’s UUID_TO_BIN(uuid, 1) swaps the time-ish bits to fake locality for v1; for v4 there is no such trick, so consider v7 before scaling pain arrives.

UUIDs vs the short-ID alternatives

NanoID and ULID solve adjacent problems: NanoID gives URL-friendly 21-character IDs with comparable entropy, ULID gives sortable 26-character Crockford-base32 IDs (essentially v7’s idea with a different alphabet). Choose UUID when you want the universally understood standard with native database and language support everywhere; choose the alternatives when ID aesthetics in URLs matter more than ecosystem ubiquity.

v7 or ULID? The decision most generators don’t let you make

This is the one comparison worth having, and you can only have it if a tool emits both — so here it is with the numbers, since this generator produces either.

Both are 128 bits. Both put a 48-bit Unix-millisecond timestamp at the front, which is what makes them sort chronologically as plain strings. Everything else differs:

UUIDv7ULID
SpecRFC 9562 (2024)Community spec, no RFC
Canonical string36 chars, hex + 4 hyphens26 chars, Crockford Base32
Bits after the timestamp74 random (split by version/variant fields)80 random
Alphabet0-9a-f0-9A-Z minus I, L, O, U
Same-millisecond orderingOptional — RFC 9562 describes methods, implementations varyRequired — increment the random field
Native database typeYes: Postgres uuid, MySQL BINARY(16)No — stored as CHAR(26) or converted

Three consequences that actually decide it:

  • Storage. UUIDv7 drops into a 16-byte uuid column. ULID has no native type, so you either store 26 characters of text or convert to 16 bytes on the way in and back on the way out — which means every query, migration and ad-hoc psql session needs the conversion too.
  • Ordering within a millisecond. ULID guarantees a monotonic sequence when two IDs are generated in the same millisecond. UUIDv7 leaves that to the implementation. If you are relying on ID order to reconstruct insert order at high write rates, check what your library actually does before assuming it.
  • Reading them out loud. Crockford’s alphabet drops I, L, O and U precisely so 1/I and 0/O can’t be confused, and so the encoding can’t spell unfortunate words. If IDs appear in support tickets or get read over a phone, that is not a cosmetic detail.

The short version: UUIDv7 if the ID lives in a database column, because the native type and the ecosystem carry real weight. ULID if the ID lives in a URL or a log line a human has to read or retype.

Last updated

How helpful was this tool?

Click to rate

Embed this tool on your site

Paste this snippet into any HTML page or blog post to embed a live, fully working copy of UUID Generator. Free for any use.

Key Concepts

GUID (Globally Unique Identifier)

Microsoft's term for UUID. GUIDs and UUIDs are functionally identical — both are 128-bit identifiers following the same RFC 4122 specification. The term GUID is predominantly used in Microsoft technologies (.NET, SQL Server, COM), while UUID is the platform-neutral term used everywhere else.

CSPRNG

Cryptographically Secure Pseudo-Random Number Generator — an algorithm that produces random numbers suitable for security-sensitive operations. Unlike Math.random() which uses a predictable PRNG, CSPRNG (accessed via crypto.getRandomValues in browsers) sources entropy from the operating system and produces output that is computationally infeasible to predict.

Frequently Asked Questions

Are the generated UUIDs truly random and unique?

Yes. The generator uses the Web Crypto API (crypto.getRandomValues), which provides cryptographically secure random numbers. The probability of generating a duplicate UUID v4 is astronomically low — approximately 1 in 5.3 x 10^36.

What is the difference between UUID v1 and UUID v4?

UUID v1 is based on the timestamp and MAC address of the generating machine, while UUID v4 is entirely random. This tool generates UUID v4, which is the most commonly used version because it does not leak any information about the generating system.

Can I generate UUIDs without hyphens?

Yes. The tool offers an option to generate UUIDs without hyphens, producing a 32-character hexadecimal string. This format is useful when UUIDs are used as database keys or in systems that do not accept hyphens.

How many UUIDs can I generate at once?

The bulk generation feature lets you generate multiple UUIDs at once. Since everything runs in your browser, you can generate hundreds of UUIDs instantly without any server requests or rate limits.

What is UUID v7 and when should I prefer it over v4?

UUID v7 (RFC 9562, 2024) embeds a millisecond timestamp in the high bits, so values generated over time sort chronologically. That makes it the better choice for database primary keys: new rows append to the end of the index instead of landing at random pages, which keeps B-tree indexes compact and inserts fast. Use v4 when you explicitly don't want IDs to reveal creation order.

Should I use UUIDs or auto-increment integers as primary keys?

Auto-increment is smaller (8 bytes vs 16), faster to index, and human-friendly — ideal within a single database. UUIDs win when IDs are generated on clients or across services before reaching the database, when merging data from multiple sources, and when you don't want IDs to be guessable or to leak row counts. Many systems use both: an internal integer key plus a public UUID.

Troubleshooting & Technical Tips

UUID v4 collision probability: Risk of duplicate IDs

UUID v4 contains 122 bits of random data and can produce a total of 5.3 × 10^36 unique values. To experience a collision, you would need to generate 1 billion UUIDs per second for 100 years — this probability is practically zero. However, if Math.random() is used instead of crypto.getRandomValues(), the PRNG (Pseudo-Random Number Generator) weakness dramatically increases the collision risk. This tool uses CSPRNG (Cryptographically Secure PRNG) to ensure true randomness.

UUID format error: Database says "invalid input syntax for type uuid"

The UUID format follows an 8-4-4-4-12 hexadecimal character structure (e.g., 550e8400-e29b-41d4-a716-446655440000). PostgreSQL, MySQL, and other databases strictly adhere to this format. If you are using hyphen-free UUIDs, check whether your database accepts that format. PostgreSQL's uuid type only accepts the hyphenated format. This tool can generate UUIDs in both formats.

UUID sorting issue: Poor database index performance

Since UUID v4 is completely random, it can cause page splits and fragmentation in B-tree index structures, which degrades INSERT performance. For high-traffic systems, consider UUID v7 (time-ordered) or ULID (Universally Unique Lexicographically Sortable Identifier) as alternatives — these provide time-based ordering and improve index performance. For standard UUID v4 needs, this tool provides fast and reliable generation.

Related Guides

Related Tools