The test kept sampling and scan layout fixed
We encoded three inputs at quality 50, 80 and 95 to find out what those familiar numbers actually select, not to name a winning encoder. A smaller output can reflect a different choice about which details to keep, so we kept the originals and examined the same small regions in every output.
The encoders were libjpeg-turbo 3.2.0 and MozJPEG 4.1.5, built from its official source.
Two inputs were sizes of the same beach photograph from Pexels, 1400 × 933 and 5760 × 3840 pixels, so they show one scene. The third was an original 1024 × 640 document-management interface captured in Chrome, with small red warning text, black text and pale panels.
We prepared each input once as an opaque, correctly oriented 8-bit sRGB PPM, and both encoders read exactly the same PPM bytes. The photographs began as JPEGs, so this tests exports from those decoded images, not development from camera raw files.
Both tools received -sample 2x2,1x1,1x1 -baseline -optimize, but -baseline means different things in each. In libjpeg-turbo it limits the quantization tables to 8-bit values, and baseline output is already the default. In MozJPEG it turns off the default progressive coding. The frame headers confirmed that all 18 files were baseline JPEGs with 4:2:0 sampling.
File sizes at quality 50, 80 and 95
| Input | Quality | libjpeg-turbo bytes | MozJPEG bytes |
|---|---|---|---|
| Beach | 50 | 93,678 | 70,787 |
| Beach | 80 | 177,603 | 144,384 |
| Beach | 95 | 327,773 | 298,227 |
| Large photograph | 50 | 990,416 | 819,376 |
| Large photograph | 80 | 2,276,364 | 2,071,237 |
| Large photograph | 95 | 3,395,869 | 2,916,117 |
| Interface | 50 | 26,514 | 21,560 |
| Interface | 80 | 38,376 | 33,048 |
| Interface | 95 | 61,608 | 56,058 |
A higher number gave a larger file in every series, but the gap between the encoders did not stay constant. At quality 80, MozJPEG's file was 18.7% smaller for the beach, 9.0% for the large photograph and 13.9% for the interface, measured against the libjpeg-turbo file.
These are byte counts at the same requested number, not at the same visual result. The gap changed from image to image, so three files cannot support a conversion such as one tool's 80 equalling the other's 75. Comparing efficiency would mean adjusting the settings until the same crops look alike, which we did not do.
The detail behind the byte counts
We opened the source and both quality-80 outputs in Google Chrome 157.0.8103.78 on macOS 27.0.1. The crops show the same 160 × 110 beach region and 160 × 70 interface region from each file, enlarged three times with nearest-neighbour scaling.
Source

libjpeg-turbo, quality 80

MozJPEG, quality 80

Source

libjpeg-turbo, quality 80

MozJPEG, quality 80

The smaller quality-80 file did not keep the same visible detail in these crops. Fixing the sampling removed one variable, but it did not make the two encoders' quality controls equivalent.
What the JPEG header says
A JPEG stores quantization tables, not the quality number from the export dialogue. The decoder uses those tables and the image data; the encoder decides how its quality control maps to the tables and to its other choices.
We read both tables from every output. At a given quality value, each encoder used the same tables for all three inputs, but the two encoders' tables were different.
libjpeg-turbo, quality 80

MozJPEG, quality 80

The quality-80 luminance tables differed in 61 of 64 entries. MozJPEG's steps were larger in 53 positions, smaller in 8 and equal in 3. Both tables began with 6; the next two entries were 4 and 4 for libjpeg-turbo and 6 and 6 for MozJPEG, and the bottom-right entries were 40 and 167.
A larger step keeps less precision for that coefficient. At the same “80”, MozJPEG was set to discard more detail in most positions, which matches the smoother wood and softer lettering in the crops and, together with the encoder's other choices, helps explain its smaller files. The ratio 167:40 is not a fourfold quality difference; these are steps for one spatial-frequency position, not a scale of visual quality.
Check an export before carrying its number into another tool
Start from the same source in both tools and keep the dimensions, colour conversion, sampling and progressive or baseline mode fixed. Then compare bytes and the same crop. Enlarged crops show where the differences are; check at 100% and at the size you will display as well, where some of them fade. Change one setting at a time.
Our verified command for the installed libjpeg-turbo encoder was:
cjpeg -quality 80 -sample 2x2,1x1,1x1 -baseline -optimize \
-outfile photo-turbo-80.jpg photo.ppmMozJPEG's cjpeg accepted the same options. A command called cjpeg may belong to either encoder, so run cjpeg -version and note the result before comparing files.
To read the tables with libjpeg-turbo's decoder, we verified this command on both quality-80 files:
djpeg -verbose -verbose -outfile /dev/null photo.jpgIt writes diagnostic output to stderr. Look for Define Quantization Table 0 for the luminance table and table 1 for the colour channels; each appears as eight rows of eight values in natural order. On both of our quality-80 files, every printed value matched the tables we extracted.
File-inspection tools may also estimate a “quality” value. We tested ImageMagick on the two beach files:
magick identify -format '%f %Q\n' photo-turbo-80.jpg photo-mozjpeg-80.jpgIt reported 80 for the libjpeg-turbo file and 50 for MozJPEG's, although both were made with -quality 80. Such an estimate is the tool's reading of the stored tables, not the number originally given to the encoder.
When you move an image pipeline to another encoder, keep a small set of representative files, including a photograph with fine texture and a screenshot with coloured text, and record the encoder version and options with the quality value. The same check works for an online tool such as Bitinz: compress the same source and inspect the same crops. For background, read lossy vs lossless compression and the chroma subsampling test.
FAQ
- Is quality 80 an 80% copy of the original?
- No. JPEG does not define that number as a percentage of pixels, detail or file size kept. Treat it as a control within one encoder and inspect the result: our quality-80 files had different tables and sizes despite receiving the same pixels.
- Can a smaller JPEG at the same number be called more efficient?
- Not from the byte count alone. Our table shows smaller files at the same requested number, not at equal visual quality. Raise the number for the softer output until the same crops look alike, then compare the byte counts, checking both 100% and the display size.
- Will quality 100 make a JPEG lossless?
- No. With libjpeg-turbo, quality 100 sets every quantization-table entry to 1, but colour subsampling and rounding can still lose information. When exact decoded pixels are required, keep a lossless format and verify the pixels instead of exporting JPEG again.