UUID Generator

What Is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit identifier designed to be globally unique without a central authority. Formatted as 32 hex digits in a 8-4-4-4-12 pattern (like 550e8400-e29b-41d4-a716-446655440000), UUIDs are used as database primary keys, session tokens, file names, API identifiers, and distributed system IDs.

UUID Versions

v1 — based on timestamp + MAC address. Sortable by time but reveals device identity. v4 — fully random. Most commonly used. No external state needed. v5 — deterministic hash from a namespace + name. Same inputs always produce the same UUID. v7 (newest) — timestamp-ordered random UUID. Sortable like v1 but without revealing device info.

How to Use This UUID Generator

  1. Click Generate — Click the generate button to create a new UUID instantly. Each one is cryptographically random and globally unique.
  2. Choose the version — Select UUID v4 (random, most common), v1 (timestamp-based), or other versions depending on your requirements.
  3. Copy the UUID — Click Copy to grab the UUID in standard format (8-4-4-4-12 hex digits separated by hyphens).
  4. Generate in bulk — Need multiple UUIDs? Set the quantity and generate a batch of unique identifiers at once.

Worked example: reading a version 4 UUID

This tool fills 16 bytes from the browser's cryptographic random generator (crypto.getRandomValues), then overwrites 6 bits exactly as RFC 9562 §5.4 prescribes: 4 bits for the version and 2 for the variant. That leaves 122 random bits. Take 2b248e95-304c-4e31-8fc2-faa3aaf56bae:

PositionIn the exampleMeaning
Characters 1-12 and 18-36 (except the next two)2b248e95-304c … 8fc2-faa3aaf56baeRandom bits
Character 15 (first of the third group)4Version: always 4 for a random UUID
Character 20 (first of the fourth group)8Variant: always 8, 9, a or b (binary 10xx)

So you can recognise a v4 UUID at a glance: a 4 at the start of the third group, and 8, 9, a or b at the start of the fourth. If either is different, the ID came from another version or a home-grown generator.

How unlikely is a duplicate? With 122 random bits there are 2122 (about 5.3 × 1036) possible values. The birthday bound puts a 50% chance of one collision at about 2.71 × 1018 UUIDs. For an ID that also sorts by creation time, which helps database index locality, RFC 9562 defines version 7: a 48-bit Unix timestamp in milliseconds followed by random bits. This tool generates v4 only.

Sources, checked October 11, 2026: RFC 9562 §5.4 (UUID Version 4) and §5.7 (Version 7); collision figure computed with the birthday approximation √(2 ln 2 · 2122).

Frequently Asked Questions

What is a UUID?
A 128-bit identifier formatted as 32 hex digits (8-4-4-4-12). Designed to be globally unique without a central authority — collision probability is astronomically small.
What is UUID v4?
V4 generates IDs using random numbers — 122 of 128 bits are random. The most commonly used version because it requires no external state or coordination.
UUID vs auto-increment IDs?
Use UUIDs for distributed systems, client-side generation, or when sequential IDs would expose system information. Use auto-increment for simple single-database apps.
What is the difference between UUID v1 and v4?+
UUID v1 uses the current timestamp and the machine's MAC address to generate a unique ID — it's sortable by time but can reveal the generating machine's identity. UUID v4 uses random data for all bits (except the version and variant markers), making it the most commonly used version for privacy and simplicity.
Can UUID collisions happen?+
Theoretically yes, practically no. UUID v4 has 2^122 possible values (about 5.3 × 10^36). The probability of generating two identical UUIDs is astronomically low — you'd need to generate a billion UUIDs per second for about 85 years to have a 50% chance of one collision.
When should I use UUIDs vs auto-increment IDs?+
Use UUIDs when you need globally unique IDs across distributed systems, when IDs must be generated client-side, or when sequential IDs would expose information about your system. Use auto-increment IDs for simple single-database applications where sequential ordering is useful.
Are UUIDs safe to use as URL slugs?+
Functionally yes — UUIDs are URL-safe by default (hex digits plus hyphens) and they prevent enumeration attacks that auto-incrementing IDs invite. The downside is length: 36 characters per slug makes URLs ugly and harder to share verbally. A common pattern is to use UUIDs as the underlying primary key and a separate human-readable slug (post title, friendly ID) for the URL itself.
How do I generate a UUID in JavaScript without a library?+
Modern browsers and Node 19+ ship crypto.randomUUID(), which returns a v4 UUID and works in every evergreen browser. If you need to support older environments, the four-line fallback using crypto.getRandomValues and the v4 bit pattern is the standard replacement — avoid Math.random based implementations because they are not cryptographically random and can produce collisions in tight loops.

📖 Learn More

Related Article How to Generate UUIDs in JavaScript →

Built by Derek Giordano · Part of Ultimate Design Tools

Privacy Policy · Terms of Service