# 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

| Type | Bits | Sortable | Timestamp | Format |
|------|------|----------|-----------|--------|
| UUIDv1 | 128 | No | Yes | `xxxxxxxx-xxxx-1xxx-xxxx-xxxxxxxxxxxx` |
| UUIDv4 | 128 | No | No | `xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx` |
| UUIDv6 | 128 | Yes | Yes | `xxxxxxxx-xxxx-6xxx-xxxx-xxxxxxxxxxxx` |
| UUIDv7 | 128 | Yes | Yes | `xxxxxxxx-xxxx-7xxx-xxxx-xxxxxxxxxxxx` |
| ULID | 128 | Yes | Yes | `01ARZ3NDEKTSV4RRFFQ69G5FAV` |
| NanoID | ~126 | No | No | `V1StGXR8_Z5jdHi6B-myT` |
| Snowflake | 64 | Yes | Yes | `1234567890123456789` |
| KSUID | 160 | Yes | Yes | `0ujsswThIGTUYm2K8FjOOfXtY1K` |
| ObjectId | 96 | Partial | Yes | `507f1f77bcf86cd799439011` |

## 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:

- [UUID Family](./uuid.md) - UUIDv1, v3, v4, v5, v6, v7, nil, max

### Modern Sortable IDs

These formats were designed specifically for modern distributed systems:

- [ULID](./ulid.md) - Universally Unique Lexicographically Sortable Identifier
- [Snowflake ID](./snowflake.md) - Twitter/Discord-style distributed ID

### Compact IDs

Shorter identifiers for specific use cases:

- [NanoID](./nanoid.md) - Compact, URL-friendly identifier

### Other Formats

Additional ID formats supported by idt:

- [Other ID Types](./others.md) - KSUID, ObjectId, TypeID, XID, CUID, TSID

## Generation Support

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

| Type | Generate | Inspect | Convert | Validate |
|------|----------|---------|---------|----------|
| UUIDv1 | Yes | Yes | Yes | Yes |
| UUIDv4 | Yes | Yes | Yes | Yes |
| UUIDv6 | Yes | Yes | Yes | Yes |
| UUIDv7 | Yes | Yes | Yes | Yes |
| UUID-nil | Yes | Yes | Yes | Yes |
| UUID-max | Yes | Yes | Yes | Yes |
| ULID | Yes | Yes | Yes | Yes |
| NanoID | Yes | Yes | Yes | Yes |
| Snowflake | Yes | Yes | Yes | Yes |

## Further Reading

- [UUID Family](./uuid.md) - Detailed UUID version information
- [ULID](./ulid.md) - ULID specification and usage
- [NanoID](./nanoid.md) - NanoID customization options
- [Snowflake ID](./snowflake.md) - Distributed ID generation
- [Other ID Types](./others.md) - Additional formats
