FormatterHQ

Zlib Decompress

Inflate zlib-compressed data — or raw DEFLATE — pasted as Base64 or hex, and read the original text or save the bytes.

Input TEXT
Output TEXT
Ready.

How to use the Zlib Decompress

  1. Paste the compressed data as Base64 or hex into the input editor, upload a file, or click Sample to load an example.
  2. Leave Input encoding on Auto-detect, or choose Base64 or Hex.
  3. Click Decompress in the options panel. With Auto update ticked, the result refreshes as you type.
  4. Copy the result from the output panel or download it as a file.

Zlib decompress (inflate) text data

The zlib decompress tool inflates data compressed with DEFLATE. It first tries the zlib format (RFC 1950) — the output of Python’s zlib.compress, PHP’s gzcompress, Java’s Deflater or Node’s zlib.deflateSync — and if the header does not match, it automatically retries as raw DEFLATE (RFC 1951), the format of PHP’s gzdeflate and ZIP entries.

Example

Zlib data (Base64):

eJzzSM3JyVcozy/KSVFU8MDFAQAGNw1Y

Decompressed:

Hello world! Hello world! Hello world!

Recognising the input

  • Zlib data in Base64 usually starts with eJ (bytes 78 9C) or eN (78 DA); eA and eF appear at lower compression levels.
  • In hex it starts with 78. Auto-detect treats all-hex input starting with 78 as hex; otherwise Base64 is assumed.
  • URL-safe Base64, missing padding and line breaks are handled.

The status bar shows how many bytes went in and how many came out, which gives you the compression ratio at a glance and confirms that the whole stream was decoded.

What the two header bytes mean

A zlib stream starts with two bytes. The first, 78, says “DEFLATE with a 32 KB window”; the second records the compression level the encoder used and makes the pair divisible by 31, which is how decoders detect a valid header:

HexBase64 prefixLevel hint
78 01eAE–eAHfastest / none
78 5EeF4–eF7low
78 9CeJw–eJzdefault
78 DAeNo–eNrbest compression

The third Base64 character also depends on the first byte of compressed data, hence the ranges. The stream ends with the Adler-32 checksum of the original data, big-endian. In the example above the last four bytes are 06 37 0D 58, the Adler-32 of the decompressed text.

Where zlib data turns up

  • Application databases and caches that store compressed JSON or serialized objects.
  • SAML redirect requests, which are raw-DEFLATE compressed and Base64 encoded (URL-decode them first).
  • Git loose objects in .git/objects are zlib streams — convert the file to Base64 first to inspect one.
  • PDF content streams with the FlateDecode filter.

Compressed payloads are often wrapped in further layers — URL encoding around Base64, or JSON around the Base64 string. Peel them off from the outside in: URL-decode, extract the string, then decompress here.

Inflating in code

Python’s zlib.decompress(data) expects the zlib header; pass wbits=-15 for raw DEFLATE, or wbits=47 to auto-detect zlib and gzip. Node.js offers zlib.inflateSync and zlib.inflateRawSync, and PHP gzuncompress and gzinflate for the two formats. Choosing the wrong one is the most common cause of “incorrect header check” errors — this tool simply tries both.

Troubleshooting

  • Input starts with H4sI or 1f8b. That is gzip, not zlib. The gzip header is recognised and the data is decompressed here as well; Gzip Decompress is the dedicated page.
  • “invalid stored block lengths”, “invalid block type” or “unexpected end of file”. The data is incomplete, corrupted, or not compressed at all.
  • Unreadable output. The content is binary; download it with the output panel’s Download button.

To create zlib data, use Zlib Compress; for plain Base64 without compression, use Base64 Decode. Decompression runs in your browser and nothing is uploaded.

Zlib decompress in Python

zlib.decompress() works on bytes, so Base64 or hex text must be decoded first; passing the string itself raises TypeError: a bytes-like object is required. The other frequent error is incorrect header check, which means the data is not in zlib format. Raw DEFLATE needs wbits=-15, and wbits=47 accepts both zlib and gzip. The result is bytes again, so finish with .decode("utf-8") for text.

import base64
import zlib

encoded = "eJzzSM3JyVcozy/KSVFU8MDFAQAGNw1Y"

data = base64.b64decode(encoded)       # zlib needs bytes, not the Base64 text
print(data[:2].hex())                  # 789c = zlib header
print(zlib.decompress(data).decode("utf-8"))

# raw DEFLATE (no header): negative wbits
raw = data[2:-4]
print(zlib.decompress(raw, wbits=-15).decode("utf-8"))

The decompressor above returns the same text for this Base64 string and tries zlib and raw DEFLATE automatically; gzip data belongs in Gzip Decompress.

Frequently asked questions

Does it handle raw DEFLATE without a zlib header?
Yes. If inflating as zlib fails, the tool automatically tries raw DEFLATE, so output from PHP’s gzdeflate or similar functions also works.
How do I decompress a SAMLRequest?
URL-decode the parameter first, then paste the Base64 value here. The raw-DEFLATE fallback inflates it to the SAML XML.
What is the difference between inflate and decompress?
Inflate is the traditional name for decompressing DEFLATE data, the opposite of deflate. In this context the terms mean the same thing.
Why do I get “invalid stored block lengths”?
The data could not be inflated as zlib, gzip or raw DEFLATE, and this is the message of the last attempt. The input may be truncated or corrupted, use another compression format, or not be compressed at all.

Last updated October 3, 2026

Related tools