CacheHackCacheHack

ASCII85 / Base85

Encode and decode ASCII85 (Base85) - efficient binary-to-text encoding used in PostScript and PDF.

With or without <~ ~> delimiters

How ASCII85 Works

  • • Groups 4 bytes into a 32-bit integer
  • • Converts to base-85 (5 characters in range ! to u)
  • • Uses printable ASCII characters 33-117
  • • 'z' is shorthand for five '!' characters (all zeros)
  • • Delimiters: <~ starts, ~> ends

Encoding Efficiency

EncodingExpansionCharacters Used
Hex100%16 (0-9, A-F)
Base3260%32
Base6433%64
ASCII8525%85

ASCII85 Character Set

!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu

ASCII codes 33 (!) through 117 (u)

Puzzle Tips

  • • Look for <~ and ~> delimiters
  • • Often found in PDF or PostScript files
  • • More compact than Base64 (25% vs 33% expansion)
  • • May appear in tech/programming themed puzzles

What is ASCII85?

ASCII85 (also called Base85) is a binary-to-text encoding that represents 4 bytes of binary data using 5 ASCII characters. It's more efficient than Base64, expanding data by only 25% instead of 33%.

How It Works

The Algorithm

  1. Group input into 4-byte chunks
  2. Treat each chunk as a 32-bit big-endian number
  3. Convert to base-85 (five digits)
  4. Add 33 to each digit to get printable ASCII

Character Set

Uses ASCII characters 33-117 (! through u), giving 85 possible values. This is why it's called Base85.

btoa Format

The btoa variant (used in PostScript and PDF) wraps output in <~and ~> delimiters and uses z as shorthand for a group of all zeros.

Variants

  • btoa: Original Unix format with delimiters
  • Adobe: Used in PostScript and PDF
  • Z85: ZeroMQ variant with different character set
  • RFC 1924: IPv6 encoding variant

In Puzzles

ASCII85 appears in:

  • PDF puzzles: Embedded in PDF documents
  • Programming themes: Technical/coding puzzles
  • Efficiency tests: When Base64 seems too obvious
  • PostScript art: Hidden in graphics

Recognition

Look for ASCII85 when you see:

  • <~ and ~> delimiters
  • Mixed punctuation and alphanumeric characters
  • The letter 'z' appearing alone (zero shorthand)
  • Characters in the range ! to u

Related Encodings

  • Base64: More common but less efficient.
  • Base32: Case-insensitive alternative.
  • Hexadecimal: Simple but inefficient.