Gzip Compress & Decompress
Compress and expand gzip, zlib and raw deflate. Free, and runs entirely in your browser — nothing you enter is uploaded, stored or sent to a server.
About Gzip Compressor and Decompressor
Every browser has had CompressionStream for years, so compressing and expanding gzip in a tab needs no library at all. What the API does not do is tell you anything about what it produced, and almost every question people bring to a gzip tool is about that: did this actually get smaller, what is inside the blob an API sent me, why does the header say gzip and my client refuse it.
The distinction that causes most of the trouble is that gzip is not deflate. Content-Encoding: gzip is a deflate stream wrapped in a header and a trailer carrying a checksum and the original length. Content-Encoding: deflate is supposed to be the zlib wrapper around the same stream, and is served as the bare stream often enough that every real client tries both. All three are offered, and if you pick the wrong one the error says which one the bytes actually look like.
A gzip header also carries metadata — the original filename, a modification time and the operating system that wrote it. That is worth reading back, partly because it is interesting and mostly because it is somewhere data leaks from: a build artefact can publish a path from whoever's machine produced it.
Where it helps
- Handles gzip, zlib and raw deflate, which covers what Content-Encoding actually means in practice.
- Detects which of the three a blob really is, so being handed the wrong one gives a useful message instead of a parse failure.
- Reads the gzip header back: the original filename, the modification time, the writing system and the checksum.
- Reports the ratio honestly, including when compression made the input larger and why.
- Runs entirely in the browser through the platform's own compression, so nothing is uploaded.
Limits
- Text in, text out. It compresses what you paste rather than a file you choose, so binary input has to arrive as Base64 or hex.
- The compression level is whatever the browser uses and cannot be set, so the size will not match
gzip -9exactly. - It reads a single member. A multi-member gzip file — which is what
cat a.gz b.gzproduces — expands only the first. - Brotli and zstd are not here; they are different formats with different wrappers, and browsers do not expose an encoder for either.
Frequently asked questions
What is the difference between gzip and deflate?
Both carry the same compressed stream. Gzip wraps it in a ten-byte header and an eight-byte trailer with a CRC and the original length; zlib wraps it in two bytes and an Adler checksum; raw deflate has no wrapper at all. Content-Encoding: deflate is meant to be the zlib form, and a good number of servers send the raw one instead, which is why clients try both.
Why did my text get bigger?
Because it was short. Compression has a fixed overhead and needs repetition to pay for it, so anything under a few hundred bytes usually grows. Web servers set a minimum response size for exactly this reason.
Why is the result Base64?
So it can be copied as text. Compressed bytes are not printable, and Base64 is the usual way of carrying them through something that expects characters — at the cost of about a third more size. The download button gives you the bytes themselves.
Can I use this to check what my server is sending?
You can expand a response body you have already captured. For a live check of the headers and encodings a server negotiates, the HTTP Headers tool connects and reports what comes back.
Related tools
- Base64 — Encode or decode UTF-8 text and URL-safe Base64
- Hex and Text Converter — Text to hexadecimal bytes and back, with a dump
- HTTP Headers — Grade a site's security headers from A+ to F, see every response header, and get the fix for your server
- File Checksum — Verify a download, and work out which algorithm made the checksum
- Base32 — Encode or decode Base32 in the RFC 4648, extended hex and Crockford alphabets
- Base58 — Encode or decode Base58, and verify the Base58Check checksum an address carries
More Encoders & Decoders tools
- Base64 — Encode or decode UTF-8 text and URL-safe Base64
- Base32 — Encode or decode Base32 in the RFC 4648, extended hex and Crockford alphabets
- Base58 — Encode or decode Base58, and verify the Base58Check checksum an address carries
- URL Encoder — Percent-encode components or whole URLs
- HTML Entities — Escape and unescape HTML entities
- JWT — Read, verify and sign JSON Web Tokens
- Punycode — Convert internationalised domain names to and from their ASCII form
- Unicode Converter — Escape, unescape and inspect code points
- Unicode Inspector — Analyse every character: category, script, block and encoding
- Number Base Converter — Binary, octal, decimal and hexadecimal, with the bits explained
- Hex and Text Converter — Text to hexadecimal bytes and back, with a dump