JPEG Compression to an Exact Size

JPEG has been the currency of digital photographs for three decades, and there are good reasons it never left: it turns multi-megabyte camera files into compact images that every device on earth can open, at quality levels that fool the eye. This page is the format’s dedicated workshop. You set a byte budget — 100 KB by default, adjustable to anything — and a binary search over the quality parameter finds the best-looking JPEG that fits it. Around the tool, the sections below explain what the format actually does to your picture, the jobs it is unbeatable at, and the jobs where choosing it is a mistake.

Drop images here, click to browse, or paste from clipboard (Ctrl+V)

JPEG, PNG or WebP · up to 30 MB per file · up to 5 images at a time · processed locally

How JPEG squeezes a photograph smaller

The format works by dividing the image into small blocks and describing each one not pixel-by-pixel but in terms of how quickly its colours change — a mathematical view that concentrates the photograph’s meaning into fewer numbers. The quality setting controls how much fine variation within each block is kept or rounded away. High settings keep nearly everything and cost bytes; lower settings round aggressively and the file shrinks, which is why compression artifacts appear as small visible blocks and soft halos around sharp edges: those are the places where rounding was visible.

What makes JPEG remarkable is how much rounding the human eye tolerates. Skin, sky, foliage and fabric — the substance of ordinary photography — read as natural even after the format discards data the eye was never good at seeing. A 100 KB JPEG of a portrait looks like a portrait, not a degraded copy of one. The artifacts only become obvious at extreme settings, and the search here stops long before that unless you force it with an unusually small target.

The jobs where JPEG is unbeatable

Photographs are its home ground: anything with smooth gradients, natural textures and continuous tones encodes smaller in JPEG than in any lossless rival, often by a factor of five or more against PNG. That efficiency is why camera manufacturers, stock sites, social platforms and mail clients all standardised on it, and why a JPEG will open literally everywhere — every browser, every phone, every content system, every upload form ever written. When compatibility is a requirement rather than a preference, JPEG is the only format with a perfect record.

Its other quiet advantage is predictability of size. Because quality maps smoothly to bytes, a target-size search converges cleanly: a 200 KB JPEG is always achievable for any reasonable photo, and the search lands just under the line with maximum kept detail. Lossless formats cannot make that promise at all — a PNG either fits or it does not, with nothing in between.

The jobs where JPEG is the wrong answer

The format has two hard limitations worth knowing before you commit. First, no transparency: a JPEG has no alpha channel, so a logo meant to sit on varying backgrounds comes out with a flat white box around it. Transparent graphics belong in PNG or WebP. Second, synthetic imagery: screenshots, diagrams, text-heavy captures and line art have razor-sharp edges that JPEG’s block model blurs into visible ringing, and they usually look better and smaller as PNG or WebP than as JPEG.

The subtler limitation is cumulative damage. Every re-save of a JPEG re-applies the loss, and artifacts compound across generations — a photo saved through five different editors looks noticeably worse than one saved once. The discipline this page encourages is to compress exactly once, from the original, straight to the final size. The tool decodes your file and encodes it a single time; whatever quality the search settles on is applied once, cleanly, and your original stays untouched on disk.

Frequently asked questions

Are JPG and JPEG actually different formats?

They are the same format under two names. The short extension comes from early Windows filename rules that limited extensions to three letters, and both spread from there; ".jpg" simply became the habit on certain systems while ".jpeg" coexists everywhere else. Any tool, browser or upload form that accepts one accepts both. On this page the output carries the .jpg extension purely by convention.

Does saving a JPEG over and over really degrade it?

Yes, measurably. Each encode rounds detail away again, and the errors stack: block edges sharpen into visible seams, flat areas develop blotches, and what started as invisible trade-offs becomes obvious mush after several generations. This is why the workflow here compresses once from the original to the final size. If you need the same picture at two different sizes, produce both from the untouched source rather than re-compressing the compressed output.

Can a JPEG have a transparent background?

No. The format simply has no channel for it, and no version of JPEG ever will — encoders fill the area with solid white or black instead. If your image needs transparency for a website overlay, a marketplace listing or a design composite, switch this page’s output to PNG or WebP, both of which carry a full alpha channel. For opaque photographs, the limitation never comes into play.

What quality level does the compressor actually end up using?

Whatever the search finds, image by image. The compressor starts high, weighs the output, and narrows in on the highest quality whose file fits your target — so a smooth studio portrait might settle around 85 while a noisy night scene lands lower, both hitting the same byte budget. That per-image negotiation is the whole point: fixed quality settings produce wildly varying file sizes, while this approach produces a fixed size at the best quality each picture can carry.

Why does my portrait look fine at 100 KB while a forest shot looks rough?

Because content, not size, decides how much damage compression does. A portrait is mostly smooth skin and soft background — cheap to describe, so 100 KB buys a clean result. A forest is millions of fine, high-contrast leaf edges, exactly the detail JPEG rounds away first. Same budget, different content, different outcome. Cropping tighter, cleaning noise before compressing, or allowing a larger target for texture-heavy images are the honest fixes.