Compress to KB topic guide

Compress image to KB: hit a hard file-size limit

Direct answer

When a form, marketplace or passport service publishes a hard byte budget, the job is not “make it as small as possible.” The job is to land at or under the published maximum while staying above any published minimum, in a format the destination accepts. Read the official limit first, enter that KB target in Compress to KB, let a quality sweep try to keep the original dimensions, and only downscale if the quality floor still exceeds the budget.

Try the Compress to KB

What this workflow handles

Pixel count and bytes per pixel are separate levers, and a KB target is met by deciding which one gives. The same dimensions can differ several fold with encoder settings, so the practical question is not whether a file can be smaller but which rule you are willing to bend. Compress to KB searches in a fixed order and reports what it did. If the file is already at or under the target, the source bytes come back unchanged. Otherwise it sweeps encoder quality at the current dimensions first: JPEG and WebP between quality 10 and 92, and PNG by quantising the palette to 256, then 64, then 16 colours, because PNG has no quality dial. Only when the floor of that sweep still misses the budget does it step the dimensions down (100, 90, 80, 70, 60, 50, 40, 30, 25%, never below a 64 pixel side) and sweep again. Format is the third lever, and the Keep original format checkbox decides how soon it is pulled. With it on, the source format is searched at every size the ladder allows before any conversion is tried, and a PNG that still cannot fit goes to WebP with its alpha kept, then to JPEG on a white background — a preference, not a lock. With it off, WebP and JPEG are candidates at full size from the start, so a file can change container without losing pixels. Either way the result panel names the format and the dimensions it produced, and that report is what to check when the destination names JPEG or PNG specifically. Two rules can also collide when a destination fixes both dimensions and bytes: resize to the required pixels first, then set a target the scale ladder can reach. The “only count it as successful at or under target” checkbox gates the download, not the downscale.

Use Compress to KB to set a published KB/MB budget, quality-sweep at the original dimensions first, and downscale only if the quality floor still misses. The tool page publishes four measured cases run over the sample files shipped with this site, including one that honestly misses its budget, so each lever's cost is visible. For a balanced re-encode with no KB target, open Image Compressor instead.

How to use it

  1. Open the destination's own help page and write down four things: the maximum file size, any minimum file size, the accepted formats, and any maximum pixel dimension. Numbers quoted second-hand age badly.
  2. Convert megabytes to kilobytes by multiplying by 1,024, then enter a target at or under the published maximum and never below a published minimum. Leave headroom if the site re-encodes uploads on its side.
  3. Upload and run with Keep original format on when the destination names JPEG or PNG. This first pass changes quality only, so your pixel dimensions survive, and the source container gets every size before a conversion is considered. Check the format the panel reports, because the checkbox prefers that container without guaranteeing it.
  4. If the panel says the budget was not met, decide which rule bends: allow the stepped downscale, or raise the target. If the destination also caps dimensions, resize to that dimension first and re-run.
  5. Check the download yourself before you rely on it: file inspector for bytes and pixel dimensions, then the upload screen's own validation. The result panel names every change the search made, so a format or scale switch is never a surprise.

Frequently asked questions

How do I compress an image to a specific KB size?

Write down the destination's published maximum, and its minimum if it has one, before you touch the file. Convert megabytes to kilobytes by multiplying by 1,024, enter that target in Compress to KB, and leave headroom if the site re-encodes uploads itself. The tool sweeps encoder quality at the original dimensions first, then downscales in steps only if the quality floor still exceeds the budget, and it names any scale or format change in the result panel. web.dev's compress-images article recommends experimenting with quality rather than assuming one universal number, which is why this is a search instead of a preset.

Why do some uploads reject a file that is “too small”?

Some destinations publish a minimum as well as a maximum. GOV.UK digital passport photos must be at least 50KB and no more than 10MB. Compressing aggressively below that floor can fail validation even though the photo looks fine. Prefer at-or-under the published max while staying above any published min — do not chase the smallest possible file when a minimum exists.

Where do I find the limit for the site I am uploading to?

In the guide for that destination, not here. Each platform page in this cluster lists its own published numbers beside the help article they came from, so a change on one platform only has to be caught in one place. This page keeps to the method on purpose: a borrowed limit repeated across the site ages worse than no number at all.

What are the hard limits of Compress to KB?

Uploads go up to 10 MB and 20 megapixels, and targets go from 1 KB to 10240 KB. A target also has to stay within 250:1 of the source size, so a 6 MB photograph cannot be ordered down to 8 KB: the tool refuses that before decoding anything and names the floor for a file that size. One request runs at most fifteen encodes inside a twenty second search budget, and when the budget stops the search the panel reports the bytes actually measured instead of claiming the target was met. Nothing is upscaled, so an image below a destination's minimum dimensions needs a resizer that adds pixels.

Should I lower quality first or resize the image first?

Quality first, because it keeps the pixel dimensions the destination already accepted; that is the order the tool uses. Resize first only when the destination publishes a maximum dimension you already exceed, since downscaling twice costs detail twice over. web.dev treats quality settings and serving scaled images as separate checklist items for the same reason.

Which format should I pick for a KB budget?

Pick from the formats the destination lists, then pick by content. JPEG suits photographs. PNG suits flat artwork and screenshots, where a smaller palette often wins without leaving PNG at all. WebP is usually the smallest of the three at similar quality when the destination accepts it. If a form names JPEG or PNG, that beats a smaller WebP the form will reject, so leave Keep original format on: it makes the search exhaust the source container at every size before a conversion is tried. A conversion can still follow when the source format cannot reach the target, so read the format on the result panel before uploading.

How is Compress to KB different from Image Compressor?

Image Compressor uses one balanced default per format (no KB target). Compress to KB sweeps quality toward the size you set and may downscale only when needed. Use Image Compressor for a single balanced re-encode; use Compress to KB when a destination publishes a hard byte budget. Pillow’s JPEG quality/optimize, WebP save options and PNG optimize docs describe the encoder parameters behind both tools.

Can I hit exactly 100 KB every time?

Usually at or under, not exactly on the number. Encoders land on discrete quality steps; a few bytes under the target is normal. If the budget is impossible under the current constraints, Compress to KB says so and offers the smallest best-effort file. For two-sided limits (GOV.UK 50KB–10MB), aim under the max and confirm you are still above the min before uploading.

Sources

Explore the compress to kb topic cluster

This guide covers hitting a hard byte budget. Related guides cover email, LinkedIn share photos, Instagram Graph JPEG caps, Twitter / X still-image caps, Notion inline image caps, WordPress Media Library caps, Webflow and Wix site-builder Assets upload caps, Facebook Help photo upload caps, Pinterest web Image Pin caps, YouTube custom thumbnail caps, Threads API image post caps, Bluesky post embed caps, Discord, Telegram, and GitHub attachment caps, post-compress diagnosis, file size vs dimensions, and resize vs compress.

Related guides

All compress to kb guides