UUID Generator Online | UUID v4 & v7 RFC 9562 Batch Export
Encoding How It Works
What Is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit identifier designed to be globally unique across space and time. UUID v4 uses 122 bits of cryptographic randomness, while UUID v7 embeds a 48-bit Unix timestamp plus 74 random bits. Both follow RFC 9562 (2024), which supersedes the older RFC 4122.
When to Use UUIDs
- Database primary keys — UUID v7 is time-ordered, making B-tree indexes efficient without sequential patterns
- Distributed systems — generate unique IDs across multiple nodes without coordination
- API resource identifiers — use UUIDs in URLs to avoid exposing sequential database IDs
- File naming — generate unique filenames to avoid collisions in shared storage
- Session identifiers — use UUID v4 for session tokens (but pair with authentication)
- Event sourcing — UUID v7 provides both uniqueness and chronological ordering for event logs
UUID Version Comparison
| Version | Entropy | Timestamp | Sortable | Best for |
|---|---|---|---|---|
| UUID v4 | 122 bits random | None | No | General-purpose, non-ordered IDs |
| UUID v7 | 74 bits random + 48-bit timestamp | Unix ms | Yes | Database keys, time-ordered IDs |
Standards Compliance
- RFC 9562 — Universally Unique IDentifiers (UUIDs), published May 2024
- RFC 4122 — Original UUID specification (superseded by RFC 9562)
- Web Crypto API — uses
crypto.getRandomValues()for CSPRNG-based UUID generation - ISO/IEC 9834-8 — International standard for UUID generation
Last updated:
Code Examples
JavaScript (Browser — Web Crypto API)
// UUID v4 (random)
function uuidv4() {
const bytes = crypto.getRandomValues(new Uint8Array(16));
bytes[6] = (bytes[6] & 0x0f) | 0x40; // version 4
bytes[8] = (bytes[8] & 0x3f) | 0x80; // variant RFC 4122
const hex = Array.from(bytes)
.map(b => b.toString(16).padStart(2, '0')).join('');
return hex.slice(0,8) + '-' + hex.slice(8,12) + '-' +
hex.slice(12,16) + '-' + hex.slice(16,20) + '-' + hex.slice(20);
}
console.log(uuidv4()); Python
import uuid
# UUID v4 (random)
u4 = uuid.uuid4()
print(f'v4: {u4}')
# UUID v7 (time-ordered, Python 3.12+)
u7 = uuid.uuid7()
print(f'v7: {u7}')
print(f'Timestamp: {u7.timestamp}') # Unix ms Go
package main
import (
"fmt"
"github.com/google/uuid"
)
func main() {
// UUID v4
u4 := uuid.New()
fmt.Println("v4:", u4)
// UUID v7 (time-ordered)
u7, _ := uuid.NewV7()
fmt.Println("v7:", u7)
} Rust
use uuid::Uuid;
fn main() {
// UUID v4 (random)
let u4 = Uuid::new_v4();
println!("v4: {}", u4);
// UUID v7 (time-ordered)
let u7 = Uuid::now_v7();
println!("v7: {}", u7);
} Node.js
const { v4, v7 } = require('uuid');
// UUID v4
console.log('v4:', v4());
// UUID v7 (time-ordered)
console.log('v7:', v7()); Common Pitfalls
Security Notes
Disclaimer
This tool is provided for educational and development purposes. UUID generation follows RFC 9562 standards. For production systems, always validate UUID format and version before use. All generation occurs entirely in your browser using the Web Crypto API.
Further Reading
- RFC 9562 — Universally Unique IDentifiers (UUIDs)
- RFC 4122 — Original UUID Specification
- MDN — crypto.getRandomValues()
- Wikipedia — UUID
Related Concepts
- Random Byte Generator — Cryptographic Secrets
- Base64 Encode/Decode — Binary-to-Text Encoding
- Key Management — Secure ID Generation
- UUID Generator
Related Tools
Need to encode/decode Base64? Try the Base64 Encode/Decode tool. For hex conversion, see the Hex/Text Converter. To explore classical cipher encoding, use the Classical Ciphers Toolkit.
Frequently Asked Questions
What is the difference between UUID v4 and v7?
UUID v4 is purely random (122 bits of entropy) and has no ordering. UUID v7 embeds a 48-bit Unix timestamp in the first bits, making it sortable by creation time while still providing 74 bits of randomness. Use v7 for database primary keys and v4 when ordering doesn't matter.
Is UUID v7 a standard?
UUID v7 is defined in RFC 9562 (published May 2024), which also covers UUID v6 and v8. It was designed as a modern replacement for v4 in systems that benefit from time-ordered identifiers like database indexes.
How does batch generation work?
Batch generation creates multiple UUIDs at once (1-1000). You can specify the exact count, and all generated UUIDs will use the same version and format settings. A "Copy All" button lets you copy the entire batch to clipboard at once.
What does the UUID validator show?
The validator checks if a UUID string is valid and displays detailed information: version number (v4/v7), variant type (RFC 4122 standard), and for v7 UUIDs, it extracts and displays the embedded timestamp in both ISO format and Unix milliseconds.
Why use UUID v7 for database primary keys?
UUID v7 is time-ordered, meaning newer UUIDs sort after older ones. This makes B-tree indexes more efficient and reduces page splits. It also allows rough chronological ordering without separate timestamp columns, while maintaining global uniqueness.
Privacy: This tool runs entirely in your browser — nothing is uploaded or stored. · Disclaimer: For educational purposes only. Not professional security advice.
More in Encoding
Base64 Encode/Decode
Encode text to Base64 or decode Base64 strings online. Standard and URL-safe variants, hex output, real-time conversion.
Hex/Text Cipher Converter
Convert between hex, plain text, binary, and Uint8Array online. Configurable hex output with separator and case options.
Classical Ciphers Toolkit
Encode, decode, and break classical ciphers online: Caesar, Vigenère, Atbash, Rail Fence. Frequency analysis, chi-squared brute force, auto key recovery.