UUID Generator
Generate UUIDs (v4) online. Create single or bulk universally unique identifiers instantly for development and testing.
What Is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit identifier standardized by RFC 4122 (and updated by RFC 9562). It is displayed as 32 hexadecimal characters arranged in five groups separated by hyphens, following the pattern 8-4-4-4-12:
550e8400-e29b-41d4-a716-446655440000
UUIDs are designed to be globally unique without requiring a central coordination authority. Any system, anywhere, can generate a UUID and be virtually certain that no other system has ever generated — or ever will generate — the same value. This property makes UUIDs ideal for distributed systems, database primary keys, session identifiers, file names, and any context where uniqueness must be guaranteed without coordination.
The most common variant is UUID version 4 (v4), which generates identifiers from a cryptographically secure random number generator. A v4 UUID has 122 random bits, yielding 2^122 (approximately 5.3 x 10^36) possible values. The probability of generating two identical v4 UUIDs is so astronomically low that it is considered negligible for all practical purposes.
How It Works
Our UUID generator uses the browser's crypto.randomUUID() API, which is part of the Web Crypto API available in all modern browsers. This function produces RFC 4122 version 4 UUIDs using a cryptographically secure pseudorandom number generator (CSPRNG) provided by the operating system.
The generation process:
- Request random bytes. The browser's crypto module generates 16 random bytes (128 bits) from the OS-level CSPRNG.
- Set version bits. Bits 48-51 are set to
0100to indicate version 4. - Set variant bits. Bits 64-65 are set to
10to indicate the RFC 4122 variant. - Format the output. The 16 bytes are converted to 32 hexadecimal characters and formatted with hyphens in the standard
8-4-4-4-12pattern.
You can generate a single UUID or bulk-generate up to 100 at once. All generation happens in the browser — no server communication is involved.
Common Use Cases
1. Database Primary Keys
UUIDs are widely used as primary keys in relational and NoSQL databases. Unlike auto-incrementing integers, UUIDs can be generated client-side before the database insert, enabling offline-first applications, client-generated IDs for optimistic updates, and distributed database systems where multiple nodes generate IDs independently.
INSERT INTO users (id, name, email)
VALUES ('f47ac10b-58cc-4372-a567-0e02b2c3d479', 'Alice', 'alice@example.com');
2. Session and Request Identifiers
Web applications use UUIDs to identify user sessions, API requests, and correlation IDs for distributed tracing. A UUID-based request ID attached to every log entry across multiple microservices makes it possible to trace a single request through the entire system.
3. File and Resource Naming
When generating unique file names for uploads, temporary files, or cached resources, UUIDs prevent naming collisions without requiring a central naming authority. This is especially important in distributed file storage systems.
4. Testing and Seeding
During testing, developers need deterministic-looking but unique identifiers for test fixtures, mock data, and seed databases. Bulk-generating UUIDs provides a quick supply of unique IDs for these purposes.
5. API Resource Identifiers
RESTful APIs often use UUIDs as resource identifiers in URLs: /api/users/f47ac10b-58cc-4372-a567-0e02b2c3d479. UUIDs are preferred over sequential integers because they do not reveal the total number of resources or the order of creation, providing a small measure of security through obscurity.
Tips and Best Practices
- Use UUID v4 for general-purpose IDs. Version 4 is the most widely supported and understood variant. Unless you have a specific need for time-ordered IDs (consider UUID v7 or ULID), v4 is the safe default.
- Store as binary in databases. A UUID string is 36 characters but only 16 bytes of actual data. Most databases support storing UUIDs as 16-byte binary values, which saves 56% storage and improves index performance. PostgreSQL has a native
uuidtype; MySQL hasUUID_TO_BIN()andBIN_TO_UUID()functions. - Consider the indexing cost. UUID v4 values are random, so inserts into a B-tree index land in random positions, causing page splits and fragmentation at high write volumes. For high-throughput write workloads, consider time-ordered alternatives like UUID v7 or ULID.
- Do not use UUIDs as security tokens. UUIDs are unique but not secret. They are generated from random numbers, but they are not designed to be unpredictable in a cryptographic sense. Use proper tokens (JWTs, CSRF tokens, API keys) for security purposes.
- Bulk generate for batch operations. When seeding a database or creating test fixtures, use the bulk generation feature to create multiple UUIDs at once rather than generating them one at a time.
FAQ
What version of UUID does it generate?
Version 4 (random), which is the most commonly used variant for general-purpose unique identifiers. The version is indicated by the first character of the third group (always 4).
Can I generate multiple UUIDs at once?
Yes. Set the count (1-100) and click Generate to create multiple UUIDs simultaneously. This is useful for seeding databases, creating test fixtures, or preparing batch operations.
Are the UUIDs cryptographically secure?
Yes. The crypto.randomUUID() API uses the operating system's cryptographically secure random number generator, which is the same source used for TLS session keys and other security-critical values.
Can I copy all UUIDs at once?
Yes. Use the "Copy all" button to copy all generated UUIDs to your clipboard, one per line. This is convenient for pasting into database queries, configuration files, or test data.
Will two people ever generate the same UUID?
The probability is vanishingly small. With 2^122 possible v4 UUIDs, you would need to generate approximately 2.71 x 10^18 UUIDs before there is a 50% chance of a single collision. At a rate of one billion UUIDs per second, it would take about 85 years to reach that point.
Are UUIDs the same as GUIDs?
Yes. GUID (Globally Unique Identifier) is Microsoft's term for the same concept. UUID and GUID refer to the same 128-bit identifier format and are interchangeable.
Should I include hyphens?
The standard representation includes hyphens (8-4-4-4-12 format). Some systems accept UUIDs with or without hyphens. For consistency, always use the hyphenated form unless a specific system requires otherwise.