DevToolsmith

Gzip Decompress and Compress

Decompress gzip, zlib or raw deflate data pasted as Base64 or hex, or open a .gz file. The format is detected from the header, and text results are shown directly. You can also compress text to gzip or zlib. Everything happens in your browser.

Runs 100% in your browser — nothing is uploaded

Compressed data (Base64)
Tip: drop a file here348 chars · 348 bytes · 1 line
Decompressed
0 chars · 0 bytes · 0 lines

Recognising compressed data

FormatFirst bytes (hex)Base64 starts withWhere you see it
gzip1f 8b 08H4sI.gz files, HTTP Content-Encoding: gzip, Kafka and SQS payloads
zlib78 9c (default), 78 01, 78 daeJ, eA, eNHTTP deflate, PNG, Git objects, PDF streams
Raw deflateNo header—Inside ZIP files, WebSocket permessage-deflate

A Base64 string starting with H4sI is almost always gzip.

Gzip in code

Shell
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
Python
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
JavaScript (browser and Node 18+)
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.