FormatterHQ

Gzip Decompress

Decompress gzip data pasted as Base64 or hex — such as H4sI… strings from APIs, logs or cookies — and read the original text.

Input TEXT
Output TEXT
Ready.

How to use the Gzip Decompress

  1. Paste the gzip data encoded 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.

Gzip decompress Base64 and hex strings

Compressed data often travels as text: API responses that embed gzipped JSON, message queue payloads, CloudWatch Logs subscription data, Helm release records stored in Kubernetes secrets, or database columns. The gzip decompress tool takes that text — Base64 or hex — unpacks the gzip stream and shows the original content.

Example

Gzip data (Base64):

H4sIAAAAAAAAA/NIzcnJVyjPL8pJUVTwwMUBAFSjmmImAAAA

Decompressed:

Hello world! Hello world! Hello world!

Recognising gzip data

  • In Base64, gzip streams almost always start with H4sI — the encoding of the magic bytes 1F 8B 08.
  • In hex, they start with 1f8b. Auto-detect picks hex when the input consists only of hex digits and begins with 1f8b.
  • URL-safe Base64 (- and _), missing padding, line breaks and a data: URI prefix are all accepted.

What the gzip header tells you

The example above decodes to bytes that start 1f 8b 08 00 00 00 00 00 00 03. Those ten bytes are the gzip header:

  • 1f 8b — the magic number.
  • 08 — compression method DEFLATE, the only one in practical use.
  • 00 — flags. A value of 08 would mean the original file name is stored after the header, as gzip file.txt does.
  • 00 00 00 00 — modification time, here zero because the data was compressed in memory.
  • 00 03 — extra flags and the operating system (3 = Unix).

The stream ends with an 8-byte trailer: a CRC-32 of the original data and its length modulo 2³², little-endian. In the example the last bytes are 26 00 00 00, which is 38, exactly the length of the decompressed text.

Troubleshooting

  • “incorrect header check”. The data has neither a gzip nor a zlib header; zlib data (Base64 starting with eJ, hex with 78) is recognised and decompressed here too. It may be raw DEFLATE, which Zlib Decompress handles, or not compressed at all.
  • “unexpected end of file” or “invalid distance too far back”. The data is truncated or corrupted, often because a long string was cut off when copied.
  • Garbled output. The decompressed content is binary (an image, a protobuf, another archive). Use the Download button to save it as a file.
  • Double encoding. Some systems Base64-encode twice. If decoding gives another Base64 string, decompress or decode it again.

If the decompressed text is JSON, as with most API and log payloads, paste it into a JSON formatter next to make it readable.

Doing it in code

Shell: echo "H4sI…" | base64 -d | gunzip. Python: gzip.decompress(base64.b64decode(s)). Node.js: zlib.gunzipSync(Buffer.from(s, 'base64')).toString(). The tool is useful when you just want to peek at a value without writing a script.

Download the result

Besides the text view, the decompressed bytes can be saved with the Download button, which is useful for large outputs or binary content. The status bar reports the compressed and decompressed sizes so you can see the compression ratio.

Privacy

Decompression runs locally in your browser using a JavaScript implementation of zlib, and nothing is uploaded. Compress new data with Gzip Compress; if the input is plain Base64 without compression, the Base64 Decoder is the right tool.

Frequently asked questions

How do I decode an H4sI string?
Paste it into the input and click Decompress. H4sI is the Base64 form of the gzip header, so the tool decodes the Base64 and then gunzips the result.
What does “incorrect header check” mean?
The data starts with neither a gzip nor a zlib header. It may be raw DEFLATE or not compressed at all. Try Zlib Decompress, which also inflates raw DEFLATE.
Can I upload a .gz file?
The tool expects gzip bytes as Base64 or hex text. To decompress a binary .gz file, convert it to Base64 first with File to Base64, or use an archive program.
Is there a size limit?
There is no fixed limit, but very large inputs depend on your browser’s memory. Multi-megabyte payloads usually work fine.

Last updated October 3, 2026

Related tools