Free UUID & GUID Generator (Version 4)
Generate random version 4 UUIDs, from 1 to 500 at a time. Choose uppercase or lowercase formatting, hyphens, braces, and quotes.
How to Use UUID / GUID Generator?
Set Quantity & Options
Choose quantity (1 to 500) and customize uppercase, hyphens, braces, or quotes.
Generate
Your browser's Web Crypto API creates random version 4 UUIDs.
Copy or Download
Click "Copy All" to copy to clipboard or export directly as a .txt file.
What is a UUID (Universally Unique Identifier)?
A UUID (Universally Unique Identifier), commonly referred to as a GUID (Globally Unique Identifier) in Microsoft ecosystems, is a standardized 128-bit numerical label used to uniquely identify records, entities, and transactions across computer systems without requiring a central registration authority or coordination mechanism. First formalized under RFC 4122 and updated under the modern RFC 9562 specification (published in May 2024), UUIDs enable distributed architectures, microservices, and offline-first mobile applications to generate guaranteed collision-resistant keys autonomously.
In its standard string representation, a UUID consists of 32 hexadecimal characters (digits 0-9 and letters a-f) grouped into five sections separated by hyphens, following an 8-4-4-4-12 layout, totaling 36 characters (e.g., f47ac10b-58cc-4372-a567-0e02b2c3d479).
Anatomy of a Version-4 UUID (RFC 9562)
A Version-4 UUID is primarily constructed from cryptographically secure pseudorandom numbers (CSPRNG), dedicating 122 of its 128 bits to pure randomness. The remaining 6 bits are strictly reserved to encode the version and the specification variant:
Random entropy
Random entropy
Starts with '4'
Starts with 8, 9, a, or b
Random entropy
In character position 15 (the first digit of the third group), the hex character is always fixed to 4, indicating UUID Version 4. In character position 20 (the first digit of the fourth group), the most significant two bits are set to binary 10, limiting the character to 8, 9, a, or b, representing the RFC variant layout.
UUID Versions: Complete Architectural Comparison
The IETF standard defines multiple versions of UUIDs, each optimized for different data engineering paradigms. The table below outlines how each version operates:
| Version | Generation Basis | Sorting Nature | Entropy | Recommended Use Case |
|---|---|---|---|---|
| UUID v1 | 60-bit timestamp + 48-bit MAC address | Semi-sequential | Clock sequence | Legacy systems; not recommended (leaks device hardware MAC address). |
| UUID v3 | Namespace UUID + MD5 text hash | Non-sequential | Deterministic | Deterministic ID mapping; superseded by v5 due to MD5 hash collisions. |
| UUID v4 | Cryptographically secure pseudorandom bits | Non-sequential (Random) | 122 bits | General-purpose distributed unique ID, API keys, transaction IDs. |
| UUID v5 | Namespace UUID + SHA-1 text hash | Non-sequential | Deterministic | Consistent cross-system idempotent entity mapping from strings. |
| UUID v7 | Unix Epoch (ms) + CSPRNG random bits | Time-ordered (Monotonic) | 74 bits | Modern database primary keys (MySQL, PostgreSQL, MongoDB, SQLite). |
Mathematical Collision Probability (The Birthday Paradox)
One of the most frequent engineering questions regarding Version-4 UUIDs is: "Can two independently generated UUID v4 IDs ever be identical?"
With 122 bits of unconstrained randomness, the total address space of possible UUID v4 identifiers is 2122, which equates to approximately 5,316,911,983,139,663,491,615,158,247,813,840,000 (5.31 × 1036) unique values.
Applying the classical Birthday Paradox formula for collision probability (where k is the count of generated IDs and N is the total pool size 2122):
- To reach a 50% probability of a single collision across the globe, humanity would need to generate approximately 2.71 quintillion (2.71 × 1018) UUIDs.
- If you generated 1 billion UUIDs per second continuously for 100 years, the probability of encountering even a single collision remains under 0.00000000006%.
- To experience a modest 1-in-a-billion (10-9) chance of collision, your application database would have to accumulate 103 trillion generated keys.
Consequently, for virtually all computing environments, UUID v4 collisions are practically non-existent, eliminating the need to lock databases to confirm uniqueness before inserting records.
UUID vs. GUID: What is the Real Difference?
Many developers wonder whether a GUID is distinct from a UUID. In practical software development, UUID and GUID are interchangeable terms for the same 128-bit concept:
- GUID (Globally Unique Identifier): Originated by Microsoft in the early 1990s as part of the Component Object Model (COM) and Object Linking and Embedding (OLE) architecture, later adopted across the .NET runtime and Windows operating system APIs.
- UUID (Universally Unique Identifier): The formal international open standard designated by the Open Software Foundation (OSF), ISO/IEC 11578:1996, and the IETF standards track (RFC 4122 and RFC 9562).
Both share the identical byte order, bit length, and textual representation. Whether you call it a GUID or a UUID, the 36-character hyphenated output will validate across all standard parser libraries.
Generating UUID v4 in Popular Programming Languages
Every major modern programming runtime incorporates built-in primitives to produce cryptographically compliant RFC Version-4 UUIDs:
JavaScript / TypeScript (Browser & Node.js)
Modern browsers and Node.js v15.6+ provide native hardware-accelerated CSPRNG through the Web Crypto standard:
// Native Web Crypto API (Browser & Node.js 19+)
const id = crypto.randomUUID();
console.log(id); // Output: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"Python 3
Python's built-in standard library requires zero third-party package installations:
import uuid
# Generate a cryptographically random UUID v4
unique_id = uuid.uuid4()
print(str(unique_id)) # Output: 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
print(unique_id.hex) # 32-character string without hyphensPHP 8
PHP 8 provides cryptographically secure random bytes natively via random_bytes():
function generateUuidV4(): string {
$data = random_bytes(16);
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set variant to 10
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}
echo generateUuidV4();PostgreSQL
PostgreSQL has first-class native support for UUID data types with hardware-optimized indexing:
-- Built-in function in PostgreSQL 13+ (no extensions required)
SELECT gen_random_uuid();
-- Table primary key definition
CREATE TABLE app_users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email VARCHAR(255) NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW()
);Database Indexing Best Practices: UUID v4 vs. UUID v7
While UUID v4 is exceptional for distributed uniqueness, storing raw random UUIDs as primary keys in traditional relational databases (like MySQL InnoDB or SQLite) introduces a well-documented performance challenge known as B-Tree index fragmentation:
- The Random Insert Penalty: In InnoDB, table rows are physically ordered on disk by their clustered primary key. Because UUID v4 values are entirely random, each new record is inserted into a random memory page in the B+Tree. Once a page fills up, InnoDB is forced to perform an expensive page split, reallocating disk clusters and reducing cache memory locality.
- Storage Footprint: Storing UUIDs as formatted strings (
VARCHAR(36)) requires 36 bytes per record plus secondary index overhead. By contrast, converting UUIDs to raw binary (BINARY(16)in MySQL or nativeUUIDin PostgreSQL) halves storage to just 16 bytes. - The Modern Solution (UUID v7): Published in RFC 9562, UUID Version 7 combines a 48-bit millisecond-precision Unix timestamp prefix with random entropy. This ensures that generated IDs are chronologically monotonic, inserting gracefully at the end of the B+Tree index with high write throughput comparable to traditional auto-increment integers.
Frequently Asked Questions
Can two UUID v4 identifiers ever collide in real-world systems?
While mathematically possible, a collision in UUID v4 is practically impossible. A version 4 UUID contains 122 bits of cryptographically secure pseudorandom entropy, representing approximately 5.31 × 1036 possible identifiers. According to the Birthday Paradox formula, you would need to generate over 103 trillion UUIDs before reaching a 1-in-a-billion chance of a single collision.
What is the difference between a UUID and a GUID?
Functionally, UUID (Universally Unique Identifier) and GUID (Globally Unique Identifier) refer to the exact same 128-bit hexadecimal identifier structure. GUID is Microsoft's implementation terminology originally introduced in COM and Windows APIs, while UUID is the official IETF open standard defined in RFC 4122 and RFC 9562.
Why is UUID v7 replacing UUID v4 in modern database architectures?
UUID v4 values are entirely random, which causes severe B-Tree page splits and fragmented indexes in clustered storage engines like MySQL InnoDB and SQLite. UUID v7 (RFC 9562) solves this by prefixing the identifier with a millisecond-precision Unix timestamp followed by random bits, ensuring chronological sorting and superior database write performance.
How is a Version-4 UUID constructed according to RFC 9562?
A UUID v4 consists of 32 hexadecimal digits separated by hyphens into five groups: 8-4-4-4-12. Bits 48 through 51 in the third group are always fixed to hex '4' to designate version 4, and the two most significant bits in the fourth group are set to binary '10' (yielding hex 8, 9, a, or b) to indicate the RFC variant.
Is it safe to use UUID v4 for sensitive authentication tokens or session IDs?
No. While UUID v4 uses 122 bits of cryptographic randomness via CSPRNG, UUIDs are intended as entity identity labels rather than secret bearer tokens. For cryptographic authentication, session IDs, or password reset tokens, use purpose-built cryptographic random strings of at least 256 bits or signed JWTs.
Does this online generator transmit my UUIDs to a remote server?
No. All UUIDs generated by AioGalaxy WebTools are created 100% locally in your browser memory using the native Web Crypto API (crypto.randomUUID or crypto.getRandomValues). Zero data is sent across the internet, ensuring complete privacy for development and production credentials.
How should I store UUIDs in PostgreSQL and MySQL databases for best performance?
In PostgreSQL, always use the native UUID column type, which stores the value in 16 binary bytes and supports indexing natively. In MySQL, avoid 36-character VARCHAR(36); instead, store UUIDs as BINARY(16) using UNHEX(REPLACE(uuid, '-', '')) or MySQL 8.0's built-in UUID_TO_BIN(uuid, 1) to conserve disk space and cache memory.
What is the difference between UUID version 3 and version 5?
Both UUID v3 and UUID v5 are deterministic name-based identifiers generated by hashing a namespace UUID combined with a text name. The difference is the hashing algorithm: UUID v3 uses MD5, which is cryptographically deprecated, while UUID v5 uses SHA-1. For all non-deterministic requirements, UUID v4 or v7 is recommended.