GZip Compressor
Compress and decompress text with gzip, deflate, or deflate-raw
Text Input
Output
About
Compress text into gzip, deflate, or deflate-raw and decompress it back, using the browser's native CompressionStream/DecompressionStream. Output is base64-encoded and the compressed size and ratio are shown. Everything runs locally; nothing is uploaded.
Examples
Compress text to gzip
text: The quick brown fox jumps over the lazy dog.H4sIAAAAAAAAA3PP0sivyCxIVAguLilK5XBkBQAQ/wb/EAAAAA== (gzip, base64)
Compressed: 52 bytes (original: 45 bytes, 85% of original)Short text often compresses poorly or grows due to the gzip header. Longer, repetitive text achieves significant savings.
Decompress a gzip stream
H4sIAAAAAAAAA3PP0sivyCxIVAguLilK5XBkBQAQ/wb/EAAAAA==The quick brown fox jumps over the lazy dog.The base64-encoded gzip stream is decoded, decompressed, and the original text is recovered losslessly.
About this tool
Gzip is a widely-used lossless compression format defined in RFC 1952. It wraps the DEFLATE algorithm (a combination of LZ77 and Huffman coding) in a container with a header, optional metadata, and a CRC-32 checksum. The browser's native CompressionStream and DecompressionStream APIs expose gzip compression without any external library.
This tool compresses text to gzip, deflate, or deflate-raw, and decompresses back to text — all in the browser with no server calls. The output is base64-encoded so it can be copied as a string, and the compression ratio and compressed size are shown alongside the result.
How to use
Choose compress or decompress
Pick Compress to gzip/deflate text, or Decompress to decode a compressed byte stream back to text.
Select a format
Choose gzip (with header and checksum), deflate (raw), or deflate-raw. Gzip is the most widely compatible; deflate-raw omits the header.
Read the result
The compressed or decompressed output is shown, along with the size ratio (e.g. '72% smaller') and byte count. Copy the base64 output or download it as a .gz file.
Use cases
Testing gzip compression in a pipeline
Paste a text payload, compress it to gzip, and send it to a server that accepts gzip-encoded request bodies to test compression handling.
Inspecting compressed log files
Decompress a gzip log file stored in a text editor or data tool that doesn't natively read .gz files.
Estimating bandwidth savings
Compress a JSON response body and see the size ratio to estimate how much bandwidth gzip would save in a real HTTP transaction.
Common mistakes
Mistake:Expecting every file to compress well.
Fix:Gzip cannot compress already-compressed data (images, PDFs, other gzip files). It achieves 60–80% reduction on plain text and JSON, but little to none on binary files.
Mistake:Confusing gzip with deflate.
Fix:Gzip adds a 10-byte header and 8-byte footer (CRC) around the DEFLATE data. HTTP servers that advertise 'gzip' support both, but raw deflate without the header may not decompress in all clients.
Mistake:Decoding the base64 output as UTF-8.
Fix:The base64 string represents binary gzip bytes, not text. Decoding it as UTF-8 will produce garbage. Use the decompress function to recover the original text.
Frequently asked questions
Related guides
References & standards
Related tools
TOML Validator
Validate TOML and re-emit it as clean, indented JSON
TOML to JSON Converter
Convert TOML to JSON and JSON to TOML in either direction
JSON Lines Converter
Convert JSON Lines (NDJSON) to a JSON array and back
CSV to SQL Converter
Generate SQL INSERT statements from CSV data
JSON Schema Validator
Validate a JSON document against a JSON Schema
CSV to Markdown Converter
Convert CSV to a Markdown table and Markdown tables back to CSV