Image Compressor

Give it a size limit and it finds the quality that meets it, in six tries, in your browser. No upload, no queue, no watermark.

This tool needs JavaScript: the compressing happens in your browser, which is also why nothing is uploaded.

Compress to

A target size is usually the real requirement. Quality is there for when you know the number you want.

The search finds the highest quality that comes in under this.

A floor, so the search cannot reach the target by making the image unusable. Below 40 most photographs show blocking.

Used by the quality mode.

Format

Both are lossy, which is what a target size needs. PNG is not offered here: it is lossless, so there is no quality to search.

Zero keeps the size. When a target cannot be met, this is the setting that fixes it: fewer pixels beats lower quality.

JPEG only, which has no transparency.

Choose an image. Nothing is uploaded: the compressing happens in this tab.

Choose an image. Nothing is uploaded: the compressing happens in this tab.

The requirement is almost never “quality 82”. It is “under 200 KB”, because something downstream says so: an upload limit, a performance budget, an email.

A quality slider is a bad way to meet a limit. The relationship between quality and bytes is different for every image, so you set 80, check, set 65, check, set 72, and eventually stop. That is a binary search done by hand. This does it properly: six or seven encodes, each a few milliseconds, and it lands on the highest quality that comes in under your number.

In the browser. Nothing is uploaded, and there is no queue and no watermark.

How to use

  1. Drop an image on the panel, or click to choose one.
  2. Leave Compress to on target size and set the limit.
  3. Read the line under the preview: the quality it landed on, the size it got, and how many tries it took.
  4. If the target could not be met, set Maximum width. Fewer pixels beats lower quality every time.

Example

A 2.4 MB photo at 1200 pixels, target 200 KB:

Quality 74 gives 193.4 KB, under the 200 KB target · found in 6 tries · 92 percent under the original · 1200×900

Six encodes to find that 74 fits and 75 does not. Done by hand that is five guesses and a shrug.

The Lowest quality to try field is a floor, and it matters: without one, a search asked for 50 KB from a large photo will happily return quality 6, which meets the number and is unusable. With the floor at 40 the tool tells you it could not get there, and suggests the thing that will: a smaller image.

Pitfalls

A target that needs quality under 40 is the wrong target for that image. The blocking and the smeared edges are visible at a glance. Reduce the pixel dimensions instead: half the width is a quarter of the pixels, and the quality can stay high.

PNG is not in the format list. It is lossless, so there is no quality to search: the only way to make a PNG smaller is fewer pixels or fewer colours. For a screenshot that has to stay sharp, resize it, or convert to WebP where a quality search does work.

Two lossy passes cost more than one. Compressing an already-compressed JPEG adds its own artefacts on top of the existing ones. Always start from the largest, cleanest original you have.

The search assumes bigger quality means a bigger file. That is true of every encoder in practice, and if a browser ever broke it the search would just settle on a slightly conservative answer rather than misbehave.

Metadata is dropped. Re-encoding loses EXIF, including orientation, camera and location. The orientation is applied to the pixels first, so the image stays the right way up.

Compatibility

Everything happens in the page: createImageBitmap to decode, <canvas> to draw, canvas.toBlob to encode, once per search step. That is Chrome, Firefox, Safari and Edge for the last several years.

WebP output needs Chrome 50, Firefox 96 or Safari 14. Where it is missing the tool falls back to JPEG and says which format it wrote.

The search is capped at twelve encodes as a guard, and in practice takes six or seven for the 1 to 100 range. A 12 megapixel image is a few hundred milliseconds in total.

Frequently asked questions

Why did it stop at quality 74 and not 74.5?
Because the encoders take whole numbers. The search covers 1 to 100 and the answer is the highest integer that fits.
Can I compress several images to the same limit?
One at a time here. The same job for a folder is cwebp -q or jpegoptim --size=200k in a loop.
Is this lossless compression?
No. It is the ordinary lossy kind, chosen intelligently. Lossless tools like jpegtran or oxipng rewrite the same pixels more efficiently and typically save 5 to 15 percent; this saves 80 to 95 percent by throwing away detail you were not looking at.
Why is my PNG screenshot barely smaller as a JPEG?
Because JPEG is bad at hard edges and text: it puts ringing around them, and the file stays large while the image gets worse. Screenshots want PNG or lossless WebP, and the way to shrink them is fewer pixels.
What does “found in 6 tries” tell me?
That the number under the preview is not a guess. Each try was a real encode, and the one shown is the best that came in under your limit.
Weekly drops

New tools, when there are new tools

One email when something worth using ships. No schedule to fill, so no filler.

Your address goes nowhere else, and one click unsubscribes.