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

Encoding Formats

idt supports various encoding formats for converting and displaying IDs.

Available Formats

FormatDescriptionExample (128-bit UUID)
canonicalOriginal/standard format550e8400-e29b-41d4-a716-446655440000
hexHexadecimal (lowercase)550e8400e29b41d4a716446655440000
base32RFC 4648 Base32KUHIBAASSNE5JJYWIRDFKRAAAA
base58Bitcoin-style Base586K8FVbLqP4V8nDqTJNXH6k
base64Standard Base64VQ6EAOKbQdSnFkRmVUQAAA==
base64urlURL-safe Base64VQ6EAOKbQdSnFkRmVUQAAA
bitsBinary string01010101000011101000...
intInteger representation113059749145936325402354257176981405696
bytesSpace-separated hex bytes55 0e 84 00 e2 9b 41 d4...

Format Details

Canonical

The standard format for each ID type:

  • UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (36 characters)
  • ULID: 26 Crockford Base32 characters
  • NanoID: Variable length (default 21 characters)
  • Snowflake: Decimal integer
idt convert "$ID" -f canonical

Hexadecimal (hex)

Raw bytes as hexadecimal characters (lowercase).

  • Length: 2 characters per byte
  • Characters: 0-9, a-f
  • Use case: Database storage, binary comparison
idt convert 550e8400-e29b-41d4-a716-446655440000 -f hex
# Output: 550e8400e29b41d4a716446655440000

Base32

RFC 4648 Base32 encoding (without padding).

  • Characters: A-Z, 2-7
  • Use case: Case-insensitive encoding, DNS-safe
idt convert 550e8400-e29b-41d4-a716-446655440000 -f base32
# Output: KUHIBAASSNE5JJYWIRDFKRAAAA

Base58

Bitcoin-style Base58 encoding (excludes 0, O, I, l).

  • Characters: 1-9, A-H, J-N, P-Z, a-k, m-z
  • Use case: User-friendly, avoids ambiguous characters
idt convert 550e8400-e29b-41d4-a716-446655440000 -f base58
# Output: 6K8FVbLqP4V8nDqTJNXH6k

Base64

Standard Base64 encoding with padding.

  • Characters: A-Z, a-z, 0-9, +, /, =
  • Use case: Email-safe encoding, general data encoding
idt convert 550e8400-e29b-41d4-a716-446655440000 -f base64
# Output: VQ6EAOKbQdSnFkRmVUQAAA==

Base64 URL-safe (base64url)

URL-safe Base64 without padding.

  • Characters: A-Z, a-z, 0-9, -, _
  • Use case: URLs, filenames, HTTP headers
idt convert 550e8400-e29b-41d4-a716-446655440000 -f base64url
# Output: VQ6EAOKbQdSnFkRmVUQAAA

Binary (bits)

Binary string representation.

  • Characters: 0, 1
  • Use case: Bit-level analysis, debugging
idt convert 550e8400-e29b-41d4-a716-446655440000 -f bits
# Output: 0101010100001110100001000000000011100010...

Integer (int)

Decimal integer representation.

  • Characters: 0-9
  • Use case: Numeric comparison, database integer columns
idt convert 550e8400-e29b-41d4-a716-446655440000 -f int
# Output: 113059749145936325402354257176981405696

Note: 128-bit IDs produce very large integers that may overflow in some languages.

Bytes

Space-separated hexadecimal bytes.

  • Use case: Byte-level inspection, debugging
idt convert 550e8400-e29b-41d4-a716-446655440000 -f bytes
# Output: 55 0e 84 00 e2 9b 41 d4 a7 16 44 66 55 44 00 00

Comparison Table

FormatLength (128-bit)URL-SafeHuman-Readable
canonical36NoGood
hex32YesFair
base3226YesFair
base58~22YesGood
base6424NoFair
base64url22YesFair
bits128YesPoor
int~39YesPoor
bytes47NoGood

Usage Examples

Convert Command

# Convert to specific format
idt convert "$ID" -f hex
idt convert "$ID" -f base64
idt convert "$ID" -f base58

# With case transformation
idt convert "$ID" -f hex -U    # Uppercase
idt convert "$ID" -f hex -L    # Lowercase

Generate with Format

# Generate in specific format
idt gen uuid -f hex
idt gen uuidv7 -f base64

Inspect Output

The inspect command shows multiple formats automatically:

$ idt inspect 550e8400-e29b-41d4-a716-446655440000
UUIDV4
  550e8400-e29b-41d4-a716-446655440000

  Hex        550e8400e29b41d4a716446655440000
  Base64     VQ6EAOKbQdSnFkRmVUQAAA==
  Int        113059749145936325402354257176981405696

Choosing a Format

Use CaseRecommended Format
Database storagehex or canonical
URLs and APIsbase64url or base58
Display to userscanonical or base58
Compact storagebase58 or base64url
Cross-system compatibilityhex
Debuggingbytes or bits