Z85 encoder and decoder — ZeroMQ Base85 for keys and binary data

Encode bytes as Z85, the Base85 variant from ZeroMQ RFC 32 that is safe inside source code strings, or decode Z85 back to text or hex. Input must be a multiple of 4 bytes, and the tool tells you how far off you are.

Live demo · real result from this tool
Direction
Bytes from

Encoded

nm=QNzY<mxA+]nf

Processed on your device — nothing is uploaded.

How to use the Z85 tool

  1. Set Direction to Encode or Decode.
  2. Set Bytes from to Text (UTF-8) or Hex.
  3. Paste your input. For encoding, the byte count must divide by 4; for decoding, the character count must divide by 5.
  4. Copy the result. With Hex selected, decoded output is shown as hex bytes.

What it does and when to use it

Z85 is a Base85 encoding published by the ZeroMQ project as RFC 32. It was designed to write binary keys as short text that can be embedded in program source code, configuration files and command lines without any escaping.

Use it to convert a ZeroMQ CURVE key between hex and Z85, to check the output of your own Z85 implementation, or to encode any fixed-size binary value compactly. Z85 adds 25% to the size, less than Base64’s 33%.

If your data length is not a multiple of 4 and you control the format, Ascii85 handles any length. For values that go into URLs, Base64URL is the usual choice, and Base58 avoids look-alike characters for human copying.

How it works

The rules come from ZeroMQ RFC 32:

  1. The bytes are read four at a time as a 32-bit number, most significant byte first.
  2. Each number is written as five base-85 digits, most significant first.
  3. Each digit picks a character from the Z85 alphabet: 0–9, a–z, A–Z, then .-:+=^!/*?&<>()[]{}@%$#.

Decoding reverses this, checks that every character is in the alphabet and that no 5-character group is worth more than a 32-bit number can hold. Spaces and line breaks in the input are ignored. Everything runs in your browser.

Worked examples

86 4F D2 6F B5 59 F7 5B   (Hex)           →  HelloWorld
HelloWorld                (Decode, Hex)   →  86 4f d2 6f b5 59 f7 5b
Hello world!              (Text)          →  nm=QNzY<mxA+]nf
abc                       (Text)          →  Z85 needs a byte length that is a multiple of 4;
                                             this input is 3 bytes (1 short of the next multiple).

The first line is the test vector from the specification: those 8 bytes spell “HelloWorld” in Z85. “Hello world!” is 12 bytes, so it encodes to 15 characters. “abc” is 3 bytes and is refused.

Limits and tips

  • To encode text whose length is not a multiple of 4 bytes, add padding yourself and agree with the receiver how to remove it.
  • Remember that accented letters and emoji take 2 to 4 bytes in UTF-8, so the byte count may differ from the character count.
  • Z85 output can contain characters such as <, > and &. Escape them if you place a Z85 string inside HTML or XML.

Frequently asked questions

Why must the input be a multiple of 4 bytes?
Z85 has no padding. The ZeroMQ specification requires a length divisible by 4 and leaves any padding to the application. The tool does not pad for you, because silent padding would change your data. It tells you how many bytes you are short instead.
How is Z85 different from Ascii85?
Same idea, 4 bytes to 5 characters, but a different alphabet. Z85 avoids quote marks, the backslash and the space, so the result can be pasted into a C, Python or JSON string without escaping. It also has no z shortcut and no delimiters.
Where is Z85 used?
Mainly in ZeroMQ, where CURVE security keys are 32 bytes and are written as 40-character Z85 strings in configuration files. Other projects use it when they need compact, copy-safe text for binary values.
When should I choose Hex for "Bytes from"?
When your data is binary, such as a key. In Hex mode you type the bytes when encoding, and the decoder shows bytes as hex instead of trying to read them as text.
Does Z85 keep my key secret?
No. Z85 is only an encoding and anyone can reverse it. A secret key written in Z85 must be protected exactly like the raw key.

Sources

  1. 32/Z85 — ZeroMQ Base-85 Encoding Algorithm — ZeroMQ RFC, accessed 2026-10-08

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close