Zum Inhalt springen
NeedToConvert

UUID-Generator

Zufällige v4- oder sortierbare v7-UUIDs, eine oder tausend auf einmal, so formatiert, wie Ihr Code sie erwartet.

  • Kostenlos
  • Privat
  • Ohne Anmeldung
Läuft auf Ihrem Gerät. Ihre Eingaben werden nicht hochgeladen.

A UUID is the quickest way to give a database row, a file, a message or a test fixture an identifier that will not clash with anyone else's, without asking a central server for the next number. This generator produces version 4 UUIDs, the familiar random kind, and version 7 UUIDs, the newer time-ordered kind that databases handle much better as primary keys.

IDs are created in your browser with its cryptographically secure random number generator. Nothing is fetched from or logged on a server, so the values you copy have never been seen by anyone else.

Anatomy of a UUID

A UUID (universally unique identifier, called a GUID in the Microsoft world) is a 128-bit value written as 32 hexadecimal digits in five groups, 8-4-4-4-12, for example 3f2b8c1e-9d4a-4c7e-b1f0-6a2d9e8c4b51. Two positions are fixed by the standard, RFC 9562: the first digit of the third group is the version, 4 or 7 here, and the first digit of the fourth group is always 8, 9, a or b, marking the variant. Everything else carries data.

In a version 4 UUID, the remaining 122 bits are random. That space is so large that you would need to create roughly 2.7 quintillion (2.7 × 10^18) of them before the chance of even one duplicate reached 50 percent. Version 7 starts with a 48-bit Unix timestamp in milliseconds, followed by bits that this generator uses as a counter within the same millisecond, and ends with 62 random bits. Sorting v7 UUIDs as plain text therefore sorts them by creation time, to the millisecond.

Choosing between v4 and v7

Database primary keys: v7

Random v4 keys land at random positions in a B-tree index, which causes page splits and poor cache use as tables grow, especially with clustered indexes such as MySQL InnoDB. Time-ordered v7 keys are appended near the end of the index, much like an auto-increment column, while still being safe to generate in the application or on the client.

Public tokens and opaque IDs: v4

A v7 UUID reveals roughly when it was created. When an identifier appears in URLs or API responses and its creation time should stay private, a random v4 UUID gives nothing away.

Test data, fixtures and config files

Seed scripts, mock API responses and correlation IDs for tracing often need dozens of unique values at once. Generate up to 1,000 in one go and download them as a text file with one UUID per line.

Windows and .NET GUIDs

Registry entries, COM class IDs and Visual Studio project files usually write GUIDs in uppercase inside curly braces. The Uppercase and Braces switches produce exactly that form.

How the UUIDs are generated

Version 4 uses the browser's crypto.randomUUID function where it exists, which draws from the operating system's secure random source, and falls back to crypto.getRandomValues with the version and variant bits set by hand. Math.random is never used.

For version 7, the generator reads your device clock in milliseconds. When several IDs are created in the same millisecond, which is normal in a batch of 1,000, the 12-bit counter after the version digit increases by one each time, following method 1 of RFC 9562 section 6.2. Every list you generate is therefore in strict ascending order. The formatting switches only change presentation: Hyphens off gives 32 bare hex digits, Uppercase changes the letters, Braces wraps each value in curly brackets.

So verwenden Sie dieses Tool

  1. Under Version, choose v4 (random) or v7 (time-ordered).
  2. Enter how many you need, from 1 to 1,000.
  3. Set the Uppercase, Hyphens and Braces switches to match your target format. The list regenerates whenever you change an option.
  4. Press Generate for a fresh batch, then use Copy all or download the list as a text file.

Limitations

  • Only versions 4 and 7 are generated. Name-based v3 and v5, the MAC-address based v1 and v6, and the nil UUID are not offered.
  • A batch is capped at 1,000 IDs. Generate several batches if you need more.
  • Version 7 timestamps come from your device clock; if the clock is wrong, the embedded time is wrong too.

Häufig gestellte Fragen

Can two UUIDs ever be the same?

In theory yes, in practice no. With 122 random bits, a duplicate among version 4 UUIDs is far less likely than a hardware fault in the machine storing them. Duplicates seen in the wild almost always come from broken random generators or copied values, not from chance.

Should I switch my database from v4 to v7?

For new tables whose primary key is a UUID, v7 is usually the better default because inserts stay index-friendly. Existing v4 keys keep working, and both fit the same uuid column type, so you can use v7 for new rows without a migration.

Can I get the creation time back out of a v7 UUID?

Yes. The first 12 hex digits are the Unix time in milliseconds. For example, a v7 UUID starting 0192906e-4a00 was created at 1,729,000,000,000 milliseconds, which is 15 October 2024 at 13:46:40 UTC.

Are these UUIDs secure enough for session tokens?

The v4 values made here come from a secure random source, and 122 random bits are not practically guessable. The catch is that the UUID standard does not require a secure generator, so UUIDs from other libraries may be predictable. For authentication, use your framework's own session or token function.