UUID Generator

Generate cryptographically random UUID v4 identifiers instantly — single or bulk. All generated in your browser.

Count
Format

Frequently Asked Questions

A UUID (Universally Unique Identifier), also called a GUID, is a 128-bit label used to uniquely identify information across distributed systems. The standard format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx — 32 hex digits split into 5 groups by hyphens. Version 4 UUIDs are randomly generated (122 random bits), giving a collision probability so low it is considered practically impossible.
UUID version 4 is generated using a cryptographically secure random number generator. The version bits (4 in position 13) and the variant bits (8, 9, A, or B in position 17) are set deterministically; the remaining 122 bits are random. It is the most widely used UUID version for unique identifiers in databases, APIs, and file systems.
In theory yes, but the probability is astronomically small — approximately 1 in 5.3 × 10³⁶. To put it in perspective: you would need to generate 1 billion UUIDs per second for 85 years before the probability of a single collision reached 50%.
UUID v1 is time-based — it encodes the current timestamp and the MAC address of the generating machine. It is sortable by creation time, but leaks the machine's identity. UUID v4 is randomly generated using 122 bits of cryptographic randomness — the most widely used version. UUID v5 is name-based using SHA-1 — given the same namespace and name, it always produces the same UUID, making it deterministic and reproducible.
UUID v4 has 122 bits of randomness, giving 2122 (approximately 5.3 × 1036) possible values. To reach a 50% probability of a single collision, you would need to generate roughly 2.71 × 1018 UUIDs. Even generating one million UUIDs per second, it would take over 85 years to reach that number. For practical purposes, UUID v4 can be treated as globally unique without any coordination.
ULID (Universally Unique Lexicographically Sortable Identifier) encodes a 48-bit millisecond timestamp in the first 10 characters and 80 bits of randomness in the remaining 16, using Crockford's Base32 alphabet. This makes ULIDs sortable by creation time (important for database indexing performance) and URL-friendly. UUID v7, defined in RFC 9562, brings similar time-ordered properties to the UUID standard.
UUIDs as primary keys have real tradeoffs. Advantages: globally unique without coordination, safe for distributed systems, do not expose record counts or insertion order. Disadvantages: UUID v4 is random, causing index fragmentation in B-tree indexes, poor write performance at scale, and 4× larger than a 4-byte integer. Mitigations: use UUID v7 or ULID (time-ordered) to reduce fragmentation, or use a bigint auto-increment as the physical primary key with UUID as a separate unique column for external references.
The nil UUID is a special UUID where all 128 bits are set to zero: 00000000-0000-0000-0000-000000000000. It is defined in RFC 4122 as a sentinel value — guaranteed never to be generated as a real identifier. It is used in code to represent "no UUID" or an unset/null UUID value, similar to how null or 0 might be used for other types.
A UUID is 128 bits (16 bytes) displayed as 32 hexadecimal characters in 5 groups: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (8-4-4-4-12 characters). For UUID v4: the version nibble is the 13th character (always 4), and the variant bits are in the 17th character (always 8, 9, a, or b). The remaining 122 bits are random.
UUID generation is built into most modern languages: JavaScript: crypto.randomUUID(). PHP: Str::uuid() (Laravel) or \Ramsey\Uuid\Uuid::uuid4()->toString(). Python: import uuid; str(uuid.uuid4()). Go: uuid.New().String(). Java: UUID.randomUUID().toString(). C#: Guid.NewGuid().ToString(). Ruby: SecureRandom.uuid. All use a cryptographically secure random number generator.

About This UUID Generator

This free UUID generator creates version 4 (random) UUIDs using the Web Crypto API directly in your browser. Generate one or multiple UUIDs at once — no data is sent to a server.

When to use this tool

  • Generating unique IDs for new database records
  • Creating idempotency keys for API requests
  • Producing unique file or object storage names
  • Testing UUID-based systems with known random values

Related Articles

In-depth guides and technical articles.

View all →
The Real UUID Collision Risk Isn't Random — It's Container Snapshots and Broken Random Number Generators
UUID v4's random collision probability is negligibly small — the real risk is deterministic duplicates from containers cloned from the same snapshot sharing PRNG state, language-level UUID libraries using Math.random() instead of CSPRNG, or UUID v1's clock sequence exhaustion when clocks go backwards repeatedly. Here's the container snapshot duplicate problem, the seeding vulnerabilities by language runtime, and why a unique constraint on UUID primary keys is essential defensive programming.
Reading a UUID: What the Hex Characters Actually Encode — and Why v1 Exposes Your Server's MAC Address
A UUID looks random but encodes information depending on its version: v1 embeds the creation timestamp and the generating machine's MAC address (recoverable by anyone who sees the UUID); v4 is genuinely random (122 random bits); v5 is deterministically computed from a namespace and name; v7 is timestamp-ordered with random low bits. Here's what each segment of a UUID actually contains, why v1 is a privacy risk in public-facing contexts, and when UUIDs shouldn't be used as security tokens.
UUID Primary Keys in PostgreSQL, MySQL, and MongoDB: Performance Differences and Implementation Patterns
PostgreSQL stores UUIDs as 16-byte native types with no performance penalty. MySQL's InnoDB clustered index makes random UUID v4 fragmentation far worse than in PostgreSQL. MongoDB's ObjectId is 12 bytes with an embedded timestamp. Here's how UUID primary keys actually behave in each database and the ORM patterns to use them correctly.
Beyond UUID: How Twitter's Snowflake IDs, ULID, CUID2, and Nano ID Work
Twitter, Discord, and Instagram all built custom ID systems because UUID couldn't handle time-sortability, distributed generation, and 64-bit constraints simultaneously. Here's how Snowflake IDs work, what ULID and CUID2 offer, and when each alternative makes sense.
UUID v1, v4, v5, v7 Compared — Which Version Should You Actually Use?
UUID v1, v3, v4, v5, and v7 all work differently and suit different use cases. Here's when to use each — including why v7 is now the recommended choice for database primary keys.