Deflate compress and decompress
Compress text to a zlib or raw deflate stream as base64, or decompress one. The format is detected.
Input
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/deflate \
-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/deflate", 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/deflate", {
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": "deflate",
"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/deflate. Over MCP: run_tool with slug: "deflate".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
text |
string | yes | The text to compress, or base64 zlib or deflate data to decompress. |
action |
string | no | Compress text, or decompress deflate data. One of: compress, decompress. Default: "compress". |
format |
string | no | When compressing: "zlib" adds the two-byte header and checksum, "raw" is the bare deflate stream. Decompression detects the format itself. One of: zlib, raw. Default: "zlib". |
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": "eJzLS1TIIwU5JZbkJuYpAgDl2hFl",
"bytes_before": 55,
"bytes_after": 21,
"ratio": 0.382
}A raw deflate stream
Input
{
"text": "na na na na na na na na na na na na na na na na Batman!",
"format": "raw"
}Result
{
"text": "y0tUyCMFOSWW5CbmKQIA",
"bytes_before": 55,
"bytes_after": 15,
"ratio": 0.273
}The format is detected
Input
{
"text": "eJzLS1TIIwU5JZbkJuYpAgDl2hFl",
"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,
"format": "zlib"
}Questions
- What is the difference between zlib, raw deflate and gzip?
- All three hold the same deflate-compressed data. Zlib wraps it in a 2-byte header and an Adler-32 checksum, gzip in a larger header and a CRC-32, and raw deflate has no wrapper at all.
- 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.
Related tools
- Gzip compress and decompressCompress text with gzip to base64 and see the size saved, or decompress base64 gzip data.
gzip - Base64 encoder and decoderEncode text to Base64 or decode it back, in the standard or URL-safe alphabet.
base64 - CRC-32 and Adler-32 checksumCompute the CRC-32 and Adler-32 checksums of text or bytes, as decimal and hex.
crc32 - All hashes at onceCompute every supported hash of one input at once: MD5, SHA-1, SHA-2, SHA3-256 and BLAKE2b.
hash-all - Base32 encoder and decoderEncode text to Base32 (RFC 4648) or decode it back, with or without padding.
base32 - Base58 encoder and decoderEncode text or bytes to Base58 with the Bitcoin alphabet, or decode Base58 back.
base58