Click Generate to create a UUID
// click UUID to copy · uses crypto.randomUUID()
Count:
Case:
Braces:
// bulk uuids
Click "Generate Bulk" to generate multiple UUIDs

UUID v4 Anatomy

550e8400-e29b-41d4-a716-446655440000
32-bit time_low field
16-bit time_mid field
Version (4) + 12-bit random
Variant bits + 14-bit random
48-bit random node

About UUID v4

UUID (Universally Unique Identifier) v4 uses random numbers to ensure uniqueness. With 122 random bits, the probability of collision is astronomically low — you'd need to generate 1 billion UUIDs per second for 85 years to have a 50% chance of a single collision.


Common uses:

What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit identifier standardised as RFC 4122. It is represented as 32 hexadecimal characters in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx — always 36 characters including the four hyphens.

UUIDs are designed to be generated independently by any system, at any time, without coordination — and still be unique across the entire world. This makes them ideal for distributed systems, databases, and APIs where a central ID-issuing authority is impractical.

UUID versions compared — v1, v4, v5, v7

There are multiple UUID versions, each generated differently. Here's when to use each:

VersionHow generatedSortableBest for
v1Timestamp + MAC addressYesTime-ordered logs, legacy systems. Exposes MAC address — privacy risk.
v3MD5 hash of namespace + nameNoDeterministic IDs from a known name. Deprecated — use v5 instead.
v4Fully random (122 bits)NoMost use cases — databases, APIs, tokens. Private and collision-resistant.
v5SHA-1 hash of namespace + nameNoReproducible IDs from the same input (e.g. URL → UUID).
v7Unix timestamp + randomYesModern replacement for v1. Time-sortable without exposing MAC address.

This tool generates UUID v4 — the most widely supported version, used by default in PostgreSQL, MySQL, MongoDB, and all major languages.

Generate a UUID in code

Need UUIDs in your project rather than via the browser? Here are the one-liners for every common language:

JavaScript / Node.js
// Browser and Node.js 19+ (no library needed)
const id = crypto.randomUUID();
// → "110e8400-e29b-41d4-a716-446655440000"

// Node.js (older versions)
const { v4: uuidv4 } = require('uuid');
const id = uuidv4();
Python
import uuid

# UUID v4 with hyphens
id = str(uuid.uuid4())
# → "550e8400-e29b-41d4-a716-446655440000"

# UUID v4 without hyphens (32 hex chars)
id_clean = uuid.uuid4().hex
Terminal (Linux / macOS)
# macOS
uuidgen | tr '[:upper:]' '[:lower:]'

# Linux
cat /proc/sys/kernel/random/uuid
SQL — PostgreSQL
-- Enable extension once
CREATE EXTENSION IF NOT EXISTS "pgcrypto";

-- Generate UUID v4
SELECT gen_random_uuid();

-- Use as default primary key
CREATE TABLE users (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  email TEXT NOT NULL
);

When should you use a UUID?

If sort order matters (e.g. for database index performance or event ordering), consider UUID v7 or ULID instead — both are time-sortable.

// uuid vs ulid vs nanoid

UUID v4 — 36 chars, universally supported, random. Best for databases and APIs where compatibility matters.

ULID — 26 chars, sortable by time, URL-safe. Better for event logs and time-ordered records.

NanoID — customizable length, URL-safe, smaller. Good for short IDs in URLs and filenames.

// privacy & security

This tool uses crypto.randomUUID() — the same cryptographically secure API used in production applications. Your UUIDs are generated entirely in your browser. Nothing is sent to any server, logged, or stored.

UUID v4 is safe to expose in URLs and APIs — it reveals nothing about the generation time, host machine, or user.

// frequently asked questions
How do I generate a UUID in JavaScript?
Modern browsers and Node.js 19+ support crypto.randomUUID() natively — no library needed. It returns a v4 UUID string like "110e8400-e29b-41d4-a716-446655440000". This tool uses exactly that API.
How do I generate a UUID in Python?
Use the built-in uuid module: import uuid; str(uuid.uuid4()). This generates a random v4 UUID. For a UUID without hyphens use uuid.uuid4().hex.
Are these UUIDs truly unique?
Yes. UUID v4 has 122 random bits, giving 2¹²² possible values (~5.3 undecillion). The chance of two randomly generated UUIDs colliding is negligible for any practical application.
Can I use a UUID as a database primary key?
Yes — UUIDs are widely used as primary keys, especially in distributed systems. The trade-off is they are larger than integer IDs and not naturally sortable. Consider UUID v7 or ULID if sort order matters.
What is the difference between UUID v1 and UUID v4?
UUID v1 is generated from the current timestamp and the machine's MAC address — time-sortable but exposes system information. UUID v4 is entirely random and reveals nothing about the host or time of generation, making it safer for most use cases.
What is UUID v7 and should I use it?
UUID v7 (RFC 9562, 2024) is a time-ordered UUID that embeds a Unix millisecond timestamp in the first 48 bits, then fills the rest with random data. It is sortable like v1 but without exposing the MAC address. Use v7 when you need both uniqueness and chronological ordering — for example, as a database primary key where index locality matters.
// related guides & articles