UUID Generator

Advertisement

Generate universally unique identifiers (UUIDs) for your applications.

Advertisement

About This Tool

The Universally Unique Identifier (UUID) is one of the foundational building blocks of modern distributed computing. First standardized in 1997 through the Open Software Foundation's DCE specification and later formalized as RFC 4122 in 2005, UUIDs solve a deceptively difficult problem: how do you create identifiers that are guaranteed unique without a central coordinating authority? The answer lies in mathematics and probability. A UUID v4 contains 122 random bits, yielding approximately 5.3 x 10^36 possible values. To put this in perspective, you could generate one billion UUIDs every second for over 100 years before reaching a 50% probability of a single collision. This mathematical guarantee makes UUIDs the backbone of database primary keys, distributed message queues, session tokens, and microservice architectures worldwide. This generator supports multiple identifier formats, each designed for specific use cases. UUID v4 is the most widely adopted, relying purely on randomness. UUID v7, defined in the newer RFC 9562, embeds a Unix millisecond timestamp for natural chronological sorting — a major advantage for database indexing. UUID v1 combines a 60-bit timestamp with a node identifier. Beyond UUIDs, the tool generates ULIDs (Universally Unique Lexicographically Sortable Identifiers) using Crockford Base32, and NanoIDs — compact, URL-safe identifiers popular in frontend applications. All generation uses the browser's Web Crypto API, ensuring cryptographically secure randomness. No data leaves your device — every identifier is created entirely in your browser with zero server communication.

Sources: RFC Editor

How to Use

  1. Select a format (UUID v4/v7/v1, ULID, or NanoID) and how many to generate.
  2. Optionally choose formatting: uppercase, with/without braces or dashes.
  3. Click 'Generate UUID' and copy individual results or all at once.

UUID Standards and Distributed Identity

The Universally Unique Identifier was first standardized in RFC 4122 (2005), though its roots trace back to Apollo Network Computing System in the 1980s and the Open Software Foundation's Distributed Computing Environment (DCE). The fundamental problem UUIDs solve is generating globally unique identifiers without a central coordination authority — essential for distributed systems where multiple machines must independently create IDs that will never collide. RFC 4122 defined five UUID versions, each addressing different use cases. Version 1 embeds a 60-bit timestamp (100-nanosecond intervals since October 15, 1582 — the Gregorian calendar reform) combined with a 48-bit node identifier originally derived from the network card's MAC address. While guaranteeing uniqueness, v1 leaked hardware identity and creation time, raising privacy concerns. Version 3 and Version 5 are name-based: they hash a namespace identifier combined with a name using MD5 (v3) or SHA-1 (v5), producing deterministic UUIDs where the same input always yields the same output. Version 4 replaced determinism with 122 bits of cryptographic randomness, becoming the most widely adopted version. The newest standard, RFC 9562 (2024), introduced UUID v7 as the recommended choice for database-friendly identifiers. Version 7 embeds a 48-bit Unix millisecond timestamp in the most significant bits, followed by random fill bits. This design creates identifiers that sort chronologically when compared as strings or bytes — a critical advantage for B-tree database indexes where random v4 UUIDs cause excessive page splits and fragmentation. Benchmarks consistently show that v7 UUIDs improve database insert throughput by 20-40% compared to v4 in large tables. The collision probability of UUID v4 is governed by the birthday paradox. With 122 random bits, the space contains 5.3 x 10^36 possible values. The probability of generating a duplicate reaches 50% only after producing approximately 2.71 x 10^18 UUIDs — equivalent to generating one billion per second for over 85 years. Competing identifier formats include Twitter's Snowflake IDs (64-bit, datacenter-aware), ULIDs (128-bit with Crockford Base32 encoding for sortability), NanoIDs (compact URL-safe strings), and database auto-increment sequences. Each involves tradeoffs between uniqueness guarantees, sortability, storage size, and coordination requirements.

How to Use

  1. Select a format (UUID v4/v7/v1, ULID, or NanoID) and how many to generate.
  2. Optionally choose formatting: uppercase, with/without braces or dashes.
  3. Click 'Generate UUID' and copy individual results or all at once.

Methodology

UUID v4 generation relies on the browser's crypto.randomUUID() method from the Web Crypto API, which produces 128 bits where 122 are cryptographically random and 6 are reserved for version (4 bits set to 0100) and variant (2 bits set to 10) markers. This ensures every UUID is self-describing — you can identify its version by inspecting the 13th hexadecimal character. UUID v7 embeds a 48-bit Unix timestamp in milliseconds in the most significant bits, followed by random fill bits. This design produces identifiers that are both unique and naturally time-ordered, making them ideal for database primary keys where B-tree index performance matters. UUID v1 uses a 60-bit timestamp at 100-nanosecond resolution since October 15, 1582 (the Gregorian calendar reform date), a 14-bit clock sequence to prevent duplicates on clock adjustments, and a 48-bit node identifier generated randomly for privacy protection. ULIDs encode a 48-bit millisecond timestamp followed by 80 random bits, rendered in Crockford Base32 for compact, case-insensitive representation. NanoIDs use a configurable alphabet and length, defaulting to 21 characters from a URL-safe set, providing 126 bits of entropy.

Understanding Your Results

Each UUID is a 128-bit value displayed as 32 hexadecimal characters in 5 groups separated by hyphens, following the pattern 8-4-4-4-12. The canonical format is xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx, where the M position (13th hex character) indicates the version and the N position (17th hex character) indicates the variant. For UUID v4, M is always '4' and N is one of '8', '9', 'a', or 'b', confirming RFC 4122 compliance. For UUID v7, M is '7' and the first 12 hex characters encode the millisecond timestamp, making the creation time directly readable. UUID v1 places M as '1' with the timestamp split across the first three groups in a rearranged order. ULIDs are displayed as 26 uppercase Crockford Base32 characters — the first 10 encode the timestamp and the remaining 16 encode randomness. NanoIDs appear as compact strings using URL-safe characters (A-Z, a-z, 0-9, hyphen, underscore), with no inherent structural markers. When choosing a format, consider that UUIDs with braces are common in Microsoft ecosystems, while dashless UUIDs save storage in databases.

Sources: RFC Editor

Practical Examples

Database primary keys: Use UUID v7 for PostgreSQL or MySQL tables where insert order matters. The embedded timestamp ensures sequential key values, avoiding random I/O scatter that UUID v4 causes on clustered indexes. Microservice event tracking: Generate UUID v4 for correlation IDs passed through message queues (Kafka, RabbitMQ). The pure randomness guarantees no collisions even when thousands of services produce IDs simultaneously. Frontend session tokens: Use NanoID for compact, URL-safe session identifiers in single-page applications. At 21 characters, they are shorter than UUIDs while maintaining equivalent collision resistance. File naming and deduplication: Generate ULIDs for uploaded file identifiers. Their lexicographic sortability means a simple alphabetical listing shows files in chronological upload order.

Tips & Best Practices

Choose your UUID version based on your use case rather than defaulting to v4. If your identifiers will serve as database primary keys, UUID v7 or ULID provide significantly better insert performance because their time-ordered nature keeps B-tree indexes sequential, reducing page splits and fragmentation. For distributed systems where multiple nodes generate IDs independently, UUID v4's pure randomness eliminates any risk of timestamp-based collisions. When working with URLs or user-facing identifiers, NanoID's compact 21-character format is more practical than a 36-character UUID. Always store UUIDs as their native 128-bit binary type in databases when available (e.g., PostgreSQL's uuid type or MySQL's BINARY(16)) rather than as VARCHAR(36) strings. This cuts storage by more than half and improves comparison performance. When debugging, remember that the version digit (position 13) instantly tells you which UUID variant you are looking at.

All calculations are performed locally in your browser. No data is sent to any server.

Embed This Tool

Get embed code

Was this tool helpful?
Want to tell us more?
0/500
Want us to follow up?
Thanks for your feedback!

Frequently Asked Questions

What's the difference between UUID v4, v7, v1, ULID, and NanoID?
UUID v4 is fully random (most common). UUID v7 is time-ordered with millisecond timestamp—ideal for databases. UUID v1 uses timestamp + MAC address. ULID is a 26-character sortable ID using Crockford Base32. NanoID is a compact 21-character URL-safe ID. For databases, use v7 or ULID. For general use, v4. For compact URLs, NanoID.
Are the generated UUIDs truly unique?
Yes! UUID v4 has 122 random bits, giving approximately 5.3×10³⁶ possible combinations. The probability of generating two identical UUIDs is astronomically low—you'd need to generate 1 billion UUIDs per second for about 100 years to have a 50% chance of a collision.
What's the difference between UUID and GUID?
UUID (Universally Unique Identifier) and GUID (Globally Unique Identifier) are essentially the same thing. GUID is Microsoft's term for UUID. Both follow the same RFC 4122 standard and have the same 128-bit format with 32 hexadecimal characters and 4 dashes.
When should I use UUID v7 instead of v4?
Use UUID v7 when you need time-ordered identifiers, particularly as database primary keys. UUID v7 (defined in RFC 9562) embeds a Unix timestamp in the first 48 bits, making the IDs naturally sortable by creation time. This dramatically improves database insert performance on B-tree indexes because new rows are always appended to the end, avoiding random page splits. UUID v4 is purely random and causes index fragmentation in databases. Use v4 when ordering does not matter (e.g., API tokens, session IDs, correlation IDs) and v7 when you need time-sortable IDs (database primary keys, event IDs, distributed logs).
Can a UUID collision actually happen in practice?
For UUID v4, the probability is astronomically low. A v4 UUID has 122 random bits, yielding 5.3 × 10³⁶ possible values. To have a 50% chance of a single collision, you would need to generate approximately 2.71 × 10¹⁸ UUIDs — that is 2.71 quintillion. At 1 billion UUIDs per second, this would take about 86 years. In practice, collision risk is far more likely to come from a broken random number generator (poor entropy source) than from mathematical probability. The Web Crypto API (crypto.getRandomValues), which this tool uses, provides cryptographically secure randomness suitable for UUID generation.
What is ULID and when should I use it instead of UUID?
ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier that combines a 48-bit Unix millisecond timestamp with 80 bits of randomness, encoded as a 26-character Crockford Base32 string. ULIDs are time-sortable (like UUID v7), case-insensitive, and slightly shorter than UUID's 36-character hex format. Use ULID when you want human-friendly, sortable IDs that are easy to copy and paste. Use UUID when you need maximum compatibility with existing systems, databases, and libraries that expect the standard 8-4-4-4-12 UUID format. UUID v7 offers similar time-sorting benefits while remaining compatible with the UUID ecosystem.