What Is a Universally Unique Identifier (UUID)?

Published on 26 Aug 2025
computer science

A Universally Unique Identifier — commonly called a UUID — is a 128-bit value used to uniquely identify data across systems, databases, networks, and applications. UUIDs are designed so that the chance of two identical values being generated independently is astronomically small — meaning systems can safely create identifiers without coordination.

A UUID is usually represented as a 36-character string:

550e8400-e29b-41d4-a716-446655440000

Behind the scenes, that string represents 128 bits of data.

UUIDs are widely used in distributed systems, APIs, event logs, database keys, and anywhere uniqueness matters.


What Is a UUID?

At its core, a UUID is:

  • 128 bits long

  • typically displayed in hexadecimal

  • split into 5 sections (8-4-4-4-12 format)

  • designed for global uniqueness without a central authority

Unlike auto-incrementing numeric IDs, UUIDs can be generated:

  • on different servers

  • offline

  • across regions

  • across databases

…and still be effectively unique.


UUID vs GUID

You’ll often see UUID and GUID used interchangeably — but there’s a small distinction:

Term Meaning
UUID Defined by the IETF / RFC 4122 standard
GUID Microsoft’s implementation of UUIDs

In practice:

  • A GUID is a type of UUID

  • The formats and behaviour are nearly identical

  • The naming difference mainly comes from ecosystem history

So while the terminology differs, for most engineering purposes they refer to the same concept.


UUID Versions

UUIDs come in multiple versions — each with a different generation strategy.

UUIDv1 — Time-based

  • Uses timestamp + MAC address

  • Predictable and can reveal system details

  • Rarely recommended today

UUIDv3 — Name-based (MD5)

  • Deterministic: same input → same UUID

  • Uses MD5 hashing

UUIDv4 — Random

  • The most common version

  • Uses random or pseudo-random numbers

  • Simple and highly unique

Example:

3f8c5d6b-2a1e-4f91-82c3-b3c6f3c17c44

UUIDv5 — Name-based (SHA-1)

  • Like v3 but uses SHA-1

  • Deterministic and namespace-driven

UUIDv7 — Time-ordered (emerging standard)

  • Based on timestamps but privacy-safe

  • Sorts better in databases than v4

  • Increasingly popular in modern systems


Chances of Collisions

Because UUIDs are so large (128 bits), collisions are extremely unlikely.

For UUIDv4:

  • There are 3.4 × 10³⁸ possible combinations

  • You would need to generate billions per second for millions of years to expect a collision

  • The probability is often compared to two random grains of sand on Earth being identical

In practice, UUID collisions are considered negligible outside of malicious or broken implementations.


Use Cases

UUIDs are ideal when you need unique identifiers across systems.

Common examples include:

  • Primary keys in distributed databases

  • Identifying users, sessions, or devices

  • Event IDs in logging systems

  • API resource identifiers

  • Object identifiers in microservices

  • Offline-generated records later synced to a server

They’re especially useful when multiple systems create records independently, without relying on a central counter.


How to Generate a UUID

UUIDs are built into most programming languages and tools.

Examples:

Python

import uuid uuid.uuid4()

JavaScript / Node.js

import { randomUUID } from 'crypto'; randomUUID();

Linux CLI

uuidgen

PostgreSQL

SELECT gen_random_uuid();

Go

import "github.com/google/uuid" uuid.New()

Most frameworks also provide helpers or libraries for UUID generation.


Summary

UUIDs are 128-bit globally unique identifiers designed for safe, collision-resistant identification across systems — without requiring coordination. While GUIDs are Microsoft’s variant, they function much the same.

Key takeaways:

  • UUIDs come in multiple versions (v4 is most common, v7 is rising)

  • Collisions are practically impossible

  • Ideal for distributed and offline-generated records

  • Easy to generate in nearly any language