Recognising compressed data
| Format | First bytes (hex) | Base64 starts with | Where you see it |
|---|---|---|---|
| gzip | 1f 8b 08 | H4sI | .gz files, HTTP Content-Encoding: gzip, Kafka and SQS payloads |
| zlib | 78 9c (default), 78 01, 78 da | eJ, eA, eN | HTTP deflate, PNG, Git objects, PDF streams |
| Raw deflate | No header | — | Inside ZIP files, WebSocket permessage-deflate |
A Base64 string starting with H4sI is almost always gzip.
Gzip in code
echo 'H4sIAAAAAAAA…' | base64 -d | gunzip # Base64 gzip to text
gzip -c data.json | base64 # text to Base64 gzip
curl -s --compressed https://example.com # let curl decompress responses
import base64, gzip, zlib
gzip.decompress(base64.b64decode(s)).decode()
zlib.decompress(data) # zlib
zlib.decompress(data, wbits=-15) # raw deflate
zlib.decompress(data, wbits=47) # auto-detect gzip or zlib
const bytes = Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
const stream = new Blob([bytes]).stream().pipeThrough(new DecompressionStream('gzip'));
const text = await new Response(stream).text();
// Node.js
import { gunzipSync } from 'node:zlib';
gunzipSync(Buffer.from(base64, 'base64')).toString();
Got JSON out? Format it with the JSON formatter. Just Base64 without compression? Use Base64 decode.
Frequently asked questions
How do I decompress a gzip string that’s Base64-encoded?
Paste it as it is. Compressed data is binary, so APIs, logs, cookies and message queues often store it as Base64; the tool decodes the Base64, recognises gzip by its first two bytes (1F 8B) and shows the decompressed text. If you have the bytes as hex instead, switch the input encoding to Hex.
What’s the difference between gzip, zlib and deflate?
All three use the same DEFLATE compression. Raw deflate is just the compressed data. zlib (RFC 1950) adds a 2-byte header and an Adler-32 checksum; it’s what HTTP calls “deflate”, and what PNG and many libraries use. gzip (RFC 1952) adds a 10-byte header and a CRC-32 checksum, and is used for .gz files and HTTP Content-Encoding: gzip. Detect mode tells them apart by the header.
Can I open a .gz file?
Yes. Click “Open file” or drop it on the input. The file is read in your browser, decompressed and shown as text, or as hex if it’s binary, and Download saves the decompressed file. A .tar.gz decompresses to a .tar archive, which contains several files; extract that with tar or an archive tool.
Why can’t it decompress my data?
The most common reasons are that the data was cut off (the end is missing), that it isn’t compressed at all, or that it uses another algorithm such as Brotli (br), Zstandard (zstd) or LZ4, which have different formats. The error message says which format the data seems to be in, if any.
Is my data uploaded?
No. Compression and decompression use your browser’s built-in CompressionStream API, so files and payloads never leave your device.