How UUID Generation Works and When to Use It

Generate UUIDs (v4) for unique IDs. When developers use UUIDs in databases, APIs, and distributed systems.

How it works

UUID v4 is a 128-bit value that is effectively unique. The generator uses a cryptographically strong random source to create 122 random bits; the rest are fixed to identify the version (4) and variant. The result is formatted as eight-four-four-four-twelve hex digits (e.g. 550e8400-e29b-41d4-a716-446655440000). You can generate one or many UUIDs at once.

When developers use it

Developers use UUIDs when they need globally unique identifiers without a central authority: primary keys in databases, correlation IDs in logs, resource IDs in REST APIs, or any place where collision risk must be negligible. UUIDs are especially useful in distributed systems and when merging data from multiple sources.