UUID Generator Complete Guide 2026 — Create UUID v4, GUID Online Free
Table of Contents
What is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit number used to uniquely identify information in computer systems. The term is part of the Distributed Computing Environment (DCE) standardized by the Open Software Foundation (OSF).
UUIDs are designed to be unique across both space and time — meaning two UUIDs generated anywhere in the world, at different times, by different people, using different algorithms, will practically never be the same.
UUIDs are standardized by RFC 4122 (ISO/IEC 9834-8:2005), which defines the format, versions, and generation methods. This standardization ensures UUIDs work consistently across all platforms and programming languages.
Why UUIDs Matter
In modern software development, UUIDs solve several critical problems:
- Distributed Systems: No central coordination needed to generate unique IDs
- Security: Harder to guess than sequential integers
- Offline Generation: Create IDs without database connectivity
- Data Merging: Combine databases without ID conflicts
- Privacy: Don't reveal business metrics (like order volume)
UUID Format and Structure
A UUID is represented as a 32-character hexadecimal string displayed in 5 groups separated by hyphens, in the form 8-4-4-4-12, for a total of 36 characters (32 alphanumeric + 4 hyphens).
123e4567-e89b-12d3-a456-426614174000
│ │ │ │ └───────────── Node (48 bits)
│ │ │ └────────────────── Clock Sequence (12 bits)
│ │ └─────────────────────── Time High & Version (16 bits)
│ └──────────────────────────── Time Mid (32 bits)
└──────────────────────────────────── Time Low (32 bits)
Breaking Down the Structure
| Field | Bits | Hex Characters | Description |
|---|---|---|---|
| time_low | 32 | 8 | Low 32 bits of timestamp |
| time_mid | 16 | 4 | Middle 16 bits of timestamp |
| time_hi_and_version | 16 | 4 | High 16 bits with version number |
| clock_seq_hi_and_reserved | 8 | 2 | Clock sequence with variant |
| clock_seq_low | 8 | 2 | Low 8 bits of clock sequence |
| node | 48 | 12 | Spatially unique identifier (MAC address or random) |
Variant Bits
The variant field determines the layout of the UUID. The most common variant (RFC 4122) is indicated by having the most significant bits set to 10 in the clock_seq_hi_and_reserved field.
Variant bits: 10xx xxxx
Common values: 8, 9, a, b (in hexadecimal)
UUID Versions Explained
RFC 4122 defines five UUID versions, each with different generation methods and use cases. Understanding these versions helps you choose the right one for your application.
UUID Version 1 (Time-based)
Generated using timestamp and MAC address.
Example: 550e8400-e29b-11d4-a716-446655440000
| Aspect | Details |
|---|---|
| Generation Method | Current timestamp + MAC address |
| Sortable | Yes (by time) |
| Uniqueness Source | Time + hardware address |
| Privacy | Poor (exposes MAC and timestamp) |
Use v1 when you need time-sortable UUIDs and don't mind exposing generation time. Good for audit logs or event streams where chronological ordering matters.
UUID Version 2 (DCE Security)
Similar to v1 but includes POSIX UID/GID. Rarely used in practice.
Example: Reserved for DCE security applications
UUID Version 3 (Name-based with MD5)
Generated from a namespace identifier and a name using MD5 hashing.
Example: 6fa459ea-ee8a-3ca4-894e-db77e160355e (for "example.com" in DNS namespace)
| Aspect | Details |
|---|---|
| Generation Method | MD5 hash of namespace + name |
| Deterministic | Yes (same input = same UUID) |
| Security | Weak (MD5 is cryptographically broken) |
UUID Version 4 (Random) — Most Popular
Generated using random or pseudo-random numbers. This is the most commonly used version.
Example: f47ac10b-58cc-4372-a567-0e02b2c3d479
| Aspect | Details |
|---|---|
| Generation Method | 122 random bits |
| Sortable | No |
| Privacy | Excellent (no identifiable info) |
| Collision Risk | Negligible (2^122 possibilities) |
- Database primary keys in distributed systems
- Session tokens and temporary identifiers
- File naming to prevent enumeration attacks
- API request IDs for tracing
- Any scenario requiring unpredictable uniqueness
UUID Version 5 (Name-based with SHA-1)
Similar to v3 but uses SHA-1 instead of MD5, providing better security.
Example: 886313e1-3b8a-5372-9b90-0c9aee199e5d (for "example.com" in DNS namespace)
You can identify the UUID version by looking at the 13th character (first character of the third group):
1= Version 1 (time-based)3= Version 3 (MD5 name-based)4= Version 4 (random)5= Version 5 (SHA-1 name-based)
UUID vs GUID: What's the Difference?
This is one of the most common questions developers have. The short answer: they're the same thing with different names.
| Aspect | UUID | GUID |
|---|---|---|
| Full Name | Universally Unique Identifier | Globally Unique Identifier |
| Origin | Open Software Foundation (OSF) | Microsoft |
| Standard | RFC 4122 / ISO/IEC 9834-8 | Microsoft implementation of RFC 4122 |
| Format | 8-4-4-4-12 hex | 8-4-4-4-12 hex |
| Size | 128 bits | 128 bits |
Bottom line: You can use these terms interchangeably. A UUID generated on Linux works perfectly in a Windows/.NET environment expecting a GUID.
When to Use UUIDs
UUIDs shine in specific scenarios. Here's when to reach for them and when to consider alternatives.
✅ Great Use Cases for UUIDs
1. Database Primary Keys in Distributed Systems
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email VARCHAR(255) NOT NULL UNIQUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Insert without worrying about ID conflicts
INSERT INTO users (email) VALUES ('[email protected]');
Benefits:
- No auto-increment conflicts across shards
- Can generate IDs offline before inserting
- Merging databases doesn't cause ID collisions
- Harder for attackers to enumerate records
2. Session and Access Tokens
// Generate session ID
const sessionId = crypto.randomUUID();
// "36b8f84d-df4e-4d49-b662-bcde71a8764f"
// Store in cookie or database
document.cookie = `session=${sessionId}; HttpOnly; Secure`;
3. File and Asset Naming
uploads/f47ac10b-58cc-4372-a567-0e02b2c3d479.pdf
avatars/a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11.jpg
Benefits:
- Prevents filename conflicts
- Stops attackers from guessing file URLs
- No need for complex deduplication logic
4. API Request Tracing
{
"request_id": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2026-03-10T12:00:00Z",
"endpoint": "/api/users",
"data": { ... }
}
Benefits:
- Track requests across microservices
- Debug distributed transactions
- Correlate logs from multiple services
5. Offline-First Applications
Mobile apps that sync when online can generate UUIDs locally without conflicts.
❌ When NOT to Use UUIDs
1. When You Need Human-Readable IDs
Customers prefer order #12345 over order #f47ac10b-58cc-4372-a567-0e02b2c3d479.
2. When Index Size Matters
UUIDs are 16 bytes vs 4 bytes for INT or 8 bytes for BIGINT. On tables with billions of rows, this adds up.
3. When You Need Sequential Ordering
UUID v4 is random, so it doesn't preserve insertion order. Use v1 or auto-increment instead.
4. When Performance is Critical
UUID indexes can be slower than sequential integer indexes due to random I/O patterns.
UUID Collision Probability
One of the most common concerns about UUIDs is: "What if two UUIDs are the same?" Let's examine the math.
The Birthday Paradox and UUIDs
For UUID v4, there are 2122 possible values (approximately 5.3 × 1036). Using the birthday paradox formula, we can calculate collision probabilities:
| UUIDs Generated | Collision Probability | Perspective |
|---|---|---|
| 1,000 (1 thousand) | 1 in 1031 | Essentially zero |
| 1,000,000 (1 million) | 1 in 1025 | Still negligible |
| 1,000,000,000 (1 billion) | 1 in 1019 | Less than winning Powerball |
| 1,000,000,000,000 (1 trillion) | 1 in 1013 | Rarer than asteroid impact |
| 2.71 × 1018 (1 billion per second for 85 years) | 50% | First 50% collision point |
You're more likely to:
- Win the Powerball jackpot twice in a row
- Be struck by lightning 10 times in your lifetime
- Be attacked by a shark AND win the lottery
How to Generate UUIDs Online
Need UUIDs fast? Online generators are the quickest option — no installation, no dependencies.
Using DevKits UUID Generator
Our free UUID Generator creates RFC 4122 compliant UUIDs instantly:
- Visit the Tool — Navigate to DevKits UUID Generator
- Choose Version — Select UUID v4 (most common) or other versions
- Set Quantity — Generate 1 UUID or batch generate up to 1000
- Click Generate — Get instant UUIDs
- Copy or Download — Copy to clipboard or download as text file
Example Output
550e8400-e29b-41d4-a716-446655440000
6ba7b810-9dad-11d1-80b4-00c04fd430c8
f47ac10b-58cc-4372-a567-0e02b2c3d479
a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
36b8f84d-df4e-4d49-b662-bcde71a8764f
Features of a Good UUID Generator
- ✅ RFC 4122 compliant format
- ✅ Client-side generation (no data sent to server)
- ✅ Bulk generation capability
- ✅ Copy to clipboard functionality
- ✅ Download as file option
- ✅ No signup or installation required
- ✅ Works offline (PWA enabled)
Generating UUIDs in Code
Most modern programming languages have built-in UUID support. Here's how to generate UUIDs in popular languages.
JavaScript (Browser)
// Modern browsers (Chrome 92+, Firefox 95+, Safari 15.4+)
const uuid = crypto.randomUUID();
console.log(uuid); // "36b8f84d-df4e-4d49-b662-bcde71a8764f"
// Older browsers - use UUID library
// npm install uuid
import { v4 as uuidv4 } from 'uuid';
const id = uuidv4();
Node.js
// Built-in in Node.js 14.17+ and 15.6+
const { randomUUID } = require('crypto');
const id = randomUUID();
// Or use the uuid package
const { v4: uuidv4 } = require('uuid');
const id = uuidv4();
Python
import uuid
# UUID v4 (random)
uuid4 = uuid.uuid4()
print(uuid4) # f47ac10b-58cc-4372-a567-0e02b2c3d479
# UUID v1 (time-based)
uuid1 = uuid.uuid1()
print(uuid1) # 550e8400-e29b-11d4-a716-446655440000
# UUID v5 (name-based with SHA-1)
uuid5 = uuid.uuid5(uuid.NAMESPACE_DNS, 'example.com')
print(uuid5) # 886313e1-3b8a-5372-9b90-0c9aee199e5d
PHP
// PHP 7.4+
$uuid = uuid_create(UUID_TYPE_RANDOM);
echo $uuid; // f47ac10b-58cc-4372-a567-0e02b2c3d479
// Using ramsey/uuid package (recommended)
use Ramsey\Uuid\Uuid;
$uuid = Uuid::uuid4()->toString();
Java
import java.util.UUID;
// UUID v4 (random)
UUID uuid = UUID.randomUUID();
String id = uuid.toString();
// UUID v5 (requires external library)
// using uuid-generator library
C# / .NET
using System;
// Guid is .NET's implementation of UUID
Guid guid = Guid.NewGuid();
Console.WriteLine(guid); // f47ac10b-58cc-4372-a567-0e02b2c3d479
// Parse from string
Guid parsed = Guid.Parse("f47ac10b-58cc-4372-a567-0e02b2c3d479");
Go
package main
import (
"fmt"
"github.com/google/uuid"
)
func main() {
id := uuid.New()
fmt.Println(id) // f47ac10b-58cc-4372-a567-0e02b2c3d479
// UUID v1
id1, _ := uuid.NewUUID()
// UUID v4
id4 := uuid.New()
}
Ruby
require 'securerandom'
# UUID v4
uuid = SecureRandom.uuid
puts uuid # f47ac10b-58cc-4372-a567-0e02b2c3d479
Rust
use uuid::Uuid;
fn main() {
// UUID v4
let uuid = Uuid::new_v4();
println!("{}", uuid);
// UUID v7 (time-based, newer standard)
let uuid_v7 = Uuid::now_v7();
}
UUIDs as Database Primary Keys
Using UUIDs as primary keys is a common pattern in modern applications. Let's explore the trade-offs.
PostgreSQL
-- Enable UUID extension
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
-- Table with UUID primary key
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Insert
INSERT INTO users (email) VALUES ('[email protected]');
-- Query
SELECT * FROM users WHERE id = '550e8400-e29b-41d4-a716-446655440000';
MySQL
CREATE TABLE users (
id CHAR(36) PRIMARY KEY DEFAULT (UUID()),
email VARCHAR(255) NOT NULL
);
-- Or use BINARY(16) for storage efficiency
CREATE TABLE users (
id BINARY(16) PRIMARY KEY DEFAULT (UUID_TO_BIN(UUID())),
email VARCHAR(255) NOT NULL
);
SQLite
CREATE TABLE users (
id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))
INSERT(
INSERT(
INSERT(
INSERT(hex(randomblob(16)), 9, 0, '-'),
14, 0, '-'),
19, 0, '-'),
24, 0, '-')),
email TEXT NOT NULL
);
MongoDB
// MongoDB uses ObjectId by default (similar concept)
// But you can use UUIDs
const { UUID } = require('mongodb');
db.users.insertOne({
_id: UUID(),
email: '[email protected]'
});
Storage Comparison
| ID Type | Storage Size | Index Efficiency | Best For |
|---|---|---|---|
| INT (auto-inc) | 4 bytes | Excellent | Single database, small tables |
| BIGINT (auto-inc) | 8 bytes | Excellent | Large tables, single database |
| UUID (text) | 36 bytes | Good | Readability, debugging |
| UUID (binary) | 16 bytes | Good | Production, distributed systems |
UUID Best Practices
Follow these guidelines when working with UUIDs:
1. Use Binary Storage When Possible
-- Better: Store as binary
CREATE TABLE users (id BINARY(16) PRIMARY KEY);
-- Worse: Store as string
CREATE TABLE users (id VARCHAR(36) PRIMARY KEY);
Binary storage saves 20 bytes per UUID (56% reduction).
2. Consider UUID v7 for Time-Sortable Random UUIDs
UUID v7 (draft RFC) combines the benefits of v1 (sortable) and v4 (random):
// UUID v7 = 48-bit timestamp + 74-bit random
// Sortable AND unpredictable
3. Validate UUID Input
// Validate UUID format
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
function isValidUUID(uuid) {
return uuidRegex.test(uuid);
}
4. Don't Use UUIDs as Security Tokens
UUIDs are for uniqueness, not security. Don't use them as:
- Password reset tokens (use crypto-secure random)
- API keys (use dedicated key generation)
- Session secrets (use frameworks' built-in solutions)
5. Log UUIDs for Tracing
const requestId = crypto.randomUUID();
logger.info('Request started', { requestId, endpoint: '/api/users' });
// Use requestId throughout the request lifecycle
Best UUID Generator Tools
Here's a comparison of popular UUID generation options:
| Tool | Type | Versions | Best For |
|---|---|---|---|
| DevKits UUID Generator | Online | v4 | Quick generation, bulk export |
| uuidgen (CLI) | Command line | v1, v4 | Shell scripts, automation |
| crypto.randomUUID() (JS) | Built-in API | v4 | Browser/Node.js apps |
| Python uuid module | Standard library | v1, v3, v4, v5 | Python applications |
Frequently Asked Questions
Q: Are UUIDs truly unique?
A: UUIDs are "practically" unique. The probability of collision is so astronomically low (1 in 5.3 × 1036 for v4) that it's negligible for all real-world applications. You could generate 1 billion UUIDs per second for 100 years and still have less than a 50% chance of a single collision.
Q: Can UUIDs be guessed or predicted?
A: UUID v4 uses 122 random bits, making it computationally infeasible to guess. However, UUID v1 exposes timestamp and MAC address, making it predictable. Always use v4 when unpredictability matters.
Q: What's the difference between UUID and GUID?
A: They're the same thing. UUID is the open standard (RFC 4122), while GUID is Microsoft's implementation. Both use the same 128-bit format and are fully interchangeable.
Q: Can I use UUIDs as primary keys in databases?
A: Yes! UUIDs work well as primary keys, especially in distributed systems. Consider using binary storage (16 bytes) instead of text (36 bytes) for better performance. PostgreSQL and MySQL both support UUID natively.
Q: How many UUIDs can be generated before collision?
A: With UUID v4's 2122 possibilities, you'd need to generate approximately 2.71 × 1018 UUIDs (that's 2.71 quintillion) to reach a 50% collision probability. At 1 billion UUIDs per second, that's 85 years of continuous generation.
Q: Why do UUIDs have hyphens?
A: Hyphens improve readability and make it easier to identify the UUID version at a glance. They're part of the RFC 4122 specification. You can remove them for storage efficiency if needed.
Q: Is there a UUID v6 or v7?
A: Yes! UUID v6 is a rearranged version of v1 for better database locality. UUID v7 (currently draft) uses a Unix timestamp plus random data, providing both sortability and unpredictability. These are newer standards gaining adoption.
Q: Can I convert a UUID to a number?
A: Technically yes (it's a 128-bit number), but most programming languages don't support 128-bit integers natively. It's better to keep UUIDs as strings or binary data.
Conclusion
A UUID generator is an essential tool for developers working with distributed systems, databases, or any application requiring unique identifiers. Whether you're generating primary keys, session tokens, or file identifiers, UUIDs provide a standardized, reliable solution.
Key takeaways:
- UUIDs are 128-bit globally unique identifiers standardized by RFC 4122
- Version 4 (random) is the most commonly used and recommended for most applications
- Collision probability is practically zero for any real-world use case
- UUIDs excel in distributed systems, offline scenarios, and security-conscious applications
- Consider binary storage for production databases to save space
Need UUIDs now? Generate them instantly with our free UUID Generator — RFC 4122 compliant, client-side, no signup required.
Generate UUIDs Free →Try This Tool Free
DevKits offers UUID generation 100% free, no signup required:
- ✅ Runs entirely in your browser (client-side)
- ✅ No data is sent to servers (privacy-first)
- ✅ Works offline (PWA enabled)
- ✅ No usage limits
- ✅ RFC 4122 compliant UUIDs
- ✅ Bulk generation up to 1000 UUIDs