# What is a UUID?

> A UUID (Universally Unique Identifier) is a 128-bit identifier formatted as a 36-character string, designed to be unique across space and time without a central authority.

- URL: https://www.browserutils.dev/glossary/uuid
- Published: 2026-03-21
- Updated: 2026-03-16

---

**UUID (Universally Unique Identifier)** is a 128-bit identifier, standardized in RFC 9562, formatted as a 36-character string of hexadecimal digits separated by hyphens (e.g., `550e8400-e29b-41d4-a716-446655440000`). UUIDs are designed to be unique across space and time without requiring a central authority — making them ideal for distributed systems, database primary keys, and request tracing.

## UUID versions

There are several UUID versions, each using a different generation strategy:

- **v1**: Based on timestamp and MAC address. Guarantees uniqueness but leaks the machine's network address.
- **v4**: Generated from random or pseudo-random numbers. The most commonly used version — 122 random bits make collisions astronomically unlikely.
- **v5**: Derived from a namespace and a name using SHA-1 hashing. Deterministic — the same input always produces the same UUID.
- **v7**: A newer format (RFC 9562) that combines a Unix timestamp with random bits, making UUIDs sortable by creation time while remaining unique.

## The format

A UUID follows the pattern `xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx`, where `M` indicates the version and `N` indicates the variant. The 8-4-4-4-12 grouping is purely cosmetic — the underlying value is just 128 bits.

```
550e8400-e29b-41d4-a716-446655440000
        │    │
        │    └─ version (4 = random)
        └─ variant bits
```

## Why developers use UUIDs

UUIDs solve the problem of generating unique identifiers in distributed systems where you can't rely on a single database sequence. They're standard as primary keys in databases, correlation IDs in microservices, session tokens, and resource identifiers in REST APIs.

Compared to auto-incrementing integers, UUIDs don't reveal how many records exist and can be generated on any node without coordination. The downside is size — 36 characters vs. a compact integer — and their randomness makes B-tree indexing less efficient (v7 addresses this by being time-sorted).

## Practical examples

In JavaScript: `crypto.randomUUID()` generates a v4 UUID natively. In Python: `uuid.uuid4()`. In PostgreSQL: `gen_random_uuid()`.

Generate UUIDs instantly with the [UUID Generator](/tools/uuid-generator). If you need shorter, URL-friendly identifiers, check the [NanoID Generator](/tools/nanoid-generator) — it produces compact IDs with comparable collision resistance.

## Collision probability

A v4 UUID has 2^122 possible values. You'd need to generate about 2.7 quintillion UUIDs to have a 50% chance of a single collision. In practice, you will never see one.