JPEG is the workhorse format of the web, but the vast majority of JPEGs that ship in production are larger than they need to be. A photo exported straight from a camera, a design tool, or a content management system usually carries redundant metadata, a quality setting cranked far higher than the eye can perceive, and an encoding layout that delays rendering. Learning how to optimise JPEG files properly can cut payload by anywhere from 30 to 70 percent with no visible change in quality. This guide walks through the whole process, from quick lossless wins to advanced encoder settings, so you can shrink images with confidence.

Throughout this article we use the free optimise JPEG tool as the reference workflow, so you can follow along and watch the savings appear on your own images in seconds.

What Optimising a JPEG Actually Means

Optimisation is not a single action. It is a stack of techniques that each shave bytes in a different way, and understanding them lets you decide how aggressive to be:

  • Re-quantisation lowers the quality factor so the encoder discards high-frequency detail the eye barely registers.
  • Huffman table optimisation rebuilds the entropy-coding tables to match the specific image instead of using generic defaults.
  • Metadata stripping removes EXIF, GPS, embedded thumbnails, and comment blocks that bloat the file but never render.
  • Progressive re-ordering rearranges the encoded data so the image fades in and frequently compresses smaller too.

Some of these are lossless — Huffman optimisation, metadata stripping, and progressive conversion never change a pixel. Others, namely re-quantisation, are lossy. The art of good optimisation is combining a generous helping of the free, lossless techniques with a gentle, well-judged lossy pass.

Step-by-Step: Optimising a Single JPEG

Here is a reliable sequence that works for almost any web photograph. Follow it in order, because each step sets up the next.

  1. Start from the highest-quality source. Never re-save an already-compressed JPEG repeatedly; generational loss accumulates because each save re-quantises data that was already quantised. Always work from the original export.
  2. Resize before you compress. If the image is displayed at 800px wide, do not ship a 4000px file. Use the resize image tool first, because pixel count dominates file size more than any encoder setting.
  3. Pick a target quality. A quality factor between 75 and 85 is the sweet spot for photographs. Below 70 you start to see blocking artefacts in flat areas such as skies and gradients.
  4. Strip metadata. Remove EXIF, GPS, and thumbnails unless you specifically need copyright or colour-profile data.
  5. Enable progressive encoding. This improves perceived load speed and usually trims a few extra percent.
  6. Optimise Huffman tables. This is free, lossless, and always worth doing.
  7. Compare before and after. View the two side by side at 100 percent zoom to confirm the quality is acceptable before you ship.

You can run all of these in a single pass with the optimise JPEG tool, which applies Huffman optimisation, metadata stripping, progressive conversion, and your chosen quality target automatically.

Choosing a Quality Setting

The JPEG quality factor is widely misunderstood. It is not a percentage of visual fidelity; it is an index that scales a set of quantisation tables. Doubling the number does not double quality, and the relationship is steeply non-linear. The jump from quality 95 to 100 can double the file size while the eye sees almost nothing, whereas the drop from 85 to 80 saves real bytes for a negligible visible cost. This is why blindly exporting at quality 100 wastes so much bandwidth.

A Practical Quality Comparison

  • Quality 95–100: Visually lossless but very large files. Reserve for hero images on fast connections, or for print.
  • Quality 80–90: The default for high-quality web photography. Excellent results at a sensible size.
  • Quality 70–80: Great for thumbnails, galleries, and bandwidth-sensitive pages.
  • Quality below 70: Visible artefacts; acceptable only for tiny previews where size trumps fidelity.

Because the ideal setting depends on image content, always preview the result. Smooth images such as portraits and skies tolerate lower quality gracefully, while detailed textures like foliage or fabric need a higher setting to avoid mushiness.

Lossless Versus Lossy Optimisation

If you must preserve every pixel — for archival masters, legal scans, or images you will edit further — stick to lossless techniques only. You will still recover meaningful savings from Huffman optimisation and metadata removal alone. Our deep dive on lossless JPEG optimisation explains exactly how much you can expect without ever touching image data.

For ordinary web delivery, a modest lossy pass at quality 80 combined with lossless cleanup almost always wins. The combination is precisely what makes the optimise JPEG tool effective on real photographs: you get the big reduction from re-quantisation plus the free gains from rebuilt entropy tables and a slimmer header.

Common Mistakes to Avoid

A few habits quietly sabotage optimisation efforts. Watch for these:

  • Re-compressing repeatedly. Every save degrades a JPEG further. Keep a pristine master and always optimise from it.
  • Optimising before resizing. Shrinking pixels after compressing wastes the work; resize first.
  • Using JPEG for the wrong content. Logos, screenshots, and line art compress poorly and show ringing. Use PNG or a modern format for those.
  • Forgetting metadata. A camera thumbnail and EXIF block can add tens of kilobytes you never see.

When JPEG Is Not the Answer

JPEG is built for photographs and continuous-tone images. It is a poor fit for screenshots, line art, logos, and anything with sharp edges or large flat colours, where its block-based compression produces visible ringing. For those, PNG is better. And for almost any photo, converting to WebP yields a smaller file at the same quality — see our comparison of JPEG versus WebP and try the JPEG to WebP converter to measure the difference on your own images.

Batch and Automation

Optimising one image is easy; optimising a thousand is where discipline pays off. For a quick smaller file you can drop any image into the compress JPEG tool. But if you are processing an entire library or wiring optimisation into a deployment so nothing slips through, read our guide on how to automate image optimisation, which shows how to make compression a default rather than a chore.

Verifying Your Results

Optimisation is only finished once you have confirmed the output is genuinely smaller and still looks right. A surprising number of "optimised" images end up larger than the original because a tool added a colour profile, switched to a less efficient layout, or re-encoded an already-compressed file. Always check three things after a pass.

First, compare the file sizes directly; if the new file is not meaningfully smaller, something went wrong. Second, view the before and after at 100 percent zoom, paying special attention to flat areas like skies and to fine text, where artefacts appear first. Third, confirm you have not accidentally stripped a colour profile the image needed, which can cause a visible colour shift on wide-gamut screens.

For a single hero image it is worth being meticulous, because that image often drives your page's loading metric. For bulk libraries, set a sensible default once, verify a representative sample, and then trust the process. Either way, keeping the pristine original means you can always re-run optimisation with different settings if the result is not quite right, without compounding generational loss.

Conclusion

Optimising a JPEG is about stacking small, well-understood wins: right-size the pixels, choose quality around 80, strip metadata, optimise the Huffman tables, and go progressive. Applied together, these routinely halve a file with no visible loss. The fastest way to apply the entire stack is the optimise JPEG tool at jpegoptim — drop in an image, pick your settings, and watch the bytes disappear.