ForHosting KIT · Data & Files

Gzip

Shrink a text with gzip and see what you saved: in the example, a line repeating hola eight times drops from 39 to 28 bytes. Decompressing gives back exactly the original, with nothing lost. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Decompressed text
hola hola hola hola hola hola hola hola
You get
Original size (bytes)
39
GZIP size (bytes)
28

compress and decompress: gzip, deflate, brotli

What gzip does to your text

Gzip looks for pieces of text that repeat and replaces each repetition with a short reference to the first one, so the more a text repeats itself, the smaller it gets. It is lossless: decompressing returns every character exactly as it was, which is why it is trusted for logs, exports and backups. It has also been readable by almost every tool since the 1990s, so a gzip result can be opened practically anywhere. In the example, eight copies of hola take 39 bytes and only 28 after compression, and the tool always shows both sizes so you can judge whether it was worth it.

When to compress, and the usual mistakes

A typical use is archiving: compressing rotated log files before moving them to cold storage cuts storage costs, without running the compression on the application server itself. The compressed result comes back as base64 text, a safe form for storing or pasting. Two mistakes are common. The first is expecting a big gain from a short text, because the header gzip adds can eat most of the saving. The second is trying to decompress something that is not a gzip result in base64, such as ordinary text or a damaged copy, which cannot be expanded and is refused instead of producing garbage.

Log archiving pipelines

Gzip rotated log files before moving them to cold storage, cutting storage costs without running compression on the application server itself.

Which algorithm gives the smallest output, gzip or brotli?

Brotli generally compresses text-based data tighter than gzip at comparable speed, though the actual gain depends on your specific content.

Will compressing an already-compressed file like a JPEG shrink it further?

Not meaningfully — formats like JPEG, PNG or previously-gzipped files are already near their entropy limit, so re-compressing them adds little to no benefit.

Why does a short text barely shrink with gzip?

Because gzip works by spotting repetition and also adds a small header of its own, so a short or varied text has little to remove. In the example, a line that repeats one word eight times goes from 39 to 28 bytes; longer, repetitive text has more to gain.

How do I get my original text back?

Choose the decompress option and paste the compressed result. The tool expands it and returns exactly the text you started with, letter for letter, because gzip compression never throws any information away.

What does the compressed result look like?

It comes back as a line of letters, digits and a few symbols, known as base64, so it can be pasted into a message, a form or a settings file without being damaged. Next to it you see the size before and after, in bytes.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/data/gzip

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/data/gzip \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"hola mundo"}'
{
  "text": "hola mundo"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "data.gzip",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_mb25
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Compress a payload down with gzip, deflate or brotli, or decompress one back to its original bytes, through a single endpoint that picks up the heavy lifting your application shouldn't be doing on a request thread. It exists for the moments when you need real compression control outside the automatic layer your web server or CDN already applies.

Compression is everywhere, but rarely in your control

Most web stacks compress HTTP responses transparently, which is great for serving pages but useless the moment you need to compress a log file before archiving it, shrink a JSON export before storing it, or decompress an inbound webhook payload that arrived gzip-encoded from a third party. Those are file- and blob-level jobs, not response-level ones, and doing them inline in application code means burning CPU cycles that could be serving users instead.

Three algorithms, three trade-offs

POST /data/gzip takes an algorithm parameter — gzip, deflate or brotli — plus a direction of compress or decompress, and returns the result via task_id. Gzip is the ubiquitous choice, readable by essentially every tool since the 1990s; deflate is its raw core algorithm without the gzip wrapper, useful when a spec explicitly calls for it (like some ZIP internals or older HTTP implementations); brotli, developed and open-sourced more recently, generally compresses tighter than gzip at similar speed, which matters when you're optimizing storage costs or transfer size for large text-based payloads.

What determines the size you get back

Compression ratio depends entirely on the nature of your data: highly repetitive text like logs, CSV exports or minified JSON can shrink dramatically, while already-compressed formats such as JPEG or a previously-gzipped file will barely change size and may even grow slightly due to format overhead. The endpoint doesn't try to guess what's optimal for your content — you choose the algorithm, and the result tells you exactly what ratio you achieved.

Built for pipelines, not one-off downloads

A failed job — malformed input, an unreadable stream — costs you nothing, since we only bill successful completions after retries are exhausted.

Where this sits in a larger process

Treat it as a utility block you drop into any pipeline that moves data between systems with different compression expectations, rather than a destination in itself. This endpoint pairs naturally with our archive and conversion tools: decompress an inbound gzip payload, hand the raw bytes to a format converter, then re-compress the output with brotli before storing it.

Inbound webhook decoding

Decompress gzip-encoded payloads sent by a third-party provider before parsing the JSON or XML underneath.

Data export optimization

Brotli-compress large CSV or JSON exports before offering them as a download, shrinking transfer time for end users on slow connections.

Legacy format compatibility

Deflate-compress a payload when integrating with an older system or protocol that expects the raw algorithm without a gzip header.

How do I compress a file using the gzip API?

POST the file to /data/gzip with direction set to compress and the algorithm you want (gzip, deflate or brotli); you'll get a task_id and the compressed file arrives via webhook or a signed link.

Does it support brotli as well as gzip?

Yes, the endpoint supports gzip, deflate and brotli, selected with a single algorithm parameter in the same request.

Can I decompress a file back to its original form?

Yes, set direction to decompress and the endpoint reverses the operation, returning the original bytes.

Is there a free tier for the compression API?

The tool above runs free in your browser. The API is paid — each call draws from your prepaid ForHosting KIT balance: top up from $10.00 (it never expires), pay each request's published price, and a call with no balance returns HTTP 402. No subscription, no tokens, and a failed task is never charged.

What's the cost per compression request?

$0.002 per request, whether you're compressing a 1KB file or a large export, and failed requests are never charged.

How long do I have to download the result?

The signed result link stays valid for 24 hours; for automated pipelines, a webhook delivers the result as soon as the task finishes.

Read the full KIT documentation →