โ† Back to Blog

What Is a UUID? Complete Guide

2026-04-01 ยท 5 min read

Definition of UUID

UUID (Universally Unique Identifier) is a 128-bit (16-byte) numeric identifier designed to generate globally unique IDs without requiring a central coordinating authority. It is typically represented as hyphen-separated hexadecimal: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx โ€” 32 hexadecimal characters + 4 hyphens = 36 total characters.

A typical UUID example:

550e8400-e29b-41d4-a716-446655440000

Historical Background of UUID

UUID was developed by Apollo Computer in the early 1980s, originally for identifying network objects in distributed computing environments (Apollo Network Computing System). It was later incorporated by the Open Software Foundation (OSF) into the DCE (Distributed Computing Environment) specification, and ultimately became an IETF internet standard as RFC 4122. Microsoft popularized it as GUID (Globally Unique Identifier), essentially identical to UUID.

UUID Structure

UUID consists of five groups:

UUID Versions

RFC 4122 defined 5 UUID versions; the 2022 new RFC (RFC 9562) added versions 6, 7, and 8:

Primary Uses of UUID

UUID is widely used in software development for: database primary keys (avoiding predictable sequential auto-increment ID issues); unique ID generation across nodes in distributed systems (no global lock needed); API request tracing IDs (request_id); file naming or resource naming (avoiding conflicts); session IDs and tokens (but use cryptographically secure random number generation for stronger security needs); log correlation identifiers.

UUID Pros and Cons

Pros: global uniqueness (extremely low collision probability); no central coordinating authority needed; suitable for distributed systems; does not leak sequence information (version 4); standardized format with good cross-language, cross-platform support. Cons: 36 characters is much longer than integer IDs with higher storage and transmission overhead; random UUID B-tree index performance is poor (frequent page splits); poor readability, not intuitive for manual debugging; version 1 exposes MAC address posing privacy risk.

When to Use and Not Use UUID

Scenarios where UUID is recommended: distributed systems and microservices; needing to generate IDs on the client side (without depending on a server); needing to avoid exposing ID sequence (like order numbers that should not be predictable). Scenarios where UUID is not recommended: small single-machine applications (auto-increment IDs are simpler and more efficient); high-write scenarios with extreme sensitivity to database index performance (consider UUID v7 or ULID instead); scenarios requiring human-friendly IDs (like short links, invite codes).

Try the free tool now

Use Free Tool โ†’