UUID Generator: Version 4 and Version 7

Generate one or a thousand UUIDs at once, random (v4) or time-ordered (v7), with the secure random generator built into your browser. Nothing is uploaded.

Loading the tool. It runs entirely in your browser...

Generating UUIDs

A UUID (universally unique identifier) is a 128-bit value written as 32 hex digits in groups of 8-4-4-4-12, for example 3f2b8c1e-9a4d-4e57-8b21-7c0d5e6f1a90. Systems create them without coordination, because the chance of two matching is negligible.

Pick a version, how many you need (up to 1,000) and press Generate. The list can be copied in one click or downloaded as a text file, with options for uppercase, no hyphens and curly braces for Microsoft-style GUIDs.

  • Version 4 is 122 random bits. It is the general-purpose default.
  • Version 7 starts with a 48-bit Unix millisecond timestamp followed by random bits, so values sort in creation order. That keeps database indexes compact and fast, and is why v7 is increasingly recommended for primary keys.
  • Nil is all zeros, a placeholder meaning "no value".

All randomness comes from crypto.getRandomValues, a cryptographically secure source, and nothing is sent anywhere.

Worked example

A v4 UUID always has the digit 4 at the start of the third group and one of 8, 9, a or b at the start of the fourth:

3f2b8c1e-9a4d-4e57-8b21-7c0d5e6f1a90
          version ^   ^ variant

A v7 UUID created at the same moment as another shares its first 12 hex digits (the timestamp), so a list of v7 values sorts by creation time. Paste any UUID into the inspector and it tells you the version, the variant and, for v7, the exact creation time.

v4 or v7?

Use v4 when ordering does not matter and you do not want identifiers to reveal when they were made. Use v7 for database keys and event IDs where insertion order and index locality help performance. Remember that a v7 UUID exposes its creation time to anyone who sees it. Neither version is a secret: do not use UUIDs as passwords or session tokens unless they come from a secure generator and are long enough for that purpose; for hashes of data see the hash generator.

Frequently asked questions

Can two generated UUIDs collide?

In practice no. A v4 UUID has 122 random bits, so you would need to generate billions per second for decades before a collision became likely.

What is the difference between a UUID and a GUID?

They are the same thing. GUID is Microsoft's name, often written in uppercase with curly braces, which the formatting options can reproduce.

Are these UUIDs safe for security tokens?

They use a cryptographically secure source, so they are unpredictable. Still, use purpose-built tokens with enough entropy for secrets, and never rely on a UUID alone for authorisation.

Why are v7 UUIDs better for databases?

Their leading timestamp makes new keys larger than older ones, so inserts append to the end of an index instead of landing at random positions, which reduces page splits and cache misses.