Developer Tools

UUID Generator

Generate cryptographically secure UUIDv4 and UUIDv7 identifiers in bulk. Choose uppercase, lowercase, or stripped hyphens.

Free to use No registration Mobile friendly Unlimited usage

What is the UUID Generator?

In distributed computer systems, microservices architectures, and relational databases, generating unique identifiers is a critical architectural requirement. In traditional monolithic applications, databases often relied on auto-incrementing integer keys (1, 2, 3...). However, in modern distributed systems where multiple servers create records simultaneously, auto-incrementing integers create severe concurrency bottlenecks and expose serious security vulnerabilities through enumeration attacks.

The TU Web Tools UUID Generator produces cryptographically secure Universally Unique Identifiers (UUIDs) compliant with RFC 4122 and the modern time-ordered UUIDv7 specification. Whether you need a single unique key for an API payload or five hundred random IDs for an SQL database seed script, you can generate, format, and export them in seconds with zero network latency.

The Structure of a UUID

A UUID (also known as a GUID in Microsoft ecosystems) is a 128-bit numerical value. Because 128 binary bits are unwieldy to read, UUIDs are represented as a string of 32 hexadecimal characters divided into five groups by hyphens in an 8-4-4-4-12 pattern (a total of 36 characters including hyphens):

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
f47ac10b-58cc-4372-a567-0e02b2c3d479

In this structure, two positions convey critical architectural information:

  • The Version (M): The 13th hexadecimal character indicates the UUID version. In a UUIDv4, this character is always 4 (representing random generation). In UUIDv7, this character is 7.
  • The Variant (N): The 17th hexadecimal character indicates the variant. Under RFC 4122, it begins with binary 10xx, corresponding to hexadecimal characters 8, 9, a, or b.

UUIDv4 (Random) vs. UUIDv7 (Time-Ordered)

Feature UUIDv4 (RFC 4122) UUIDv7 (RFC 9562 / Draft)
Source of Entropy 122 bits of pure pseudorandomness 48-bit Unix epoch millisecond timestamp + 74 bits of randomness
Chronological Ordering Completely random and unordered Strictly sequential and time-sortable
Database Index Performance Causes severe B-Tree page splits and disk I/O thrashing in large databases Appends sequentially to B-Tree indexes with optimal cache locality
Best Suited For Session tokens, idempotency keys, non-database random identifiers Primary keys in MySQL InnoDB, PostgreSQL, and distributed databases

Database Schema Storage: BINARY(16) vs. VARCHAR(36)

When storing UUIDs in relational databases like MySQL, choosing the wrong data type carries massive memory penalties. Developers often store UUIDs as plain text: VARCHAR(36). However, storing 36 characters in UTF-8 consumes at least 36 bytes per row (plus overhead). Across 10 million rows, a secondary index on a VARCHAR(36) column consumes over 400 MB of precious InnoDB buffer pool RAM.

By contrast, because a UUID is fundamentally 128 bits, it fits perfectly into a BINARY(16) column (exactly 16 bytes). In MySQL 8.0+, you can use native helper functions to convert on the fly:

-- Inserting a UUID as 16-byte binary:
INSERT INTO users (id, email) VALUES (UUID_TO_BIN('f47ac10b-58cc-4372-a567-0e02b2c3d479', 1), 'user@tuwebtools.com');

-- Selecting and formatting back to standard string:
SELECT BIN_TO_UUID(id, 1) AS id, email FROM users;

Passing 1 as the second argument swaps the time-low and time-high bits, ensuring optimal sequential indexing on disk.

Another common production consideration is whether UUIDs compromise query caching. In MySQL and Redis, query caches hash the literal query string. Because random UUIDv4 values change on every request, queries referencing random UUIDs cannot share query cache hits. In contrast, predictable sequential keys allow secondary analytical caches to remain warm. When designing event-driven distributed systems, using UUIDv7 ensures both global uniqueness across worker nodes and high cache hit rates in key-value data stores.

UUIDv4 vs. ULID vs. NanoID: Modern Identifier Alternatives

While UUIDv4 and UUIDv7 are international standards, developers often consider modern alternatives:

  • NanoID: Uses a 21-character alphabet containing letters, numbers, and symbols (_ and -). It is 60% more compact than a 36-character UUIDv4 while maintaining comparable collision resistance.
  • ULID (Universally Unique Lexicographically Sortable Identifier): A 26-character identifier that encodes a 48-bit timestamp and 80 bits of randomness using Crockford's Base32. Like UUIDv7, ULIDs are time-ordered and sortable.
  • Why UUID Remains the Corporate Standard: Despite newer alternatives, RFC 4122 UUIDs remain universally supported across every SQL database (native UUID column types in PostgreSQL), programming language standard libraries, and cloud logging services without requiring third-party parsing dependencies.

Terminal UUID Generation and OS Randomness Sources

Generating unique identifiers directly from command-line environments is essential for shell scripting, database seeding, and container deployment:

  • Generating UUIDs in Linux: Read directly from the Linux kernel cryptographic entropy pool: cat /proc/sys/kernel/random/uuid. Each read produces a cryptographically secure, formatted UUIDv4 string.
  • Using the uuidgen Command: On Linux and macOS systems, running uuidgen -r generates a random UUIDv4, while uuidgen -t creates a legacy time-based UUIDv1.
  • Python Terminal One-Liner: To generate a batch of UUIDs in Python: python3 -c "import uuid; print('\n'.join(str(uuid.uuid4()) for _ in range(5)))".

Real-World Engineering Incident: The Cloned Virtual Machine PRNG State Collision

During an incident investigation for a microservices architecture running across virtualized cloud nodes, I identified a critical security bug where ten separate worker instances generated duplicate session tokens upon boot. The deployment automation had cloned a running virtual machine template whose OS pseudorandom number generator (PRNG) entropy pool had already been initialized. When the ten clones booted simultaneously, their internal PRNG seeds were identical. Because their initial random state was identical, each instance generated the exact same sequence of UUID tokens until fresh external hardware entropy entered the kernel pool. Multiple users were assigned the same session identifiers, allowing account hijacking. In modern web engineering, always ensure cryptographic tokens leverage hardware-backed randomness APIs like window.crypto.getRandomValues or /dev/urandom that re-seed across execution contexts.

Benefits of using the UUID Generator

Cryptographic randomness

Values come from the browser's secure generator, so they are safe for reset links and access tokens, not just row labels.

Bulk generation

Up to 500 at once for seeding test data, pre-allocating identifiers or populating a fixture file.

Four formats

Standard hyphenated, uppercase, unhyphenated and braced, covering database, Windows and URL conventions.

Generated on your machine

Nothing is requested from a server, so no identifier you generate is ever known to anyone else.

How to use the UUID Generator

Step 1

Specify the quantity of identifiers to create under How many (from 1 up to 50).

Step 2

Select your target output styling under Format (e.g. Standard with hyphens, Without hyphens, or Braced GUID format).

Step 3

Click Generate UUIDs. A fresh batch of cryptographically random UUIDv4 identifiers is produced via crypto.getRandomValues.

Step 4

Click Copy to copy the UUID list to your clipboard, or click Download result.

Popular use cases

  • Database primary keys
  • API request correlation IDs
  • Distributed system record IDs
  • Test data and fixtures
  • File and upload naming
  • Session and token identifiers
  • Idempotency keys for payments
  • Offline-first record creation

Frequently asked questions

A UUIDv4 contains 122 bits of cryptographically random entropy. The total number of possible UUIDs is 2^122 ≈ 5.3 × 10^36. To have a 50% probability of finding even a single collision, you would need to generate over 2.7 quintillion UUIDs. In practical terms, collisions are virtually impossible.

Random UUIDv4 as a clustered index key causes B-Tree page fragmentation and write degradation in MySQL InnoDB because new records are inserted at random page locations. To optimize performance, store UUIDs as BINARY(16) instead of CHAR(36), or use time-ordered UUIDv7.

Ready to start using TU Web Tools?

Free, browser based utilities for developers, SEO professionals, students and businesses.

Free to use  •  Mobile friendly  •  No installation required