Compress text
Compress text with gzip and get the result as a Base64 string that you can copy anywhere. The note shows how much shorter it got. The compression uses your browser's built-in feature and nothing is uploaded.
How it works
-
Paste your text
Paste the text, or the code you want to convert back.
-
Converted straight away
The tool compresses with gzip and writes the result as Base64 code, or turns such a code back into text.
-
Copy or download
You see straight away how much shorter the text has become.
Example
The example in the tool, a paragraph repeated eight times, goes from 1,184 to 232 characters: 80% shorter. Repetition is what makes compression work, so logs, JSON and HTML shrink well while a short sentence does not.
How it works
Your text is compressed with gzip using your browser's built-in compression, then written as Base64 so it stays plain text. Tick URL-safe to use - and _ and drop the = padding, so the result can go straight into a link or a query parameter.
Compression only helps with text of a few hundred characters or more, and works best on repetitive text. A very short text can even get longer, and the note tells you when that happens.
Uses
Fitting more text in a QR code (see text to QR code), keeping a URL shorter than a limit, or sharing a long log as one block of text.
Paste the result into decompress text to get it back. To protect the text with a password, use encrypt text. For plain Base64 without compression, there is Base64 encode.
Frequently asked questions
Why did my short text get longer?
Base64 and the gzip header cost some space. Under a few hundred characters the overhead is larger than the saving: ten characters of `a` become 31. Repetitive text of a few hundred characters or more gets clearly shorter.
How can I decompress the result without this site?
It is ordinary gzip in Base64. On Mac or Linux: `echo "code" | base64 -d | gunzip`. Any gzip tool works once the Base64 is decoded.
What does URL-safe do?
It replaces `+` and `/` by `-` and `_` and drops the `=` padding, so the result can go straight into a link or a query parameter without being escaped again.
Is compression the same as encryption?
No. Anyone can decompress the text. To protect it with a password, use [encrypt text](/en/text/encrypt-text).