What is Compress / Decompress?
Compress / Decompress is a browser-based tool that runs your text through the gzip algorithm and returns the result as a base64 string you can safely paste anywhere. Paste that base64 string back in, switch to decompress mode, and you get your original text back. It bridges two encodings developers use constantly: binary compression for size, and base64 for transport over text-only channels.
Gzip (based on the DEFLATE algorithm) is the same compression used by web servers, HTTP responses, and .gz archives. It excels at shrinking text that contains repetition — JSON, logs, XML, source code, and configuration files often compress to a fraction of their original size. Because raw gzip output is binary and cannot travel through JSON fields, URLs, or environment variables intact, the tool wraps it in base64 so the compressed payload stays valid text.
Every byte is processed locally using the browser's native compression APIs inside a background worker. Your text — which might be a proprietary payload, a database dump, or a private config — never touches a server, is never logged, and never leaves the tab.
Why use Compress / Decompress?
Compressing before storing or transmitting text saves real space. A verbose 50 KB JSON document can shrink to a few kilobytes, which matters when you are stuffing data into a URL parameter, a cookie, a QR code, a localStorage entry with a quota, or a message queue with a size cap. The base64 wrapper guarantees the compressed result survives copy-paste and text-only transports without corruption.
Round-tripping is exact: decompressing a string produced by this tool returns the original text byte-for-byte, so it is safe for data you cannot afford to mangle. Running compression in a background worker also keeps the interface responsive even on large inputs — a runaway operation cannot freeze the page.
Doing this locally is a privacy win. Many online compressors POST your text to a server to run gzip there. This tool never does — you can open the Network tab and confirm zero outbound requests while you compress. That means you can safely compress secrets, customer data, or internal payloads without them leaving your machine.
Features
- Gzip-compress any text and receive a portable base64 string
- Decompress a gzip+base64 string back to the original text exactly
- Runs in a background Web Worker so the page never freezes
- One-click copy of the result to your clipboard
- Download the result as a file
- Live character counts to compare original vs compressed size
- Clear, specific error messages when input is not valid gzip+base64
- Fully client-side — no uploads, works offline once loaded
How to use Compress / Decompress
- Choose Compress mode (the default) to shrink text, or Decompress mode to restore a previously compressed string.
- Paste or type your content into the input panel on the left. In compress mode this is plain text; in decompress mode it should be a gzip+base64 string produced by this tool.
- The result appears in the right panel automatically after a brief pause while the background worker runs.
- Compare the character counts under each panel to see how much the text shrank.
- Click copy to grab the result, or download to save it as a file. To verify a round-trip, switch modes and paste the result back in.
Example 1 — Compress a repetitive JSON payload
Highly repetitive text compresses dramatically. Paste the JSON, stay in Compress mode, and copy the compact base64 string for storage or transport.
Input
{"items":[{"status":"active"},{"status":"active"},{"status":"active"},{"status":"active"}]}Output
H4sIAAAAAAAAA6tWKsvPTFHSUUpKLFLSgTGA7ILEEiCzWkkhWkjB0MjYxNTM3MLSyghXQ0aAAAAAA==Example 2 — Decompress a string back to text
Switch to Decompress mode and paste a gzip+base64 string to recover the original content exactly as it was.
Input
H4sIAAAAAAAAA8tIzcnJVyjPL8pJUQQAlRmFGwsAAAA=Output
Hello, world!Common Mistakes
- Trying to decompress a plain base64 string that was never gzipped: base64 and gzip are different steps. Decompress mode expects gzip+base64 specifically, so a plain base64-encoded string (with no gzip layer) will fail. Use the Base64 tool for that.
- Expecting short text to shrink: gzip has fixed header and checksum overhead. Compressing a handful of characters usually produces output larger than the input — compression only pays off on longer, repetitive text.
- Copy-paste whitespace or line wrapping corrupting the string: a stray space, newline, or truncated tail in the base64 string breaks decompression. Copy the full string exactly, with nothing added or removed.
- Assuming the output is encrypted: compression is not encryption. Anyone can decompress a gzip+base64 string. Never treat it as a way to hide or secure sensitive data.
- Interoperability assumptions: the exact base64 output can vary between gzip implementations even when the decompressed result is identical. Do not compare two tools' compressed strings byte-for-byte; compare the decompressed results.
- Feeding binary or non-text data: this tool is built for text. Pasting content that is not valid UTF-8 text can produce unexpected results — use it for text payloads.
Developer Tips
- Use this to squeeze data into tight spaces: URL query parameters, cookies, localStorage quotas, and QR codes all benefit from a compressed base64 payload instead of raw JSON.
- Always verify a round-trip before relying on it in production: compress your text, then paste the result into decompress mode and confirm you get the exact original back.
- The size difference shown by the character counts is a quick way to judge whether compression is worth it for a given payload — if it barely shrinks, the data is not compressible enough to bother.
- Because base64 inflates binary by about 33%, the compressed base64 string is only smaller than the original when gzip savings exceed that overhead — true for most structured text, but not for tiny inputs.
- When debugging a system that stores compressed values, paste them here to peek at the real content without wiring up a decompression step in your own code.
Frequently Asked Questions
- What does this tool actually do to my text?
- It runs your text through the gzip compression algorithm, which produces binary data, and then encodes that binary as a base64 string so it can be safely copied and pasted anywhere that expects text. Decompress mode reverses both steps: it base64-decodes the string and then gunzips it to recover your original text. The round-trip is exact, returning the same bytes you started with.
- Why is my compressed output sometimes larger than the input?
- Gzip adds a fixed-size header, a dictionary, and a checksum to every output, and base64 encoding inflates binary data by roughly a third. For short strings that overhead outweighs any savings, so the result is bigger. Compression only produces smaller output on longer text with repetition — JSON, logs, XML, and source code compress well, but a single short sentence often does not.
- Is my data uploaded anywhere?
- No. All compression and decompression happens locally in your browser using its native compression APIs, running inside a background worker. Nothing you paste is sent to a server, logged, or stored. You can confirm this by opening your browser's Network tab while you use the tool — you will see zero outbound requests, and it continues to work even if you go offline.
- Is compression the same as encryption?
- No — they are completely different. Compression makes data smaller but does nothing to hide it; anyone with the string can decompress it back to the original. Encryption scrambles data so only someone with a key can read it. Never use gzip+base64 as a security measure. If you need to protect data, encrypt it separately before or after compressing.
- Can I decompress a string that another program compressed?
- It depends. If the other program produced standard gzip output and then base64-encoded it the same way, it should decompress correctly. However, some tools use raw DEFLATE, zlib framing, or different base64 variants, which are not interchangeable with gzip. If decompression fails, the input was likely produced with a different compression or encoding scheme.
- Why wrap the compressed data in base64 at all?
- Gzip output is raw binary containing bytes that are not valid text — they cannot be safely stored in a JSON string, passed in a URL, saved in an environment variable, or pasted into a chat without corruption. Base64 re-encodes those binary bytes using only safe, printable ASCII characters, so the compressed payload can travel through any text-only channel intact and be decoded back to the exact original bytes later.
- What is the largest input I can compress here?
- There is no hard limit, but practical limits depend on your browser and available memory. Because the work runs in a background worker, even large inputs will not freeze the interface. Multi-megabyte text compresses fine on modern hardware; extremely large inputs may take a moment or strain memory, in which case a command-line tool like gzip is more appropriate.