What is uuid

Last updated: April 1, 2026

Quick Answer: A UUID (Universally Unique Identifier) is a 128-bit number used to uniquely identify information in computer systems. It's expressed as a 32-character hexadecimal string and has an extremely low probability of collision.

Key Facts

Overview

A UUID (Universally Unique Identifier), also known as a GUID in some contexts, is a standardized 128-bit identifier designed to uniquely identify objects, entities, or information across distributed computer systems without requiring a central registry or coordination. The UUID standard was formalized by the Internet Engineering Task Force (IETF) and is specified in RFC 4122. Unlike sequential numbering systems that require central management, UUIDs are designed to be globally unique with virtually no collision risk, making them ideal for decentralized systems, databases, and distributed applications where coordination is impractical or impossible.

UUID Structure and Format

A UUID is represented as a 32-character hexadecimal string divided into five groups: 8-4-4-4-12 format. Each group represents different segments of the 128-bit identifier:

An example UUID appears as: 550e8400-e29b-41d4-a716-446655440000. The hyphens are included for readability but are optional in some applications.

UUID Versions and Generation Methods

UUID v1 (Time-based): Uses timestamps and MAC addresses, ensuring uniqueness based on when and where generated. Requires hardware identification.

UUID v3 (MD5-based): Uses MD5 hashing of a namespace and name, producing the same UUID for identical inputs.

UUID v4 (Random): Generated entirely from random numbers, most commonly used in modern systems. No central coordination needed.

UUID v5 (SHA-1-based): Uses SHA-1 hashing, similar to v3 but with stronger hashing. Produces deterministic results for identical inputs.

UUID v4 is the most popular version for new applications due to its simplicity and lack of privacy concerns associated with hardware identifiers in v1.

Applications and Use Cases

UUIDs are essential in numerous computing contexts:

Advantages and Considerations

UUIDs eliminate the need for central ID assignment authorities, crucial for distributed and microservices architectures. Their 128-bit length provides virtually zero collision probability across all practical applications. However, UUIDs consume more storage space than sequential integer IDs and are less human-readable. Some developers prefer shorter identifiers for specific use cases, though UUIDs remain the standard for globally distributed systems. Modern databases and frameworks provide native UUID support, making implementation straightforward.

Related Questions

How are UUIDs generated?

UUID generation varies by version. UUID v4 (most common) uses cryptographic random number generation. UUID v1 uses timestamps combined with MAC addresses. UUID v5 uses SHA-1 hashing of namespaces and names. Each method ensures extremely low collision probability.

What is the difference between UUID and GUID?

UUID is the international standard specification (RFC 4122) for universally unique identifiers, while GUID is Microsoft's implementation of the UUID standard. GUIDs follow the UUID format but are specific to Microsoft technologies. The terms are often used interchangeably.

Why are UUIDs used in databases?

UUIDs enable distributed database systems to generate unique primary keys without central coordination. Unlike auto-increment IDs that require database communication, UUIDs can be generated locally, essential for microservices and database replication scenarios.

Sources

  1. Wikipedia - Universally Unique Identifier CC-BY-SA-3.0
  2. IETF RFC 4122 - Universally Unique Identifier Public Domain