UUID Generator

Generate version 4 UUIDs from your browser's cryptographic random source. Produce one or a few thousand at a time, in lowercase, uppercase, braced or hyphen-free form, and copy the lot in one click.

What a v4 UUID actually is

128 bits, of which 122 are random - four bits identify the version and two the variant. The familiar 8-4-4-4-12 hyphenation is purely cosmetic; the value is the 32 hex digits.

Collision probability, concretely

With 122 random bits you would need to generate roughly 2.7 x 10^18 UUIDs before reaching a 50% chance of any two matching. At a billion per second that is about 85 years. For every practical purpose they are unique, and unlike database sequences they can be created offline, on any machine, with no coordination.

v4 versus v7 in a database

Random UUIDs scatter across a B-tree index, so every insert touches a different page and write performance degrades as the table grows. UUID v7 puts a millisecond timestamp in the high bits, so new rows land at the end of the index like an auto-increment key while keeping the generate-anywhere property. If you are choosing today for a table that will get large, v7 is usually the better default.

Frequently asked questions

How likely is a UUID collision?

A v4 UUID has 122 random bits. You would need to generate about 2.7 x 10^18 of them before a 50% chance of any collision - roughly a billion a second for 85 years. In practice you can treat them as unique.

What is the difference between v4 and v7?

v4 is entirely random. v7 puts a millisecond timestamp in the leading bits, so UUIDs sort chronologically. That makes v7 much friendlier to database indexes, because inserts land at the end of the B-tree instead of scattering across it.

Related tools

Steuervergleich Kanton Zürich — Gemeindesteuern vergleichen (Deutsch)