Gzip, zlib and deflate text
Compress text with gzip, zlib, raw deflate or Brotli into Base64 or hex, or decompress it back into text. Decompressed text is limited to 10 MB.
Process locally
Files stay in this browser session. Closing or clearing releases them.
Add text
Type or paste the text to process
Adjust settings
Optional: Format, Direction, Compression level and more
Run
Processes in this browser; cancel at any time
About this tool
Compress text with gzip, zlib, raw Deflate or Brotli and get the result as Base64 or hex, or decompress such data back into text. Use it to read a gzip-compressed, Base64-encoded value from an API, a log or a cache, or to shrink a long JSON string before storing it in a text-only field.
Levels run from 0 to 9, and up to 11 for Brotli. Decompressed results must be UTF-8 text of at most 10 MB, and the input can be up to 1 MB. Everything runs in your browser, and nothing is uploaded.
How to use it
- Type or paste the text to compress, or the Base64 or hex data to decompress, or select Use example.
- Choose a “Format”: “gzip”, “zlib”, “Deflate (raw)” or “Brotli”, and set “Direction” to “Compress” or “Decompress”.
- When compressing, set the “Compression level” (6 by default). Under “Compressed data format”, choose “Base64” or “Hex”; when decompressing, it must match your input.
- Select Run, then preview the result and download it as a text file.
Formats and limits
- Input
- Text
- Output
- Plain text
- Size limit
- 1 MB
- Settings
- Format (gzip, zlib, Deflate, Brotli); Direction (Compress, Decompress); Compression level; Compressed data format (Base64, Hex)
- Privacy
- Files stay in the current browser session. No file bytes are uploaded.
- Price
- Free, no sign-up
Common questions
How do I know which format to choose for decompressing?
The format must match the data, or the tool reports that the data is not valid. Base64 of gzip data usually starts with H4sI, and in hex with 1f8b; zlib data in hex usually starts with 78.
Why does gzip give a different result each time?
The gzip header records when the data was compressed, so a few bytes near the start change on every run, while the decompressed text stays the same. zlib, Deflate and Brotli store no time, so their results repeat.
Why is the compressed result longer than the text?
Each format adds a header and other data, and Base64 makes the output about a third longer, so very short text often grows. Longer, more repetitive text compresses better. Level 0 stores the data without compressing it, so the result is always larger.
Can I decompress a .gz file directly?
This tool takes text, not files. Convert the file to plain Base64 first with the “Image or file to Base64” tool, with the data: prefix turned off, then paste it here. The decompressed content must be text.
Which compression level should I use?
Higher levels compress more but take longer, and the default of 6 suits most text. gzip, zlib and Deflate go up to 9 and treat 10 or 11 as 9, while Brotli supports up to 11. Decompression ignores the level.
Related tools
Base16/32/58/64/85/91 encoding
Encode or decode Base16, Base32, Base58, Base62, Base64, Ascii85, Z85 and basE91, choosing the character set of the text, or hex for raw bytes.
Base64 to image or file
Turn Base64 or a data: URI back into a file such as an image; the type comes from the content or the URI.
Byte radix and endianness converter
Convert bytes between hex, binary, octal, unsigned or signed decimal, Base64 and UTF-8 text, and swap byte order between big and little endian in 2, 4 or 8-byte words.
Character set encoding and mojibake repair
Show the bytes of text in UTF-8, GBK, GB18030, Big5, Shift_JIS and more as hex, turn hex back into text, or repair mojibake from text read in the wrong character set.
Unicode, HTML, URL and Punycode escapes
Convert text to and from \u escapes, HTML numeric entities, percent-encoding in any character set (such as GBK URLs), Quoted-Printable and Punycode domains.
Image or file to Base64
Encode images or any other file as Base64 or as a data: URI to paste into HTML, CSS or JSON.