UUID & ULID Generator

Generate cryptographically random UUID v4, time-based UUID v1, and ULID values. Bulk generation up to 100 at once.

Generate Unique Identifiers

UUID Validator

What Is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit label used to uniquely identify information in computer systems. The standard format is 550e8400-e29b-41d4-a716-446655440000 — 32 hexadecimal digits separated by four hyphens. UUIDs are designed to be globally unique without requiring a central registration authority. The probability of generating two identical UUID v4 values is astronomically low — approximately 1 in 5.3 × 1036 — meaning you could generate one billion UUIDs per second for 86 years before having a 50% chance of a single collision.

UUID Versions Explained

VersionGeneration MethodDeterministic?Best Use Case
v1Timestamp + MAC addressNo (time-based)Distributed systems needing time-ordered IDs
v3MD5 hash of namespace + nameYesContent-addressable IDs from known inputs
v4122 random bitsNo (random)General purpose — database PKs, session IDs, API keys
v5SHA-1 hash of namespace + nameYesSame as v3 but with stronger hash (preferred over v3)
v7 (new)Unix timestamp + random bitsNo (time-based)Database PKs that need to be sortable by creation time

UUID v4 — The Default Choice

UUID v4 is the most widely used version. It generates 122 random bits (the remaining 6 bits encode the version and variant). The result is cryptographically random and unpredictable, making it suitable for security-sensitive use cases like session tokens and API keys. Most modern programming languages have built-in UUID v4 generation: crypto.randomUUID() in JavaScript, uuid.uuid4() in Python, UUID.randomUUID() in Java, and Str::uuid() in Laravel.

UUID vs Auto-Increment — The Database Debate

Traditional databases use auto-incrementing integers (1, 2, 3...) as primary keys. UUIDs offer several advantages but come with trade-offs:

FactorAuto-IncrementUUID v4ULID / UUID v7
Storage Size4–8 bytes16 bytes16 bytes
Index PerformanceExcellent (sequential)Poor (random, causes B-tree fragmentation)Good (time-sorted prefix)
Generate Without DBNo (needs DB round-trip)Yes (generated anywhere)Yes
Merge/Replicate DataCollision riskSafeSafe
Exposes Record CountYes (ID #1000 = ~1000 records)No (random, no info leak)Partially (reveals timing)

What Is ULID?

ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier designed to address UUID v4's biggest weakness: poor database index performance due to randomness. A ULID has the format 01ARZ3NDEKTSV4RRFFQ69G5FAV — 26 characters using Crockford's Base32 encoding. The first 48 bits encode the Unix timestamp in milliseconds, and the remaining 80 bits are random. This means ULIDs created at the same millisecond sort chronologically by creation time, while remaining globally unique.

ULIDs are increasingly preferred over UUID v4 for database primary keys because their time-sorted prefix keeps B-tree indexes efficient (new inserts always go at the end, like auto-increment). They are also shorter than UUIDs when displayed (26 chars vs 36) and URL-safe by default.

What Is NanoID?

NanoID is a tiny, URL-friendly unique ID generator. Default format: V1StGXR8_Z5jdHi6B-myT (21 characters, using A-Za-z0-9_-). It is 40% faster than UUID v4 in JavaScript and generates shorter IDs that are safe for URLs, HTML attributes, and file names. NanoID's alphabet and length are customizable — a 21-character NanoID has roughly the same collision probability as UUID v4.

When to Use Each Format

Frequently Asked Questions — UUID Generator

Written and reviewed by the FreeBytes Editorial Team · Last updated: June 2026