Compress JPEG images

A JPG compressor built on MozJPEG, Mozilla’s tuned JPEG encoder, running in your browser. Batch-compress photos, set a quality or an exact size, and keep the files on your device.

What the JPEG quality slider really changes

JPEG splits the picture into 8×8 pixel blocks, turns each block into 64 frequency values, and divides them by a table of step sizes before rounding. The quality number scales that table. Try it on a single block below; the numbers are the real JPEG maths.

Original 8×8 pixels

Frequencies kept 4/64

30-3-14-1

What gets decoded

Top-left cells are smooth, broad changes; bottom-right cells are fine detail. Each is divided by a step from the JPEG quantisation table and rounded, so small high-frequency values become 0, and runs of zeros are almost free to store. At quality 50, 60 of 64 values are zero and the average pixel is off by 0.9 levels (out of 255). Try the “Hard edge” block at quality 10 to see ringing, the halo you get round text in over-compressed JPEGs.

Tips for smaller JPGs

  • Resize first. Set a max width that matches how the image is displayed (for example 1,600 px for a full-width blog image, 1,000–1,200 px for product photos).
  • Smooth beats sharp. Noise and grain cost bytes. A photo shot at high ISO compresses worse than a clean one.
  • Consider WebP or AVIF for websites. The same photo is usually smaller; see WebP vs AVIF.
  • Don’t use JPG for screenshots or logos. Sharp edges ring. Use PNG compression instead.

Questions

What JPEG quality should I use?

For photos on websites, 70–80 is the common range where artefacts are hard to notice. Go to 85–90 for images people will zoom into, like product close-ups. Below 60, blockiness and colour smearing start to show on smooth gradients.

Why does re-saving a JPEG make it worse?

Each lossy save quantises the image again, so errors accumulate. Compress from the best original you have, and do it once at the end of editing.

What is progressive JPEG?

A progressive JPEG stores a coarse full-image pass first and refines it, so a blurry preview appears early on slow connections. MozJPEG makes files progressive by default, and they are often slightly smaller too.

Is MozJPEG compatible with every viewer?

Yes. MozJPEG writes standard JPEG files; it just makes smarter encoding choices. Anything that opens a JPEG opens these.