Skip to the content

UUID v4 Generator

Random version 4 UUIDs, made in your browser with its cryptographic random generator. One at a time or up to 1,000 in one go.

Kind

Random from start to end. The usual choice.

 
Share this tool:TwitterFacebookLinkedInWhatsAppEmail

What is in a version 4 UUID

Chance, and almost nothing else. Of the 128 bits, 122 are random. The other six are fixed, so that software can tell what kind of UUID it is looking at.

BitsWhereWhat it holds
48The first two groupsRandom
4The first digit of the third groupThe version: always 4
12The rest of the third groupRandom
2Inside the first digit of the fourth group, which is therefore always 8, 9, a or bThe variant: "laid out as the standard says"
62Everything after thatRandom

Every version 4 UUID therefore has the shape xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx. The 4 is how you recognise one.

When to choose it

Version 4 is the default choice. It contains no time, no counter and nothing about the machine that made it, so it gives nothing away and needs no coordination: any device can make one at any moment. Use it for identifiers that show up in links, for records that are made on several machines and merged later, and wherever the order of creation is nobody's business.

Where it does less well is as the primary key of a large database table. Random values land all over the index, and that slows down inserts. The version 7 page is about the alternative.

How likely is a duplicate?

Version 4 UUIDs madeChance that any two of them are the same
1 million1 in 11 septillion
1 billion1 in 11 quintillion
1 trillion1 in 11 trillion
2.7 quintillion: a billion every second for 86 years1 in 2

These figures follow from the 122 random bits, and they hold only when those bits really are random. Chance alone practically never produces a duplicate, so when two equal UUIDs do turn up in a system, the cause to look for is a weak random generator. The UUIDs on this page come from your browser's cryptographic generator.

The other versions, the nil UUID and the inspector are explained on the UUID generator page.

See all 9