Guide

How UUIDs Work and When to Use Them

Understand what a UUID is, why collisions are astronomically unlikely, and the right uses for unique identifiers.

A UUID (universally unique identifier) is a 128-bit identifier that can be generated independently by anyone yet is overwhelmingly likely to be unique. A UUID generator creates RFC 4122 version 4 UUIDs on demand.

What a UUID is

A UUID is a 128-bit number usually shown as 32 hex digits in five groups, e.g. 550e8400-e29b-41d4-a716-446655440000. Version 4 UUIDs use random bits (with a fixed version and variant marker), so they need no central authority and no coordination between systems.

Why collisions are so unlikely

A version 4 UUID has about 122 bits of randomness — 2¹²² possible values. The chance of a single collision among 103 trillion randomly generated UUIDs is still about one in a billion. In practice you can treat generated UUIDs as unique without checking for duplicates.

How to use a UUID generator

  1. Choose how many UUIDs to generate.
  2. Optionally strip hyphens or uppercase the output.
  3. Copy the UUID(s) for use as identifiers.

Examples

A generated UUID like f47ac10b-58cc-4372-a567-0e02b2c3d479 can serve as a primary key in a database row, a request id in a distributed system, or a unique filename. Generating 100 at once gives you a batch of ready-to-use identifiers.

When a UUID generator is useful

  • Generating database primary keys without coordination.
  • Creating unique request or session ids in distributed systems.
  • Naming uploaded files to avoid collisions.
  • Producing test identifiers during development.

Put it into practice

Use the UUID Generator right now — free, in your browser, no sign-up required.

Try the UUID Generator