UUID Generator

What Is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit label used to uniquely identify information in computer systems. Also known as GUIDs (Globally Unique Identifiers) in Microsoft ecosystems, UUIDs are formatted as 32 hexadecimal characters displayed in 5 groups separated by hyphens: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx, where M indicates the version and N indicates the variant.

UUIDs were standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE) and later formalized in RFC 4122. They solve a fundamental problem in distributed computing: generating unique identifiers without a central coordinating authority.

UUID Versions Explained

  • UUID v4 (Random) — Generated using cryptographically secure random numbers. The most commonly used version. 122 bits of randomness provide a collision probability so low it's effectively zero for practical purposes. Ideal for most applications.
  • UUID v1 (Timestamp) — Based on the current timestamp (100-nanosecond intervals since October 15, 1582) combined with a node identifier. Guaranteed unique and sortable by creation time, but reveals when and potentially where it was created.
  • UUID v7 (not yet supported) — A newer format (RFC 9562) that combines Unix timestamp milliseconds with random data. Designed to be database-friendly and sortable while maintaining randomness.

How to Use This Tool

Select the UUID version (v4 random or v1 timestamp) and how many UUIDs you need (up to 100 at once). Click Generate to create them. Use the formatting options to toggle uppercase output and hyphen inclusion. Click Copy All to copy the entire batch to your clipboard.

Real-World Use Cases

  • Database Primary Keys — UUIDs are ideal primary keys in distributed databases where auto-incrementing integers would cause conflicts. Used by PostgreSQL, MongoDB, and many ORMs.
  • API Resource Identifiers — Public-facing IDs in REST APIs. UUIDs don't reveal record count or creation order, unlike sequential integers.
  • Session & Token IDs — Generate unique session identifiers, CSRF tokens, and password reset tokens without database lookups.
  • File & Asset Naming — Create unique filenames for uploads to prevent conflicts in cloud storage (S3, Azure Blob, GCS).
  • Distributed Systems — Microservices can independently generate unique IDs without coordination. Critical for event sourcing, message queues, and distributed tracing.
  • Testing & Development — Generate test data with realistic unique identifiers for development and QA environments.

UUID v4 vs Sequential IDs

Sequential integer IDs (1, 2, 3...) are simple and space-efficient but cause problems in distributed systems: they require central coordination, reveal record counts, and can lead to hot-spots in sharded databases. UUIDs eliminate these issues at the cost of larger storage (16 bytes vs 4-8 bytes) and reduced database index performance due to randomness.

For applications needing both uniqueness and sortability, consider UUID v7 or ULID (Universally Unique Lexicographically Sortable Identifier) which combine timestamps with randomness.

Frequently Asked Questions

Are UUIDs truly unique?

UUID v4 generates random values from a space of 2^122 possibilities (approximately 5.3 × 10^36). The probability of a collision is astronomically small — you'd need to generate about 2.71 quintillion UUIDs to have a 50% chance of a single collision. For all practical purposes, they are unique.

When should I use UUIDs?

UUIDs are ideal for distributed systems, public-facing API identifiers, database keys in multi-server setups, session tokens, file names, and any scenario where you need unique identifiers without a central authority.

Should I use UUID v1 or v4?

Use v4 (random) for most applications — it's simpler and doesn't leak timing information. Use v1 (timestamp) only when you need naturally sortable IDs based on creation time and are comfortable exposing that information.

Do UUIDs with hyphens work differently than without?

No. Hyphens are purely visual formatting. The UUID 550e8400-e29b-41d4-a716-446655440000 is identical to 550e8400e29b41d4a716446655440000. Most libraries and databases accept both formats.

How much storage does a UUID need?

A UUID is 128 bits (16 bytes) in binary. As a string with hyphens, it takes 36 characters (or 32 without hyphens). Most databases have a native UUID type that stores them efficiently as 16 bytes.