How to compress a JPG without losing visible quality

The quality slider decides how much detail the encoder throws away. Here is what actually changes as you lower it, where to look to judge the result, and how to choose a setting for the image in front of you instead of guessing.

Compressing a JPG always means discarding something. The question is whether the discarded part is visible at the size the image will be shown. That is a different question for a photograph, a screenshot and a product shot, which is why there is no single correct quality setting.

What the quality slider is doing

JPEG splits the image into blocks, converts each block into a description of its frequencies, and then rounds the less important frequencies. A lower quality rounds them more aggressively: fewer distinct values survive, the file gets smaller, and the result drifts further from the original.

The loss is not spread evenly. Smooth areas survive well because they contain little fine detail to discard. Sharp edges, small text and repeating texture do not, because they are made almost entirely of the frequencies being thrown away.

Where to look when you judge a setting

  • High-contrast edges. A dark shape against a bright background picks up a faint halo. This is usually the first sign that the quality is too low.
  • Fine texture. Fabric, grass, hair and brickwork turn into mush before anything else looks wrong.
  • Gradients. A smooth sky starts to band, because neighbouring values that were slightly different become identical.
  • Small text. Becomes unreadable well before the rest of the image does.

Judge at 100% zoom, not 400%. Nobody views the image at 400%, and judging there leads to files that are far larger than they need to be.

A practical way to choose

Compress the same image two or three times rather than guessing once. Compare the results side by side at the size they will be displayed, and pick the lowest setting that still looks right. In practice one candidate is clearly fine and the next one down is clearly not, which settles it faster than any rule of thumb.

Keep in mind that the relationship between quality and size is not linear. Going from 90 to 80 usually saves far more than going from 60 to 50, and below about 50 the damage grows faster than the saving.

Two mistakes worth avoiding

Compressing an already-compressed file. Every save loses a little more, and the file does not keep halving. Start from the original whenever you still have it.

Ignoring the dimensions. If an image is 3000 pixels wide and will be displayed at 800, resizing it saves more than any quality setting can, and damages nothing. The compressor offers a maximum width and height for exactly this reason. The guides cover that trade-off in more detail.

Reading the result honestly

The compressor shows the size before and after for every file. If a file comes out larger, it says so rather than reporting a saving that did not happen - which is possible when the original was already heavily compressed. What a compression rate actually means explains how to read that number.

Ready to try it? Compress a JPG - everything runs in your browser, and the original file on your disk is never modified.

Related pages