UUID Generator Online | UUID v4 & v7 RFC 9562 Batch Export

Encoding
100% client-side. Processed locally in your browser using the Web Crypto API. Nothing is sent to any server.

How It Works

UUIDs are not secrets. UUIDs are globally unique identifiers, not security tokens. Do not use UUIDs as API keys, session tokens, or passwords. For cryptographic secrets, use the Random Byte Generator.

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

VersionEntropyTimestampSortableBest for
UUID v4122 bits randomNoneNoGeneral-purpose, non-ordered IDs
UUID v774 bits random + 48-bit timestampUnix msYesDatabase 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

Using UUIDs as security tokens. UUIDs are unique identifiers, not secrets. Do not use them as API keys, session tokens, or passwords. For cryptographic secrets, use the Random Byte Generator.
Using Math.random() for UUID generation. Math.random() is predictable and not cryptographically secure. Always use crypto.getRandomValues() or equivalent CSPRNG for UUID generation.
Assuming UUID v4 is time-ordered. UUID v4 is purely random — newer UUIDs do not sort after older ones. Use UUID v7 if you need chronological ordering.
Collision probability misunderstanding. UUID v4 has 122 bits of entropy — collision probability is negligible (1 in 2^61 for 1 billion UUIDs). But if you need absolute uniqueness guarantees, consider UUID v7 with timestamp ordering.
Not validating UUID format. Always check version and variant bits to ensure RFC 9562 compliance. Invalid UUIDs can cause database errors or security issues.

Security Notes

Use cryptographically secure randomness. This tool uses Web Crypto API's crypto.getRandomValues() — a CSPRNG seeded from OS entropy. Never use Math.random() for security contexts.
UUID v7 for database keys. Time-ordered UUIDs improve B-tree index performance by reducing page splits. Newer UUIDs sort after older ones, maintaining insertion order.
UUID v4 collision resistance. With 122 bits of entropy, you would need to generate ~2^61 UUIDs to have a 50% chance of a single collision — practically impossible.
Timestamp extraction for v7. UUID v7 embeds a 48-bit Unix millisecond timestamp. The built-in validator extracts and displays it in both ISO and Unix-ms format.

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

Related Concepts

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