Gzip, Zlib & Deflate Compressor

Compress or decompress text or a file with gzip, zlib or raw DEFLATE using fflate — choose the level, auto-detect the format, and see the size ratio live.

gzip: what .gz files and HTTP "Content-Encoding: gzip" use. If you are not sure, start here.

Or drop a file of any type — a .gz, .zz or .deflate is decompressed, anything else is compressed

Original: 337 B → Compressed: 116 B (66% smaller)
Compressed (base64)
H4sIAAAAAAAAA93L2xXCMAwE0Va2AE6K4dCAYxYiIlvGUl5UT+rI98x9TMR3kTxj7LZVvGzHZynNYSs74syafgee9h5w+fnOxpCQlQjugWyldbrTsVH1BrdTiMNTaUr41KXOjmohmWnUY/gDtHwSBlEBAAA=

Original: 337 B → Compressed: 116 B (66% smaller)

Compress and decompress text with gzip, zlib and DEFLATE

Paste or type any text, pick a format, and this tool returns the compressed bytes as base64 — or as hex, if "Compressed data as" says so — that you can copy, store, or share. Switch to Decompress to turn them back into the original text, or press "Decompress this" to send the answer straight back the other way; "Compress this" does the same in reverse, so a round trip is one click each way. A live size line shows the original byte count, the compressed byte count, and how much smaller (or larger) the result is, so you can see at a glance how well your data compresses. You can also drop a file of any type: its raw bytes are compressed — or, for a .gz, .zz or .deflate, decompressed — and a download button saves the result as a real file rather than base64. The Level select trades speed for size, from store only to smallest, and opens on the default that fflate and zlib use. In Decompress mode, “detect automatically” recognises gzip and zlib by their first bytes, tries anything else as raw deflate, and says which it was; data that would decompress to more than a page can safely hold is refused rather than freezing the tab. Typed or pasted text is held to the same 5 MB as an opened file, counted in UTF-8 bytes: past that the page names both sizes and does not start the work, so a huge paste cannot freeze the tab either. Everything runs locally in your browser using the fflate library, so nothing you enter is uploaded.

gzip vs. zlib vs. raw DEFLATE

All three share the same DEFLATE compression core and differ only in their framing. Raw DEFLATE is the bare compressed stream with no header or checksum. zlib wraps DEFLATE in a 2-byte header plus an Adler-32 checksum, the format used inside PNG and many network protocols. gzip adds a longer header and a CRC-32 checksum and is what .gz files and HTTP Content-Encoding: gzip use. Data compressed in one format will not decode as another, so choose the format that matches wherever the bytes came from, or let “detect automatically” work it out.

Frequently asked questions

What is the difference between gzip, zlib and raw DEFLATE?

They all use the same DEFLATE algorithm but wrap it differently. Raw DEFLATE has no header or checksum, zlib adds a 2-byte header and an Adler-32 checksum, and gzip adds a larger header and a CRC-32 checksum. Because the framing differs, you must decompress with the same format that was used to compress — or choose detect automatically, which reads gzip and zlib from their headers and tries raw deflate last.

Why is the compressed output shown as base64?

Compressed data is raw binary and cannot be pasted or stored safely as plain text, so it is encoded as base64 — or as hex, if you set "Compressed data as" to hex. When you decompress, paste it back in the same form and the tool decodes it before decompressing. To keep the real bytes instead, use the download button under the result, which saves a .gz, .zz or .deflate file.

Can I compress a file, and choose how hard it tries?

Yes. Drop any file under the text box and its raw bytes are compressed — or decompressed, if it is a .gz, .zz or .deflate — and the download button saves the real bytes: the compressed stream as a .gz, .zz or .deflate file, or a decompressed file under its own name with the suffix taken off. A decompressed result that is not text is described by its size rather than printed as garbage. The Level select runs from store only through fastest to smallest and opens on the default fflate and zlib use, so nothing changes until you pick another.

Can I get the compressed data as hex, or send an answer straight back?

Yes. "Compressed data as" switches Compress to write hex and Decompress to read it; pasted hex may be spaced or upper-case. "Decompress this" and "Compress this" put the answer into the input and switch direction, keeping the format, so a round trip is one click each way.

What happens if I paste a very large text?

Typed or pasted text is held to the same ceiling as an opened file, measured in UTF-8 bytes rather than characters — so Korean text, at three bytes a syllable, reaches it sooner. Past it the page does not start compressing at all; it says how big the text is and what the limit is, in the page’s language, rather than freezing the tab while it works through something it cannot finish.