UUID Generator

Generate random UUID v4 identifiers for databases, APIs and test data. Create one value at a time or a list of up to 100.

Your UUID

Version 4 · 128 bits · 36 characters —

Each value is generated separately, so duplicates in one list would be a genuine random coincidence rather than a re-used value.

UUID versions at a glance

Version Source of uniqueness Typical use
v1Timestamp plus node identifierLegacy time-based records
v3MD5 hash of a namespace and nameStable name-derived keys
v4122 random bitsGeneral-purpose identifiers
v5SHA-1 hash of a namespace and nameStable name-derived keys
v7Unix timestamp plus random bitsTime-sortable database keys

This generator always produces version 4 values, the format used when no ordering or naming scheme is required.

Rate this Tool

0.0/5

Based on 0 user ratings.

A UUID is a number written in a very specific way

The identifier looks like a long string, but it is a 128-bit integer split into five groups. Understanding the grouping explains why some characters are fixed and why the length never changes.

Anatomy of a UUID string

The canonical form is 32 hexadecimal digits separated by hyphens in a 8-4-4-4-12 pattern, for a total of 36 characters. Hexadecimal is base 16, so each character carries four bits: 32 characters × 4 bits = 128 bits.

123e4567-e89b-42d3-a456-426614174000 time_low 8 hex = 32 bits time_mid 4 hex = 16 bits version 4 = v4 variant 10xx node 12 hex = 48 bits Hyphens are separators only. They are not part of the 128-bit value. Uppercase and lowercase describe the same identifier; pick one and stay consistent. The version digit sits at the start of the third group, the variant at the start of the fourth.

Two parts are not random in a version 4 value. The four bits at the start of the third group hold the version number 4, and the two most significant bits of the fourth group are fixed to 10 to mark the RFC variant. That leaves 122 bits of randomness, which is why a version 4 UUID is not a pure 128-bit random number.

What version 4 randomness actually means

A version 4 UUID draws its 122 random bits from a cryptographically secure generator. The browser API used here is crypto.randomUUID(), with a fallback that fills a buffer from crypto.getRandomValues() in older browsers. Both are designed for identifiers and keys, unlike Math.random(), which is not suitable for anything security-related.

The number of possible values is 2122, which is about 5.3 × 1036. Collisions are still possible in theory, because random selection can repeat, but the birthday bound puts the point where a collision becomes likely at roughly 261 values — about 2.3 × 1018. At that scale, a duplicate from a well-seeded generator is not a practical concern.

random bits = 128 − 4 (version) − 2 (variant) = 122

Uniqueness is probabilistic, not guaranteed. Libraries treat a UUID as unique because the probability of a repeat is negligible, not because a central authority hands out non-repeating numbers. If your system must reject duplicates absolutely, enforce a unique constraint in the database as well.

UUIDs vs auto-increment IDs

PropertyUUID v4Auto-increment integer
Size in text form36 charactersA few digits
Size in binary form16 bytes4 or 8 bytes
Generated whereAny client, without coordinationUsually the database
OrderingNone; sorted order is randomMonotonic
Information leakDoes not reveal record countReveals volume and growth
Index behaviorRandom inserts fragment B-tree pagesAppends to the end of the index

The trade-off is coordination versus locality. A UUID lets an offline client or a shard create a row without asking the database for a number, at the cost of a larger key and scattered writes. Sequential integers are compact and index-friendly but expose how many records exist and require a round trip to allocate.

Choosing a version for a new system

Version 4 remains the default when identifiers only need to be unique and unguessable-looking. Two newer versions solve specific problems:

  • Version 7 starts with a 48-bit Unix timestamp in milliseconds, so values sort by creation time and insert near the end of a B-tree index. The remaining bits are random, which keeps them hard to predict.
  • Version 5 derives a deterministic value from a namespace and a name. The same pair always produces the same UUID, which is useful for reproducible imports and idempotent jobs.

RFC 9562, published in 2024, defines versions 6, 7 and 8 and replaces the older RFC 4122 specification. Version 4 is unchanged by that revision, so values generated on this page remain valid under both documents.

Storing and passing UUIDs

A UUID is 16 bytes in binary but 36 characters as text. PostgreSQL has a native uuid type that stores the compact form; MySQL users often choose BINARY(16) and convert at the edges. Storing the text form is simpler to debug and easier to read in logs, at the cost of roughly double the space and a slower index.

Keep the hyphenated canonical form in URLs and API responses. Some systems accept 32 hex digits without hyphens, but mixing both forms in one table creates duplicate-looking keys that compare as different strings. Decide on lowercase or uppercase at the boundary and normalize on input.

Common UUID mistakes

  • Treating a UUID as a secret. A random v4 value is hard to guess, but UUIDs appear in URLs, logs and analytics. Use a dedicated token with an expiry for access control.
  • Sorting by v4. The order is random, so "newest first" requires a timestamp column, not the key.
  • Using a weak fallback. A generator built on Math.random() can repeat and is predictable. Prefer the platform's cryptographic source.
  • Assuming a fixed length everywhere. The canonical string is 36 characters, but braces, urn:uuid: prefixes and hyphenless forms also exist.
  • Random keys in a hot index. Millions of random inserts cause page splits; consider v7 or an integer key when write throughput matters.

For test fixtures, generate values fresh instead of copying one from production. Real identifiers in fixtures can leak record counts and link test data back to live rows.

Related Developer & Security Tools

Tool What does it do? Action
Base64 Encoder & Decoder Encode text to Base64 or decode a Base64 string back to plain text. Base64 Codec →
Hash Generator Create MD5, SHA-1, SHA-256 and SHA-512 hashes from text. Hash Maker →
UUID Generator Generate random UUID v4 values, one or many at a time. Current Page
Password Generator Build strong random passwords with length and character options. Password Maker →
Regex Tester Test a regular expression against sample text and inspect the matches. Regex Test →
JWT Decoder Decode a JWT header and payload locally, without sending the token anywhere. JWT Decode →

Frequently Asked Questions

No, uniqueness is probabilistic. A version 4 value has 122 random bits, so the chance of a repeat is negligible, but a database unique index is still the reliable guarantee when duplicates would cause real damage.

Those four bits encode the version. A version 4 UUID always shows 4 at the start of the third group, and the fourth group begins with a variant marker such as 8, 9, a or b.

It is better to use a purpose-built token with an expiry and single-use storage. UUIDs are routinely logged in URLs, proxies and analytics tools, which undermines the secrecy a reset token depends on.

The bulk field accepts 1 to 100 values per run. Generating another list is instant, and every request draws fresh random values from the browser's cryptographic generator.

Either form works if you are consistent. The hyphenated 36-character form is the canonical representation and the easiest to read. Native binary storage is 16 bytes and has no separators at all.

Yes. The page calls crypto.randomUUID() when the browser supports it, otherwise it fills a buffer with crypto.getRandomValues(). Values are created locally and never sent to a server.