UUIDs generator

What is an Uuid Generator?

A UUID (Universally Unique Identifier), also called a GUID on Microsoft platforms, is a 128-bit identifier written as 32 hex digits in five groups, such as 3f2b8c1e-9d4a-4f6b-a2e7-5c0d81b9e4f3. UUIDs can be generated independently on any machine with practically no risk of duplicates, which makes them ideal for database keys, request IDs, file names and distributed systems.

How to use it

  1. Choose how many UUIDs to generate.
  2. Choose the format options, such as uppercase or no hyphens.
  3. Copy the list.

Reading a UUID

In xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx, the 13th digit is the version (4 for random) and the first digit of the fourth group, N, is the variant (8, 9, a or b for standard UUIDs). A version 4 UUID has 122 random bits.

How unlikely is a collision?

With 2^122 possibilities, you would need to generate about 2.7 × 10^18 UUIDs to have a 50% chance of a single duplicate. Generating a billion per second, that would take about 86 years.

UUID versions

  • v1: timestamp plus MAC address. Leaks hardware identity.
  • v4: random. The most common choice.
  • v5: SHA-1 hash of a namespace and name, so the same input always gives the same UUID.
  • v7: Unix timestamp plus randomness (RFC 9562). Sortable, and better for database index performance than v4.

Tips

  • Store UUIDs in a native UUID or 16-byte binary column, not as 36-character text.
  • In JavaScript, use crypto.randomUUID().
  • UUIDs are unique, not secret; do not use them as access tokens.

Frequently Asked Questions

What is the difference between a UUID and a GUID?

They are the same thing. GUID is Microsoft's name for a UUID.

Can two UUIDs ever be the same?

In theory, but for random version 4 UUIDs the probability is so low that it can be ignored in practice.

Which UUID version should I use?

Version 4 for general random IDs, and version 7 for database primary keys that benefit from time ordering.

How do I generate a UUID in JavaScript?

Call crypto.randomUUID() in modern browsers and Node.js.