Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ID Types Overview

idt supports a wide variety of identifier formats, from the ubiquitous UUID to modern alternatives like ULID and Snowflake IDs.

Quick Comparison

TypeBitsSortableTimestampFormat
UUIDv1128NoYesxxxxxxxx-xxxx-1xxx-xxxx-xxxxxxxxxxxx
UUIDv4128NoNoxxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx
UUIDv6128YesYesxxxxxxxx-xxxx-6xxx-xxxx-xxxxxxxxxxxx
UUIDv7128YesYesxxxxxxxx-xxxx-7xxx-xxxx-xxxxxxxxxxxx
ULID128YesYes01ARZ3NDEKTSV4RRFFQ69G5FAV
NanoID~126NoNoV1StGXR8_Z5jdHi6B-myT
Snowflake64YesYes1234567890123456789
KSUID160YesYes0ujsswThIGTUYm2K8FjOOfXtY1K
ObjectId96PartialYes507f1f77bcf86cd799439011

Choosing an ID Type

For New Projects

Recommended: UUIDv7 or ULID

Both provide:

  • Time-sortable ordering
  • Embedded timestamps
  • 128-bit uniqueness
  • Wide compatibility

Choose UUIDv7 if you need UUID compatibility (existing databases, APIs). Choose ULID if you want a more compact string representation.

For Distributed Systems

Recommended: Snowflake ID

  • 64-bit (fits in a long integer)
  • Extremely high throughput
  • Guaranteed ordering within a datacenter
  • Requires coordination (machine/datacenter IDs)

For URL-Safe Short IDs

Recommended: NanoID

  • Customizable length and alphabet
  • URL-safe by default
  • No timestamp (pure random)

For Legacy Compatibility

UUIDv4 remains the most widely supported format.

ID Type Categories

UUID Family

The UUID (Universally Unique Identifier) family includes several versions, each with different generation strategies:

Modern Sortable IDs

These formats were designed specifically for modern distributed systems:

  • ULID - Universally Unique Lexicographically Sortable Identifier
  • Snowflake ID - Twitter/Discord-style distributed ID

Compact IDs

Shorter identifiers for specific use cases:

  • NanoID - Compact, URL-friendly identifier

Other Formats

Additional ID formats supported by idt:

Generation Support

Not all ID types can be generated by idt. Here’s what’s supported:

TypeGenerateInspectConvertValidate
UUIDv1YesYesYesYes
UUIDv4YesYesYesYes
UUIDv6YesYesYesYes
UUIDv7YesYesYesYes
UUID-nilYesYesYesYes
UUID-maxYesYesYesYes
ULIDYesYesYesYes
NanoIDYesYesYesYes
SnowflakeYesYesYesYes

Further Reading