Logo

MonoCalc

/

Z85 Decoder

Encode/Decode

Z85 Encoded Input

RFC 32
Z85 input length (after stripping whitespace) must be a multiple of 5. Each group of 5 characters decodes to 4 bytes.

About This Tool

🔓 Z85 Decoder – Decode ZeroMQ RFC 32 Encoded Strings

The Z85 Decoder converts Z85-encoded ASCII strings back to their original binary representation. Z85, defined in ZeroMQ RFC 32, is a binary-to-text encoding scheme that maps every 4 bytes of data to exactly 5 printable ASCII characters. This makes Z85 strings safe inside C, Python, JSON, XML, shell scripts, and most text-based protocols.

What is Z85 and Why Does It Exist?

Binary data cannot always be transported as-is through text channels. Base64 solves this by expanding every 3 bytes to 4 characters (33% overhead). Z85 does better: it represents 4 bytes as 5 characters (25% overhead). The 85-character alphabet — 0–9, a–z, A–Z, and .-:+=^!/*?<>()[]@%$# — avoids quote marks and backslash, making Z85 output safe in virtually any source-code context without escaping.

Z85 is most widely used in the ZeroMQ messaging library, where it encodes Curve25519 public and private keys (32 bytes → 40 Z85 characters) for the CurveZMQ security handshake.

How Z85 Decoding Works

Each group of 5 Z85 characters is decoded to 4 binary bytes using these steps:

  1. Validate — confirm input length is a multiple of 5 and every character belongs to the 85-character Z85 alphabet.
  2. Look up indices — each character maps to an integer 0–84 in the Z85 alphabet table.
  3. Combine — compute v = c₀×85⁴ + c₁×85³ + c₂×85² + c₃×85 + c₄.
  4. Extract bytes — split the 32-bit value into 4 big-endian bytes: byte[i] = (v >> (24 − 8i)) & 0xFF.

Output Formats

FormatDescriptionBest For
Hex DumpOffset + hex octets + ASCII sidebarBinary inspection & debugging
UTF-8 TextDecoded bytes rendered as readable textText payloads & config values
Base64Decoded bytes re-encoded as Base64Interoperability with Base64 systems
C Arrayuint8_t data[] = {0xHH, …}Embedding bytes in C / C++ code
Python Bytesb'\xHH\xHH…'Python scripts & data science
JavaScript Uint8Arraynew Uint8Array([0xHH, …])Browser / Node.js buffers

CurveZMQ Key Decoding

CurveZMQ uses 40-character Z85 strings to represent 32-byte Curve25519 keys. When the decoder receives exactly 40 Z85 characters, it automatically highlights the result as a potential cryptographic key and renders the 32 bytes in a 4×8 hex grid for easy visual inspection.

Validation Rules

Length must be a multiple of 5

Z85 encodes 4 bytes per 5 chars — no partial blocks allowed

Only Z85 alphabet characters

Any character outside the 85-char set triggers an error with position

Non-empty input required

Empty or whitespace-only input is rejected before decoding

Strip Whitespace option

Enable to auto-remove spaces and newlines from pasted data

Z85 vs Other Encoding Schemes

Z85 achieves 25% size overhead compared to the original binary — better than Base64 (33%) and Base16/Hex (100%). However, unlike Base64, Z85 mandates input that is an exact multiple of 4 bytes, so zero- padding may be needed at the encoding stage. Use the Z85 Encoder companion tool when you need to encode binary data to Z85 before decoding it here.

Common Use Cases

  • CurveZMQ key inspection — decode Curve25519 public or private keys exchanged in ZeroMQ security handshakes
  • Protocol debugging — inspect binary payloads embedded as Z85 in configuration files or network messages
  • Round-trip verification — confirm that a Z85 encode → decode cycle recovers the original bytes without loss
  • Code generation — paste a Z85 string and instantly get the byte literals needed in your C, Python, or JavaScript program

Frequently Asked Questions

Is the Z85 Decoder free?

Yes, Z85 Decoder is totally free :)

Can I use the Z85 Decoder offline?

Yes, you can install the webapp as PWA.

Is it safe to use Z85 Decoder?

Yes, any data related to Z85 Decoder only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

What is Z85 decoding and how does it work?

Z85 decoding reverses the ZeroMQ RFC 32 encoding process. Every group of 5 Z85 characters is converted back to a 32-bit integer by looking up each character's index (0–84) in the Z85 alphabet, and then the 4 constituent bytes are extracted from that integer in big-endian order.

Why must my Z85 input length be a multiple of 5?

Z85 encodes exactly 4 bytes as exactly 5 characters. Any input whose length is not a multiple of 5 cannot represent a whole number of 4-byte blocks, making it structurally invalid. This decoder will report the exact length and the nearest valid multiples.

What output formats does this decoder support?

The decoder outputs the recovered bytes as a formatted hex dump (offset + hex + ASCII), UTF-8 text (if the bytes are valid text), Base64 re-encoding, and language-specific byte array literals for C, Python, JavaScript, and Go.

Can I use this tool to decode CurveZMQ keys?

Yes. CurveZMQ Curve25519 public and private keys are represented as 40-character Z85 strings (32 bytes). When you paste a 40-character Z85 string the decoder highlights it as a potential 32-byte cryptographic key and shows the key bytes in a 4×8 hex grid.

Is Z85 the same as Base85 or ASCII85?

Z85 is a Base85 variant defined in ZeroMQ RFC 32. It uses a different 85-character alphabet than Adobe ASCII85 (which uses ! to u and the <~ ~> delimiters). Z85 and ASCII85 encode 4 bytes as 5 characters but are not interchangeable — always verify which variant your system uses.

What is the Z85 character set used for decoding?

The Z85 alphabet is: 0–9, a–z, A–Z, and the symbols .-:+=^!/*?&<>()[]{}@%$# — exactly 85 printable ASCII characters. Any character outside this set is invalid and will cause a decoding error with the exact position reported.