โ† Back to blog

Understanding UUIDs: A Deep Dive into RFC 4122

When building software, you constantly need a way to uniquely identify things: a user account, a transaction, or a file. Historically, databases used auto-incrementing integers (1, 2, 3...). But in modern, distributed systems, this approach falls apart. Enter the UUID.

What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit label used for information in computer systems. It typically looks like this: 123e4567-e89b-12d3-a456-426614174000.

The magic of a UUID is that it can be generated completely independently by any machine in the world, without central coordination, and you can practically guarantee it will be unique. The total number of possible UUIDs is 2128 (or about 3.4 x 1038). To put that in perspective, you could generate 1 billion UUIDs every second for 85 years, and the chance of a collision would still be less than 50%.

UUID Versions

The RFC 4122 standard defines several versions of UUIDs, but the two most common are:

  • Version 1 (Time-based): Generated using the current timestamp and the MAC address of the computer generating it. While unique, they can pose privacy risks because they reveal the exact time and machine that created them.
  • Version 4 (Random): Generated entirely using random numbers. This is the most widely used version today for general database keys and API identifiers.

Generating UUIDs for Development

When mocking data, writing tests, or setting up a database schema, you often need a handful of valid UUID v4 strings. Instead of opening a terminal and running python scripts, you can use our UUID Generator. It utilizes the browser's native cryptographic APIs to instantly generate secure, random UUID v4s that you can copy in bulk.