UUID Generator

Generate random UUID v4 identifiers.

Bulk Generate

What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit identifier standardized by RFC 4122. UUIDs are designed to be unique across all devices, databases, and time without requiring a central authority to issue them. This makes them ideal for distributed systems where coordination between nodes is impractical.

Version 4 UUIDs are the most commonly used type. They are generated using random or pseudo-random numbers, with 122 bits of randomness giving approximately 5.3 x 1036 possible values. The probability of generating two identical UUID v4 values is so small that it is considered practically impossible.

Format:

xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

4 = version indicator, y = variant (8, 9, a, or b)

UUID Versions Compared

Version Based On Use Case
v1Timestamp + MACTime-ordered, reveals hardware
v4RandomGeneral purpose (most common)
v5SHA-1 hashDeterministic from namespace + name
v7Timestamp + randomSortable, database-friendly

Common Use Cases

How to Use This Tool

  1. 1. Generate a single UUID - Click "Generate New UUID" to create a fresh random UUID v4
  2. 2. Copy it - Click "Copy" to copy the UUID to your clipboard
  3. 3. Bulk generate - Enter a count (1-100) and click "Generate" to create multiple UUIDs at once
  4. 4. Copy all - Click "Copy All" to copy all generated UUIDs, one per line

Code Examples

JavaScript (Node.js)
// Node.js (built-in since v14.17)
import { randomUUID } from 'crypto';
const uuid = randomUUID();
// e.g. "550e8400-e29b-41d4-a716-446655440000"

// Browser (modern)
const uuid = crypto.randomUUID();

// Manual implementation (older environments)
function uuidv4() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
    /[xy]/g, c => {
      const r = Math.random() * 16 | 0;
      return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
    }
  );
}
Python
import uuid

# Generate UUID v4 (random)
id = uuid.uuid4()
print(id)  # e.g. 550e8400-e29b-41d4-a716-446655440000

# Generate UUID v5 (deterministic)
id = uuid.uuid5(uuid.NAMESPACE_DNS, "example.com")

# Convert to string without hyphens
print(id.hex)  # "550e8400e29b41d4a716446655440000"
Go
package main

import (
    "fmt"
    "github.com/google/uuid"
)

func main() {
    // Generate UUID v4
    id := uuid.New()
    fmt.Println(id.String())

    // Parse a UUID string
    parsed, err := uuid.Parse("550e8400-e29b-41d4-a716-446655440000")
    if err != nil {
        panic(err)
    }
    fmt.Println(parsed.Version()) // 4
}
Bash / CLI
# Linux
cat /proc/sys/kernel/random/uuid

# macOS
uuidgen | tr '[:upper:]' '[:lower:]'

# Using Python one-liner
python3 -c "import uuid; print(uuid.uuid4())"

Frequently Asked Questions

What is a UUID and why should I use one?
A UUID (Universally Unique Identifier) is a 128-bit value that can be generated independently on any machine without coordination. UUIDs are the standard solution when you need a unique identifier but cannot rely on a centralized ID generation service. They are widely used as database primary keys, API request identifiers, session tokens, and file naming schemes across distributed systems.
Can two UUID v4 values collide?
Theoretically yes, but practically no. UUID v4 uses 122 random bits, giving 5.3 x 1036 possible values. To have a 50% chance of a single collision, you would need to generate approximately 2.71 quintillion (2.71 x 1018) UUIDs. At a rate of one billion UUIDs per second, this would take about 86 years. For any real-world application, UUID v4 collisions are not a concern.
UUID vs ULID vs nanoid - which should I use?
UUID v4 is the industry standard and has the widest ecosystem support. Use it when interoperability matters. ULID (Universally Unique Lexicographically Sortable Identifier) combines a timestamp with randomness, making it sortable and database-friendly. nanoid is a smaller, URL-safe alternative (21 characters vs 36 for UUID) but is not standardized. For new projects where database sort order matters, consider UUID v7 or ULID. For everything else, UUID v4 is the safe default.
Are UUIDs good for database primary keys?
UUIDs work well as primary keys in distributed systems, but random UUID v4 can cause B-tree index fragmentation in traditional databases like PostgreSQL and MySQL because inserts are scattered across the index. For better performance, consider UUID v7 (time-ordered random UUIDs) or store UUIDs as binary(16) instead of varchar(36). PostgreSQL has a native uuid type that stores them efficiently as 16 bytes.

Related Tools

Monitor your APIs and services

Building distributed systems with UUIDs? Make sure your services stay up. UptimeSignal monitors your endpoints and alerts you the moment something goes down.

Start monitoring free →

25 monitors free. No credit card required.