PureDevTools

UUID Generator

Generate UUID v4 and v7 instantly in your browser — bulk, sortable, multiple formats

All processing happens in your browser. No data is sent to any server.

Random — 122 bits of entropy

You need 50 unique IDs for seed data in your test database. Should they be UUID v4 (random) or UUID v7 (time-ordered, sortable)? Your ORM expects lowercase with hyphens (550e8400-e29b-41d4-a716-446655440000), but your API documentation shows uppercase without hyphens (550E840041D4A716446655440000). You need bulk generation in the right format.

Why This Generator (Not uuidgenerator.net)

Most online UUID generators only support v4 and generate one at a time. This tool generates UUID v4 (random) and v7 (time-ordered) — with bulk generation, multiple format options (standard, uppercase, no hyphens, braces), and no server required. Everything uses the browser’s crypto.randomUUID() API; no UUIDs are sent anywhere.

What Is a UUID?

A UUID (Universally Unique Identifier), also known as a GUID (Globally Unique Identifier) on Windows platforms, is a 128-bit value used to uniquely identify information in computer systems. Standardized by RFC 9562 (formerly RFC 4122), UUIDs are designed to be globally unique without requiring a central registration authority.

UUIDs are represented as 32 hexadecimal digits displayed in five groups separated by hyphens: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. A typical UUID looks like: 550e8400-e29b-41d4-a716-446655440000.

UUID v4: Cryptographically Random

UUID v4 is the most widely used UUID version. It is generated using a cryptographically secure random number generator, providing 122 bits of randomness (6 bits are used for version and variant encoding). The collision probability for UUID v4 is astronomically small — generating 1 billion UUIDs per second would take about 85 years before a collision becomes likely.

When to use UUID v4:

This tool uses crypto.randomUUID() — the browser’s native cryptographically secure API — to generate v4 UUIDs.

UUID v7: Time-Ordered and Database-Friendly

UUID v7 is a newer version defined in RFC 9562. It embeds a 48-bit Unix millisecond timestamp as a prefix, followed by random bits. Because the timestamp occupies the most significant bits, UUID v7 values are naturally sorted by creation time.

When to use UUID v7:

UUID v7 solves a common database performance problem: random UUID v4 primary keys cause page fragmentation in B-tree indexes, leading to slow inserts at scale. UUID v7 inserts in time order, keeping the index compact and writes efficient — similar to auto-incrementing integers but globally unique.

Generating UUIDs in Code

// Browser / Node.js 19+ — native API
const id = crypto.randomUUID();
// "550e8400-e29b-41d4-a716-446655440000"

// Node.js — built-in crypto module
const { randomUUID } = require('crypto');
const id = randomUUID();

// UUID v7 — use the 'uuidv7' package
import { uuidv7 } from 'uuidv7';
const id = uuidv7();
// "018e3a5b-1234-7abc-8def-0123456789ab"
import uuid

# UUID v4
id_v4 = str(uuid.uuid4())
# "550e8400-e29b-41d4-a716-446655440000"

# UUID v7 (Python 3.12+)
id_v7 = str(uuid.uuid7())

# Older Python — use uuid6 package
from uuid6 import uuid7
id_v7 = str(uuid7())
import "github.com/google/uuid"

// UUID v4
id := uuid.New().String()

// UUID v7
id7, _ := uuid.NewV7()
import java.util.UUID;

// UUID v4
String id = UUID.randomUUID().toString();

// UUID v7 — use java-uuid-generator library
import com.fasterxml.uuid.Generators;
String id7 = Generators.timeBasedEpochGenerator().generate().toString();
-- PostgreSQL 13+ — native UUID v4
SELECT gen_random_uuid();

-- PostgreSQL with pgcrypto
SELECT uuid_generate_v4();

-- MySQL 8.0+ — UUID v1 (use application-level v4/v7 for better performance)
SELECT UUID();

UUID v4 vs v7 vs Auto-Increment: Database Performance

The choice of primary key type has significant performance implications at scale:

Key TypeInsert SpeedIndex SizeGlobally UniqueSortableExposes Count
Auto-increment INTFastestSmallestNoYesYes
UUID v4Slow at scaleLargeYesNoNo
UUID v7FastMediumYesYesNo
ULIDFastMediumYesYesNo

Why UUID v4 is slow for databases: B-tree indexes store keys in sorted order. Random UUID v4 keys insert into random positions in the index, causing frequent page splits and cache misses. At millions of rows, this can make inserts 10-50x slower than sequential keys.

UUID v7 solves this: The timestamp prefix means new UUIDs always append to the end of the index, just like auto-increment — but without the global coordination requirement.

-- PostgreSQL: create a table with UUID v7 primary key
CREATE TABLE events (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),  -- replace with v7 function
  created_at TIMESTAMPTZ DEFAULT NOW(),
  payload JSONB
);

-- Extract timestamp from UUID v7 (PostgreSQL)
SELECT to_timestamp(
  (('x' || substring(id::text, 1, 8))::bit(32)::bigint << 16 |
   ('x' || substring(id::text, 10, 4))::bit(16)::bigint) / 1000.0
) FROM events;

Format Options

This tool supports four output formats:

Bulk UUID Generation

Generating multiple UUIDs at once is useful for seeding test databases, creating fixture data, or batch-provisioning resources. This tool generates up to 1000 UUIDs in a single click. All generated UUIDs can be copied to your clipboard and pasted directly into SQL, JSON, CSV, or any other format.

-- Paste bulk UUIDs directly into SQL INSERT
INSERT INTO users (id, name) VALUES
  ('550e8400-e29b-41d4-a716-446655440000', 'Test User 1'),
  ('6ba7b810-9dad-11d1-80b4-00c04fd430c8', 'Test User 2');

Privacy and Security

All UUID generation runs entirely in your browser using the Web Crypto API. No UUIDs, no inputs, and no metadata are ever sent to a server. Your generated identifiers stay private.

The Web Crypto API guarantees cryptographic quality randomness for UUID v4. For UUID v7, crypto.getRandomValues() fills the random portions, ensuring the same cryptographic strength for the non-timestamp bits.

Frequently Asked Questions

Are UUIDs truly unique? UUIDs are not mathematically guaranteed to be unique, but the probability of collision is negligible in practice. UUID v4 has 122 random bits — the chance of two matching UUIDs is approximately 1 in 5.3×10³⁶. You are more likely to win the lottery three times in a row.

Can I use UUID v7 as a database primary key? Yes. UUID v7 is specifically designed for this use case. Its timestamp prefix makes sequential inserts efficient on B-tree indexes, avoiding the index fragmentation caused by UUID v4. It’s the recommended choice for new systems that need globally unique, distributed IDs.

Is a UUID the same as a GUID? Yes. GUID (Globally Unique Identifier) is Microsoft’s term for the same standard. GUIDs typically use the uppercase-with-hyphens format, but they follow the same RFC specification.

What is the difference between UUID versions? UUID v1 uses the machine’s MAC address and timestamp (deprecated due to privacy concerns — it leaks your network interface). UUID v4 uses pure randomness. UUID v7 uses a timestamp prefix plus randomness — the best of both: uniqueness and sortability.

Should I use UUID or ULID? Both are time-ordered identifiers suitable for database primary keys. UUID v7 follows the RFC standard and is natively supported by more databases. ULID uses a different encoding (Crockford Base32) that produces shorter strings. For new projects, UUID v7 is the safer choice due to broader ecosystem support.

What does the version number in a UUID mean? The version is encoded in the 13th character (after the second hyphen). UUID v4 always has 4 there: xxxxxxxx-xxxx-**4**xxx-xxxx-xxxxxxxxxxxx. UUID v7 has 7. The 17th character encodes the variant (always 8, 9, a, or b for RFC 4122 UUIDs).

Related Tools

More Code & Config Generators