Which UUID should I use?

A developer-friendly guide to picking the right UUID type for the job.

Quick Guidance

Start with the shortest answer, then drill into the full type guide below.

Use UUID v7 for most new applications.
Use UUID v4 when you need random UUIDs and broad compatibility.
Use UUID v5 when you need the same input to always generate the same UUID.
Use UUID v1 or v6 only when you specifically need timestamp-based UUIDs for legacy or compatibility reasons.

Recommended

1 UUID types in this group.

Recommended

UUID v7

Time-ordered and modern default for application identifiers.

Recommended

Best for

Database IDs, event IDs, and API resources

Avoid when

You need deterministic generation from repeated input

Sortable: Yes
Timestamp: Yes
Deterministic: No

Common

1 UUID types in this group.

Common

UUID v4

Random UUID with broad tooling compatibility.

Most common

Best for

General-purpose random identifiers

Avoid when

You need ordered identifiers for indexed writes

Sortable: No
Timestamp: No
Deterministic: No

Deterministic

2 UUID types in this group.

Deterministic

UUID v5

Namespace-plus-name UUID using SHA-1 hashing.

Deterministic

Best for

Stable IDs from repeated namespace/name input

Avoid when

You need random or time-ordered UUID output

Sortable: No
Timestamp: No
Deterministic: Yes

UUID v3

Namespace-plus-name UUID using MD5 hashing.

Deterministic

Best for

Legacy deterministic UUID compatibility use cases

Avoid when

You need newer hashing or time-ordered UUIDs

Sortable: No
Timestamp: No
Deterministic: Yes

Advanced

3 UUID types in this group.

Advanced

UUID v1

Timestamp and node-based UUID from older standards.

Advanced

Best for

Legacy systems requiring v1 compatibility

Avoid when

You want modern defaults or simplified privacy concerns

Sortable: Yes
Timestamp: Yes
Deterministic: No

UUID v6

Reordered timestamp UUID for improved sorting behavior.

Advanced

Best for

Advanced time-ordered compatibility requirements

Avoid when

You can use v7 as the simpler modern choice

Sortable: Yes
Timestamp: Yes
Deterministic: No

UUID v8

Custom-layout UUID format for specialized needs.

Advanced

Best for

Custom UUID schemes with explicit constraints

Avoid when

You need standard default behavior with broad interoperability

Sortable: No
Timestamp: No
Deterministic: No

Special

2 UUID types in this group.

Special

Nil UUID

All-zero UUID used as a sentinel placeholder value.

Special

Best for

Explicit empty/sentinel UUID value handling

Avoid when

You need a unique generated identifier

Sortable: No
Timestamp: No
Deterministic: Yes

Max UUID

All-ones UUID used as an upper-bound sentinel value.

Special

Best for

Upper-bound comparison and sentinel range checks

Avoid when

You need a unique generated identifier

Sortable: No
Timestamp: No
Deterministic: Yes