JPEG encoders compared: MozJPEG, libjpeg-turbo, Guetzli and jpegli

Same format, same decoders, very different output. Which encoder produced your JPEG affects its size by more than most people's quality-setting agonising does.

The field

libjpeg-turbo
The speed baseline. SIMD-optimised libjpeg; output comparable to the original.
MozJPEG
Mozilla's fork. Trellis quantisation and tuned tables; smaller files, slower.
Guetzli
Google's perceptual encoder. Very small output, extremely slow, high quality only.
jpegli
Newer Google encoder from the JPEG XL project. Better quality per byte, and fast.
Browser canvas
Whatever the browser ships. Fast, convenient, not the smallest.
All output
Ordinary JPEG files. Every decoder reads them.

Which to use

Why the encoder matters at all

The JPEG standard specifies how a file is decoded. It leaves considerable freedom in how one is produced: which quantization tables to use, how to round coefficients, how to order the data, whether to search for better choices.

Encoders exploit that freedom differently, and the spread is significant — comfortably more than the difference between quality 80 and quality 82 that people spend far longer worrying about.

Crucially, every one of them emits a standard JPEG. There is no compatibility question: the output opens everywhere, in everything.

libjpeg-turbo — the baseline

A SIMD-accelerated fork of the original libjpeg, and by some distance the most widely deployed JPEG implementation in the world. It is inside browsers, operating systems and most image libraries.

Its priority is speed, and it is extremely fast. Output size is comparable to classic libjpeg — it did not set out to compress harder, only to do the same work faster.

Use it when throughput matters more than the last few per cent, which is most real-time and high-volume work.

MozJPEG — the practical winner

Mozilla's fork of libjpeg-turbo, built specifically to produce smaller files at matched visual quality. Its main techniques are trellis quantisation — searching for coefficient values that cost fewer bits without visible cost — and quantization tables tuned against perceptual metrics rather than the 1992 originals. It also defaults to progressive encoding.

The result is typically 5–15% smaller than libjpeg-turbo at equivalent quality, sometimes more. It is slower, but the cost is measured in fractions of a second per image, not minutes.

For build-time optimisation this is usually the right choice: a meaningful saving, a mature codebase, and output that is an entirely ordinary JPEG.

Guetzli — interesting, impractical

Google's experiment in perceptual encoding, using its Butteraugli metric to search for the smallest file that is still visually indistinguishable from the original.

It produced impressively small files — often 20–30% below libjpeg — and it was extraordinarily slow, frequently taking minutes per image and considerable memory. It also only operates at high quality settings, so it cannot be used for aggressive compression at all.

It has been effectively superseded and is best understood as a research result rather than a tool to deploy.

jpegli — the interesting newcomer

A more recent encoder from the team behind JPEG XL, which applies techniques learned there to producing ordinary JPEG files. It targets better quality per byte than existing encoders while remaining fast enough for practical use, and it can encode with higher internal precision to reduce banding.

Because its output is a standard JPEG, adopting it carries no compatibility risk — which makes it worth evaluating for anyone running a build-time pipeline. It is newer than the alternatives, so test it against your own content rather than trusting benchmark averages.

What this site uses, and what that costs you

These tools encode through your browser's canvas, which uses whatever JPEG encoder the browser ships — usually libjpeg-turbo. That is fast and requires no downloads, and it is not the smallest possible output.

A server running MozJPEG would produce files perhaps 5–15% smaller than what you get here at the same quality. That is a real difference and worth stating plainly.

The trade is that nothing leaves your device. For a photograph headed to a form or a handful of images for a web page, the privacy is worth more than the last tenth. For a production pipeline processing thousands of images, use MozJPEG or jpegli at build time — that is what they are for.

Try it yourself

Everything below runs in your browser, so you can test any of this on your own files without uploading them.

  • Compress JPEG

    Shrink JPG and JPEG photographs with a quality slider or an exact target size.

    Open the tool
  • Bulk compressor

    One setting across a whole folder, processed in parallel, downloaded as a ZIP.

    Open the tool
  • JPG to WebP

    Typically 25–35% smaller at matched quality. The standard web win.

    Open the tool

Questions

Frequently asked questions

Every answer below is present in the page source, expanded, so it can be read without opening anything.

Does the JPEG encoder really change the file size?

Yes, meaningfully — MozJPEG typically produces files 5–15% smaller than libjpeg-turbo at matched visual quality, and sometimes more. That is a larger difference than most of the quality-setting adjustments people agonise over.

Are files from different encoders compatible?

Completely. Every one of them emits a standard JPEG that any decoder reads. The encoder affects how efficiently the file was produced, not whether it opens.

Should I use MozJPEG?

For build-time or batch optimisation, usually yes — a genuine saving for a fraction of a second per image, with a mature codebase. For real-time encoding where throughput matters, libjpeg-turbo's speed is the better trade.

Is Guetzli still worth using?

Not really. It produced very small files but took minutes per image, used considerable memory and only worked at high quality settings. It is best understood as a research result; jpegli and MozJPEG are the practical options now.

Which encoder does this site use?

Your browser's, whichever it ships — usually libjpeg-turbo. A server running MozJPEG would produce output perhaps 5–15% smaller. The trade is that nothing here leaves your device, which for most jobs is worth more than the last few per cent.

Why does quality 80 differ between tools?

Because the quantization tables are not standardised. The specification includes example tables but does not require them, so each encoder scales its own. Quality 80 in MozJPEG, in Photoshop and in a browser means three different sets of divisors.

From the blog

Related reading

Longer, more practical guides from the blog.

  • Image Compression

    JPEG Quality Settings Explained: What the Number Actually Means

    Quality 80 is not 80% of anything. It is an index into a quantisation table. Measured on one photograph: dropping from 100 to 90 removes 77% of the file and 4.2 dB of fidelity; dropping from 40 to 30 removes 17% and costs almost as much.

    8 min read

  • Practical Guides

    How to Compress Images for a Website Without Wrecking Them

    Resize before you compress. Measured on one photograph: half the width at quality 80 produced a 16.4 KB file, while full width at quality 40 produced 20.6 KB and looked far worse. The order of operations matters more than the settings.

    8 min read

  • Image Formats

    WebP vs JPEG: Which Should You Use, and When JPEG Still Wins

    WebP produced a 27.0 KB file against MozJPEG's 41.1 KB on the same photograph at slightly higher measured fidelity — 34% smaller. It also produced a larger file than JPEG on random noise. The advantage is real and content-dependent.

    9 min read