Compressing an image without losing quality
Truly lossless image compression saves about 20%. Losing nothing you can actually see saves about 80% — and those are two completely different operations.
Updated 6 min read
"Without losing quality" means two different things, and only one of them is worth asking for.
Genuinely lossless means every pixel comes back bit-identical. For an image that is already a JPEG, this saves almost nothing — maybe 20% with an aggressive optimiser, often less, because the file is already the output of a lossy encoder and there is very little mathematical redundancy left in it.
Visually lossless means you cannot tell the difference with the two images side by side at full size. That usually saves 70–85% on a phone photo, and it is almost certainly what you actually want.
The rest of this is about hitting the second one deliberately rather than by accident.
Where the bytes in a photograph go
JPEG works by splitting the image into 8×8 pixel blocks and describing each block as a sum of frequency patterns — broad gradients first, fine detail last. Then it throws away precision in the fine-detail coefficients, because human vision is far less sensitive to them.
The quality setting controls how much precision it throws away. What matters is that the discarded detail is not evenly distributed: the first thing to go is high-frequency noise, and a phone photo is full of high-frequency sensor noise that was never real detail in the first place.
That is why the first 70% of a photograph's file size can usually go without a visible change. You are not deleting the photograph, you are deleting the camera's noise floor.
The quality numbers that actually matter
JPEG quality is an index into quantisation tables, not a percentage of anything. But the thresholds are consistent enough to be useful:
| Quality | What happens | Use |
|---|---|---|
| 0.95–1.00 | Enormous files, no visible gain over 0.90 | Almost never |
| 0.85–0.92 | Visually indistinguishable from the original | Archive, print |
| 0.75–0.85 | Differences visible only on close inspection of flat areas | The sweet spot |
| 0.60–0.75 | Soft edges, slight blocking in skies and gradients | Web, thumbnails |
| Below 0.50 | Obvious blocking and colour fringing | Only when forced |
The practical headline: quality 0.80 is where almost every photograph should live. Going from 1.00 to 0.80 typically removes 60–70% of the file and changes nothing you can see. Going from 0.80 to 0.60 removes another 25% and starts to show.
The one that is not a quality setting
Chroma subsampling is the other lever, and it is nearly free. The eye resolves brightness far more sharply than colour, so JPEG can store colour information at half resolution — written as 4:2:0 — and save roughly 25% of the remaining bytes with no visible penalty on a photograph.
The exception is sharp coloured edges: red text on white, a logo, a screenshot of a syntax-highlighted terminal. Those get a visible colour halo under 4:2:0, which is one of several reasons a screenshot should not be a JPEG at all.
Resize first, and the arithmetic says why
This is the part that is consistently done backwards. If an image has more pixels than anything will ever display, those pixels are pure cost.
A 12-megapixel phone photo is 4032×3024. Displayed full-width on a 2× retina laptop it needs about 2560 pixels across. Everything beyond that is being thrown away by the browser after you paid bytes to send it.
Dropping 4032 to 2560 is a 60% reduction in pixel count, and file size scales roughly with pixel count. That is a bigger saving than anything the quality slider will give you, and it is genuinely invisible as long as the result is still larger than the display size. Resizing is the only lever here that costs nothing when done correctly.
So the order is:
- Resize to the largest size anything will actually display.
- Encode at quality 0.80–0.85 with 4:2:0 subsampling.
- Measure the result, and only then decide if you need to go lower.
Compressing versus resizing goes into the distinction further, because the two are routinely confused.
The mistake that actually destroys quality
Re-compressing an already-compressed image.
Every JPEG save re-quantises, and the second save treats the first save's artefacts as real detail worth preserving. The damage accumulates and never reverses. Five rounds of "still too big, compress again" produces something visibly worse than one pass straight to the target — and sometimes larger, because preserving blocking artefacts costs bytes.
Always go back to the original. If a pass lands at 600KB against a 500KB target, do not compress the 600KB file. Go back to the 4MB original and aim at 500KB.
This is also why "compress twice to be safe" is actively harmful, and why a tool that bisects quality has to re-encode from the source each time rather than from its own previous output.
Measuring instead of guessing
An image encode takes about fifteen milliseconds. At that price there is no reason for any tool to guess a quality setting — it can try one, weigh the actual bytes, and adjust.
quality 0.92 → altered 840KB over 500KB, go lower
quality 0.61 → 310KB under, could do better
quality 0.76 → 470KB under, best so far
quality 0.84 → 560KB over
quality 0.80 → 498KB under, and the best found
Eight passes, 120 milliseconds, and the answer is the highest quality that genuinely measured under the limit. Not an estimate, and not a preset that happened to be conservative.
The difference matters in both directions. A tool that guesses high hands you a file that gets rejected. A tool that guesses low hands you 180KB when you were allowed 500KB — quality you were entitled to and did not get.
Compress an image to 500KB, to 200KB or to 1MB does exactly that, and the image compressor takes any number you type. Nothing is uploaded — the encoding happens in your browser, which is also why it can afford eight passes.
FAQ
Can you compress an image with no loss at all?
Yes, but not usefully for a photograph. Lossless optimisers like MozJPEG's lossless mode or Zopfli for PNG re-encode the same pixel data more efficiently, typically saving 5–20%. For an image that is already a JPEG, most of the redundancy is already gone, so if you need a 4MB photo under 500KB, lossless compression cannot get you there. PNG is lossless by nature, which is exactly why you cannot aim a PNG at a byte target.
What JPEG quality should I use?
0.80 to 0.85 for almost everything. Above 0.90 you are spending a lot of bytes on detail that is invisible at any normal viewing size, and below 0.70 flat areas like skies and skin start showing block edges. If you have a byte target to hit, do not pick a quality at all — let a tool bisect to the highest one that fits under your number.
Does resizing an image lose quality?
Only if you resize below what will be displayed. Reducing a 4032-pixel-wide photo to 2560 is invisible on any screen that was going to show it at 2560 or less, because the browser was going to discard that detail anyway. Resizing down to 400 pixels and then viewing it full-screen is where visible softness comes from. Resize to the largest size anything will actually use.
Why did my image get bigger after compressing it?
Three common causes. You saved a photograph as PNG, which cannot compress photographic noise and routinely produces files several times larger than the JPEG. You re-encoded at a higher quality than the original was saved at, so the encoder spent bytes preserving existing artefacts. Or the tool added metadata — a colour profile and an EXIF block can be tens of kilobytes, which matters enormously when the target is 50KB.
Do it now, in this tab
Each of these opens the tool with the target already set. It runs on your own machine — nothing is uploaded, there is no watermark and no signup, and the output is measured before you get it.
Reference
The limits this guide refers to
Each number carries the date it was last checked against the platform's own documentation.
Next
Keep reading
- JPEG, PNG and WebP, and when each one winsThe right format depends on one question: does the image have large areas of flat colour, or is it a photograph? Getting it wrong costs a factor of ten.
- Compressing a photo for an online formExam, visa and job portals demand photos under 50KB, 100KB or 200KB with fixed dimensions. Here is how to hit the number without the photo becoming unusable.
- Resizing versus compressing an imageResizing removes pixels. Compressing describes each pixel less precisely. One is usually free and the other always costs something — so the order matters.