UUID Generator

Generate UUID version 4 or version 7. Version 4 is random. Version 7 starts with the current time, so newer ids sort after older ones.

Version 4 is random. Version 7 starts with the time

A UUID is 128 bits written as hex. Version 4 is random, which is what most databases still ask for. Version 7 puts the Unix time in milliseconds in the front, so ids created later sort after earlier ones in a text or index order. This page generates them in the browser. It does not check whether an id you already have is unique in your database.

How to use it

  1. Choose version 4 or version 7. A result appears immediately, and again whenever you change an option.
  2. “How many” is from 1 to 100. Each press of Generate makes a new set.
  3. Uppercase changes the hex letters. Hyphens are on by default; turn them off for 32 hex digits. Braces add { and }. “urn:uuid: prefix” adds that scheme in front.
  4. Copy the result. There is no input box, because nothing is being converted.

The shape of the id

With hyphens, the form is 8-4-4-4-12. The version nibble is 4 or 7. The variant nibble is the RFC 4122 value, so the first hex digit of the fourth group is 8, 9, a or b. Version 7’s first 48 bits are the current Unix time in milliseconds, which is why two ids made a millisecond apart sort in time order when compared as text. The rest is random. The page uses the browser’s cryptographic random source when it is available.

Where people use it

  • A primary key for a row you are about to insert in a test database.
  • A request id in a log line.
  • Version 7 when new rows should cluster by time without a separate created-at sort.

Questions

Will two clicks ever match?

Version 4 has 122 random bits. A match is not a practical concern. Version 7 can share the timestamp prefix in the same millisecond and still differ in the random tail.

Is this a secret?

No. A UUID identifies a row. Do not use it as a password or as an access token.