How to use the Gzip Compress & Decompress
- Choose Compress or Decompress and the format: gzip, zlib or raw deflate.
- Type or paste text, or click Open file to load any file (a
.gzfile switches to decompress automatically). - For compression, pick a level from 1 (fastest) to 9 (smallest). The result appears as Base64 or hex.
- Download the result, or press Reverse to feed it back in and check the round trip.
What is gzip?
Gzip is the most widely used lossless compression format on the web and in Unix tools. It wraps the DEFLATE algorithm (LZ77 back-references plus Huffman coding) with a small header and a CRC-32 checksum. Web servers use it to shrink HTML, CSS, JavaScript and JSON responses, and command-line tools use it for .gz and .tar.gz archives.
Gzip, zlib and raw deflate
| Format | Header | Checksum | Where you see it |
|---|---|---|---|
| Gzip | 10 bytes, starts with 1f 8b | CRC-32 | .gz files, Content-Encoding: gzip |
| Zlib | 2 bytes (often 78 9c) | Adler-32 | PNG internals, PDF streams, many APIs |
| Raw deflate | none | none | ZIP entries, WebSocket permessage-deflate |
All three compress to almost exactly the same size; only the wrapper differs. When decompressing, the tool recognises gzip and zlib headers automatically, so you can paste data without knowing which one it is.
Compression levels
Level 1 is fastest, level 9 searches hardest for matches. On typical text, level 6 (the default in gzip, nginx and Node.js) is within a few percent of level 9 at a fraction of the CPU time. Use Compare algorithms to see the real numbers for your input, including Brotli.
Why Base64?
Compressed data is binary and would be garbled if shown as text. Base64 turns it into safe ASCII so you can paste it into JSON, environment variables, URLs or test fixtures — at the cost of about 33 % more size. Download the result to get the raw binary .gz file instead.
Common questions when decompressing
- “Invalid data” usually means the input is Brotli, or the Base64 was cut off. Try the Brotli tab, or check the string is complete.
- A .tar.gz file decompresses to a
.tararchive, which you can then open with any archive tool. - Already-compressed files (JPEG, MP4, ZIP) do not get smaller — the data has no redundancy left.
Want to know whether your website already serves gzip? Run the website compression test.
Tools that pair well with the Gzip Compress & Decompress
- JavaScript Minifier — Paste JavaScript and get production-ready minified code from Terser — the same engine used by Vite, webpack and Rollup — with real before/after and gzipped sizes.
- HTML Minifier — Shrink HTML pages and templates by removing comments and redundant whitespace, minifying inline <style> and <script>, and cleaning up attributes — while keeping the layout identical.
- JSON Minifier — Remove all unnecessary whitespace from JSON, validate it at the same time and see exactly how many bytes you save — before and after gzip.
- XML Minifier — Compact XML documents, feeds, sitemaps and SOAP payloads by removing indentation and comments — with a well-formedness check so nothing breaks.