Gzip Compress & Decompress Online

Compress text or any file with gzip, zlib or raw deflate — or paste Base64 / open a .gz file to decompress it. Everything happens in your browser.

Runs in your browserUpdated
Open file

Compare algorithms

See how small your input gets with each algorithm and level.

Your data never leaves your computer. All processing happens 100% locally in your browser.

How to use the Gzip Compress & Decompress

  1. Choose Compress or Decompress and the format: gzip, zlib or raw deflate.
  2. Type or paste text, or click Open file to load any file (a .gz file switches to decompress automatically).
  3. For compression, pick a level from 1 (fastest) to 9 (smallest). The result appears as Base64 or hex.
  4. 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

FormatHeaderChecksumWhere you see it
Gzip10 bytes, starts with 1f 8bCRC-32.gz files, Content-Encoding: gzip
Zlib2 bytes (often 78 9c)Adler-32PNG internals, PDF streams, many APIs
Raw deflatenonenoneZIP 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 .tar archive, 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.

Frequently asked questions

How do I open a .gz file online?
Click Open file and choose the .gz file. The tool switches to decompress mode, shows the content if it is text, and lets you download the original file.
Is gzip the same as ZIP?
No. Both use DEFLATE, but gzip compresses a single stream or file, while ZIP is an archive format holding many files. Use the ZIP file creator for multiple files.
Which gzip level should I use?
Level 6 is the usual default and a good balance. Level 9 saves only a little more on most text and is slower; level 1 is useful when speed matters more than size.
Is my data uploaded?
No. Compression and decompression run locally in your browser using JavaScript and WebAssembly.
Why is my compressed output bigger than the input?
Very short inputs and data that is already compressed cannot shrink, and the gzip header adds 18 bytes. Compression pays off from a few hundred bytes of text upward.

Related tools