DevLab
Encoding⭐ Popularbeginner

UUID Generator

generate UUID v4 identifiers in bulk, all client-side

By DevLab Editorial TeamLast updated

This tool generates UUID v4 identifiers in your browser using the Web Crypto API's crypto.randomUUID(). Generate 1, 5, 10, 25, or 100 UUIDs at once. Each UUID is a 128-bit random value in the standard 8-4-4-4-12 hex format. No server calls, no data sent anywhere.

Try it now — free, instant, no signup

What is UUID Generator?

A UUID (Universally Unique Identifier) is a 128-bit label standardized in RFC 4122 used to identify resources without a central coordinator. UUID v4 generates all 128 bits randomly (with 6 bits reserved for version and variant), giving a collision probability so low that generating a billion UUIDs per second for 100 years would have only a 50% chance of producing one collision.

The Web Crypto API's crypto.randomUUID() — available natively in all modern browsers and Node.js 14.17+ — uses a cryptographically secure pseudo-random number generator seeded by the OS entropy source. This makes it suitable for security-sensitive use cases like session tokens, not just database primary keys. The output is always lowercase and hyphen-separated.

UUID v7 (2022 draft RFC) addresses the main v4 weakness in database contexts: random UUIDs scatter B-tree indexes causing page splits at scale. v7 embeds a millisecond-precision Unix timestamp in the first 48 bits, so new UUIDs sort chronologically and insert at the end of the index. For new projects with millions of rows, v7 is better — but it requires a library since no browser API generates it natively.

When to use UUID Generator

Generate primary keys for database rows when you need IDs unique across distributed systems without a sequence table.
Create idempotency keys for API requests so that retried requests do not duplicate operations.
Generate bulk test UUIDs to seed a database fixture file or API mock before running integration tests.

Expert Notes

UUID v4 is the right default for most use cases, but think twice before using it as a clustered primary key in MySQL InnoDB — random inserts cause severe index fragmentation past a few million rows. For distributed systems, always generate UUIDs client-side rather than letting the database generate them — it lets you set the ID before the insert, enabling optimistic concurrency patterns.

DevLab's Take

The go-to tool for bulk UUID generation during database seeding, test fixture creation, or API key provisioning. The bulk mode (up to 100 at once) saves meaningful time compared to calling an endpoint repeatedly.

Frequently Asked Questions

Is UUID v4 safe to use as a primary key in PostgreSQL?
Yes for most workloads. PostgreSQL's uuid type stores UUIDs as 16 bytes and supports UUID-indexed columns efficiently. The concern is index fragmentation: v4 UUIDs insert randomly into the B-tree, causing more page splits than sequential integers. At under 10 million rows this is negligible; above that, consider UUID v7 (time-ordered) or gen_random_uuid() with a separate created_at index for range scans. Never store UUIDs as VARCHAR(36) — the uuid type is 2x more space-efficient.
What is the difference between UUID v4 and ULID?
Both are 128-bit unique identifiers, but ULID encodes a 48-bit millisecond timestamp in the first 10 characters, followed by 80 random bits, encoded in Crockford Base32. This makes ULIDs sortable by creation time and more database-friendly for indexed inserts. UUID v4 is purely random with no timestamp component. If you need sortable IDs in a modern system, ULID or UUID v7 are better choices than v4.
Can I use crypto.randomUUID() in Node.js?
Yes. crypto.randomUUID() is available on the crypto module in Node.js 14.17.0 and later, or via globalThis.crypto.randomUUID() in Node.js 19+. The browser Web Crypto API and Node.js crypto module both use OS-level entropy (/dev/urandom on Linux, CryptGenRandom on Windows) for cryptographically secure UUID generation.
Are UUIDs truly unique? What is the collision probability?
In practice, yes. A UUID v4 has 122 random bits. The probability of a duplicate in n UUIDs is approximately n squared divided by (2 times 2 to the power 122). To reach a 1% collision probability you would need to generate 2.6 times 10 to the 17th power UUIDs. At one billion per second, that would take over 8,000 years. UUID v4 collisions are not a practical concern for any real application.
What format is a UUID and can I use a shorter version?
Standard UUID format is 32 hex digits in 8-4-4-4-12 groups. Many systems store UUIDs without hyphens (32 chars), as Base64 (22 chars), or as a binary blob (16 bytes). For URL-safe compact IDs, Base64url-encoding the 16 raw bytes yields 22 characters. Libraries like nanoid generate shorter random IDs (21 chars by default) with comparable collision resistance if you prefer alphanumeric IDs.

Related Tools