Gzip compress and decompress

Compress text with gzip to base64 and see the size saved, or decompress base64 gzip data.

Input

The text to compress, or base64 gzip data to decompress.
Compress text, or decompress gzip data.
Compression effort when compressing, from 1 (fastest) to 9 (smallest).

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/gzip \
  -H 'Content-Type: application/json' \
  -d '{"input":{"text":"na na na na na na na na na na na na na na na na Batman!"}}'
import json, urllib.request

body = {'input': {'text': 'na na na na na na na na na na na na na na na na Batman!'}}
request = urllib.request.Request("https://setget.net/v1/tools/gzip", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/gzip", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"text":"na na na na na na na na na na na na na na na na Batman!"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "gzip",
  "input": {
    "text": "na na na na na na na na na na na na na na na na Batman!"
  }
}
{
  "input": {
    "text": "na na na na na na na na na na na na na na na na Batman!"
  }
}

Endpoint: POST /v1/tools/gzip. Over MCP: run_tool with slug: "gzip". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
text string yes The text to compress, or base64 gzip data to decompress.
action string no Compress text, or decompress gzip data. One of: compress, decompress. Default: "compress".
level integer no Compression effort when compressing, from 1 (fastest) to 9 (smallest). Default: 6. From 1 to 9.

Examples

Input
{
  "text": "na na na na na na na na na na na na na na na na Batman!"
}
Result
{
  "text": "H4sIAAAAAAAA/8tLVMgjBTklluQm5ikCANmXu+U3AAAA",
  "bytes_before": 55,
  "bytes_after": 33,
  "ratio": 0.6
}

Back to text

Input
{
  "text": "H4sIAAAAAAAA/8tLVMgjBTklluQm5ikCANmXu+U3AAAA",
  "action": "decompress"
}
Result
{
  "text": "na na na na na na na na na na na na na na na na Batman!",
  "encoding": "utf-8",
  "binary": false,
  "bytes": 55
}

Questions

Why is the compressed result larger than my text?
Gzip adds 18 bytes of header and checksum, and base64 adds a third on top. Compression only pays off on longer or repetitive text.
Is there a size limit?
Yes. Decompression stops with an error once the output passes 5 MB, which also protects against "zip bomb" data that expands enormously.
What if the decompressed data is not text?
Bytes that are not valid UTF-8 are returned as base64, with "binary" set to true.