UUID Generator — Generate v1 and v4 UUIDs Instantly
Our free UUID generator creates version 1 and version 4 UUIDs instantly in your browser. Generate a single UUID or bulk generate up to 100 at once. Choose your preferred format — standard, uppercase, no hyphens, or with braces. Copy individual UUIDs, copy all at once, or download them as a text file.
What Is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit identifier standardized by the Open Software Foundation and defined in RFC 4122. It is represented as 32 hexadecimal characters displayed in five groups separated by hyphens, following the pattern 8-4-4-4-12:
Example: 550e8400-e29b-41d4-a716-446655440000
UUIDs are designed to be unique across space and time without requiring a central authority to coordinate assignment. This makes them ideal for distributed systems, databases, and any situation where globally unique identifiers are needed.
UUID Versions Explained
| Version | Generation Method | Use Case | Privacy |
|---|---|---|---|
| v1 | Timestamp + MAC address | Time-ordered records, logging | Low — reveals host and time |
| v2 | Timestamp + MAC + POSIX UID | DCE Security (rare) | Low — rarely used |
| v3 | MD5 hash of namespace + name | Name-based, reproducible | Medium — deterministic |
| v4 | Random numbers | General purpose, databases | High — no identifying info |
| v5 | SHA-1 hash of namespace + name | Name-based, reproducible | Medium — deterministic |
UUID v4 — The Most Common Choice
UUID v4 is the most widely used UUID version because it requires no coordination, contains no identifying information, and is effectively guaranteed to be unique. The format is:
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
Where x is any random hexadecimal digit, 4 is the version indicator, and y is one of 8, 9, a, or b (the variant indicator). With 122 bits of randomness, the probability of two v4 UUIDs colliding is so small it is effectively impossible in practice.
UUID Formats
| Format | Example | Used In |
|---|---|---|
| Standard (lowercase) | 550e8400-e29b-41d4-a716-446655440000 | Most systems, databases |
| Uppercase | 550E8400-E29B-41D4-A716-446655440000 | Windows, some enterprise systems |
| No hyphens | 550e8400e29b41d4a716446655440000 | URLs, compact storage |
| With braces | {550e8400-e29b-41d4-a716-446655440000} | Windows registry, COM objects |
| URN format | urn:uuid:550e8400-e29b-41d4-a716-446655440000 | XML, URN namespaces |
Common Uses for UUIDs in Software Development
Database Primary Keys
UUIDs are widely used as primary keys in relational databases like PostgreSQL, MySQL, and SQL Server. Unlike auto-incrementing integer IDs, UUID primary keys can be generated on the client side before inserting into the database, work across multiple database instances without coordination, and do not expose record counts or creation order to end users.
Distributed Systems
In microservices and distributed architectures, multiple services may create records independently. UUIDs allow each service to generate unique IDs without communicating with a central ID issuer, eliminating a potential bottleneck and single point of failure.
Session and Token Identifiers
UUIDs are used as session IDs, API tokens, request trace IDs, and correlation IDs in web applications. Their randomness makes them difficult to guess, adding a layer of security compared to sequential identifiers.
File and Asset Naming
Uploaded files, generated documents, and media assets are often renamed with UUIDs to prevent filename collisions and avoid exposing original filenames in public-facing URLs.
UUID vs Other ID Formats
| ID Type | Example | Length | Sortable | Collision Risk | Common Use |
|---|---|---|---|---|---|
| UUID v4 | 550e8400-e29b-41d4-a716-446655440000 | 36 chars | No | Negligible | General purpose |
| UUID v1 | 6ba7b810-9dad-11d1-80b4-00c04fd430c8 | 36 chars | Yes (time-ordered) | Negligible | Time-ordered records |
| ULID | 01ARZ3NDEKTSV4RRFFQ69G5FAV | 26 chars | Yes | Negligible | Sortable unique IDs |
| Nano ID | V1StGXR8_Z5jdHi6B-myT | 21 chars | No | Negligible | URLs, compact IDs |
| CUID | cjld2cyuq0000t3rmniod1foy | 25 chars | Yes | Negligible | Client-side generation |
| MongoDB ObjectId | 507f1f77bcf86cd799439011 | 24 chars | Yes | Negligible | MongoDB primary keys |
| Auto-increment int | 1, 2, 3... | Variable | Yes | None | Simple single-server DBs |
How do I generate a UUID in JavaScript?
Modern browsers and Node.js 15+ support the native crypto.randomUUID() method which generates a v4 UUID. For older environments, you can use a template replace on 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random() * 16 | 0; return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); }) .
How do I generate a UUID in Python?
Python's standard library includes the uuid module. Use import uuid and then uuid.uuid4() to generate a random v4 UUID. The result is a UUID object that can be converted to a string with str(uuid.uuid4()).
How do I generate a UUID in Java?
Java's standard library provides UUID generation through java.util.UUID. Use UUID.randomUUID() to generate a v4 UUID and UUID.randomUUID().toString() to get it as a string.
What happens if two UUIDs collide?
The theoretical probability of generating two identical v4 UUIDs is approximately 1 in 5.3 undecillion (5.3 × 10³⁶). In practice, even generating billions of UUIDs per second for millions of years would not produce a collision. UUID collisions can be treated as practically impossible.
Are UUIDs case sensitive?
UUID comparison is case-insensitive by the RFC 4122 standard — lowercase and uppercase representations of the same UUID are considered equal. However, most systems store and display them in lowercase by convention.
Tips and common mistakes
- Prefer v4 for public IDs — random UUIDs avoid leaking MAC addresses or timestamps (v1).
- Use v5 when you need stable IDs — same namespace + name always yields the same UUID.
- Index-friendly storage — UUID strings as primary keys fragment some databases; consider binary(16) columns.
- Do not rely on UUIDs for security — they are identifiers, not secrets; use crypto tokens for session keys.
More Q&A lives in the Frequently Asked Questions section below (matches FAQPage structured data).