Compress image by quality
Compress image by quality estimates how much smaller an image file may become when exported at a chosen quality percentage.
Run — free
Select JPEG, PNG, WebP, or AVIF and enter an integer quality from 1 through 100. The calculator returns the estimated size relative to a quality-100 export of the same format and the corresponding percentage reduction. It does not need the image, its dimensions, or its original byte count. This makes it useful for quick planning and comparisons, while the clearly labeled rough confidence reflects the real variation caused by image content and encoder settings.
Read the result as a relative estimate
Choose the format you intend to export and enter the quality value that will be supplied to the encoder. The result uses a quality-100 export in that same format as its baseline, represented as 100 percent of relative size. If the calculator reports a relative size of 63 percent and an estimated reduction of 37 percent, it means the lower-quality export is modeled as roughly 63 percent as large as the format's quality-100 version. It does not mean the output will occupy 63 percent of the source image's current bytes, because the current file might use another format, dimensions, encoder, metadata profile, or quality setting. The baseline quality field makes that comparison explicit. A quality value of 100 therefore returns no estimated reduction. Values from 1 through 99 follow a smooth, format-specific curve. Use the percentage as a fast budget or comparison signal, and multiply it by a known quality-100 file size only when both exports will otherwise use matching settings.
Why each image format has a different curve
Quality controls do not translate directly into byte percentages. JPEG, WebP, and AVIF encoders discard information differently, and their numeric quality scales are not interchangeable. This calculator models those lossy formats with separate nonlinear curves and small format-specific size floors. AVIF and WebP are modeled as gaining more reduction as quality falls, while JPEG follows a somewhat gentler curve. PNG behaves differently because standard PNG is lossless and many applications use a quality-like control to choose compression effort, palette reduction, or an application-specific optimization level. Its model is deliberately conservative, with a much higher floor, so lowering PNG quality does not pretend to behave like lowering JPEG quality. These curves are deterministic planning assumptions rather than measurements of a particular encoder. The same inputs always return the same output, making the estimate suitable for interfaces, spreadsheets, tests, and early capacity planning. For a definitive byte count, encode the actual pixels with the exact production library and measure the resulting file.
Use quality estimates without overpromising
Image complexity is the largest missing variable in a two-field estimate. A flat logo, a portrait with a blurred background, and a noisy landscape can produce dramatically different file sizes even when format and quality match. Chroma subsampling, alpha transparency, animation, color profiles, metadata, encoder versions, speed presets, and lossless options can also change the outcome. Treat the returned reduction as a starting point for choosing a setting, not as a guaranteed upload size or bandwidth bill. It works well when comparing several candidate quality values under one consistent export pipeline, setting an initial value before a measured encoding loop, or explaining the likely direction and scale of a change. When a service enforces a strict maximum number of bytes, encode once, inspect the actual size, and adjust quality with a bounded search. Rejecting quality values outside 1 through 100 also prevents accidental extrapolation beyond the model, where a plausible-looking percentage would have no useful interpretation.
What you can do with it
Plan a web image budget
Estimate the relative savings from a proposed quality setting before producing a full responsive image set.
Compare export settings
Check several quality percentages for one format and choose a sensible starting point for measured test encodes.
Seed an automated encoder
Use the estimate to initialize a bounded compression search closer to the likely target instead of starting blindly.
FAQ
What is the file-size baseline?
The baseline is an export of the same image and format at quality 100, represented as 100 percent relative size.
Does the result predict an exact number of bytes?
No. It is a rough relative estimate because pixels, dimensions, metadata, and encoder settings are not provided.
Why is PNG reduction more conservative?
PNG is normally lossless, so a quality-like setting often changes compression effort or palette handling rather than acting like lossy JPEG quality.
What happens if quality is zero or above 100?
The request fails with an invalid-input error. Quality must be an integer from 1 through 100.
How much does an API request cost?
Each API request costs $0.002.
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/image/compress-quality \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"format":"jpeg","quality":75}'const res = await fetch("https://api.kit.forhosting.com/image/compress-quality", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"format": "jpeg",
"quality": 75
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/image/compress-quality",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"format": "jpeg",
"quality": 75
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/image/compress-quality", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"format":"jpeg","quality":75}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"format":"jpeg","quality":75}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/image/compress-quality", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"format": "jpeg",
"quality": 75
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "image.compress_quality",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_mb | 15 |
max_megapixels | 12 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |