JPEG Compression Explained: How It Works & How to Use It Right

You export a photo from Lightroom, Photoshop, or your phone and it's 8 MB. You need it under 200 KB for your website, email campaign, or CMS upload limit. You drag the quality slider down — but how far is too far? At what point does the image start looking bad? And why does re-saving a JPEG make it worse each time?

JPEG compression is the most widely used image format on the web, yet most people use it on autopilot. Understanding how it actually works — and which settings to use for which situations — is the difference between images that look sharp at 150 KB and images that look terrible at 400 KB.

Quick Answer

JPEG compression works by breaking an image into 8×8 pixel blocks, converting them into frequency data using the Discrete Cosine Transform (DCT), and discarding high-frequency details the human eye is least sensitive to. For web use, a quality setting of 75–85 delivers files 70–90% smaller than the original with no visible degradation. Never re-save a JPEG from a JPEG — always keep the original.

What is JPEG compression?

JPEG (Joint Photographic Experts Group) is a lossy compression format — meaning it permanently discards some image data every time you save. Unlike PNG, which encodes every pixel exactly, JPEG makes calculated bets about which visual information the human eye won't miss, then throws that information away to shrink the file.

The process happens in three stages under the hood:

After quantization, the remaining coefficient data is losslessly encoded using Huffman coding — a final compression pass that reduces redundancy without losing any more data. The quality setting you choose controls exclusively how aggressively the quantization step discards information; it has no effect on the DCT or Huffman stages.

🔍 Key insight The quality slider in Photoshop, Lightroom, and most export tools is not a percentage of "how good the image looks." It controls the quantization divisor table — a 1–100 mapping that different applications implement differently. A quality of 85 in Photoshop is not the same as 85 in GIMP or ImageMagick. Always judge by the output file and visual result, not the number alone.

Why it matters for your site and workflow

JPEG is the dominant format for photographs on the web. Getting the compression right has downstream effects that ripple through every digital touchpoint:

📊 Quick stat According to HTTP Archive data, JPEG images account for roughly 60% of total image bytes served on the web. Even a 30% reduction in average JPEG file size across a mid-size e-commerce site can shave hundreds of megabytes per day off total bandwidth consumed.

Step-by-step: how to compress a JPEG correctly

  1. Start from the original, never from a JPEG. Before you compress anything, make sure you're working from a lossless source — a RAW file, a TIFF, a PSD, or a PNG. Every re-save from an existing JPEG compounds artifacts. If your only source is a JPEG, accept that this is your quality ceiling and work down from there.
  2. Identify your target output context. Are you compressing for a web page, an email, a print file, or a social media upload? Each context has a different acceptable file size and viewing distance. Web thumbnails can tolerate more compression than hero images; print files need near-lossless settings. Match your quality setting to the context, not to a single universal number.
  3. Choose your quality setting range. As a starting point: 75–82 for web thumbnails and secondary images, 82–88 for web hero images and product photos, 90–95 for client deliverables and print-adjacent uses. Never go below 70 for anything user-facing unless file size is the absolute constraint.
  4. Strip EXIF metadata. Camera JPEGs embed GPS coordinates, camera model, lens data, copyright, and color profiles — often adding 30–150 KB of invisible overhead. Tools like ExifTool, ImageOptim, or the Rebrixe JPEG Compressor strip this automatically. Always remove metadata before publishing; it also protects user privacy if you're working with user-uploaded content.
  5. Consider chroma subsampling settings. Most JPEG exporters default to 4:2:0 chroma subsampling, which halves color resolution in both axes. For photographs this is usually invisible. For images with sharp color boundaries — infographics, text on colored backgrounds, screenshots — switch to 4:4:4 (no subsampling) to avoid color fringing on edges.
  6. Use progressive encoding for web images. A progressive JPEG loads in multiple passes — it appears blurry, then sharpens — rather than loading top-to-bottom like a baseline JPEG. This makes pages feel faster on slow connections. In Photoshop, this is the "Save for Web → Progressive" option; in ImageMagick it's -interlace plane.
  7. Do a visual check at 100% zoom. Open the exported JPEG side-by-side with the original. Look for blocking artifacts (visible squares in smooth areas), ringing (dark halos around sharp edges), and color banding in gradients. If you see any of these, increase quality by 5 points and re-export. If the images look identical, try decreasing by 5 to see if you can go smaller without visible change.
  8. Consider WebP as an alternative. If you're compressing for modern web delivery, WebP produces files 25–35% smaller than JPEG at equivalent visual quality. All major browsers support it as of 2024. The Rebrixe JPEG to WebP Converter handles the conversion client-side with no uploads required.
Try the Rebrixe JPEG Compressor — free No uploads, no signup. Runs entirely in your browser.
Compress JPEG Now →

Common mistakes that ruin JPEG quality

1. Re-saving a JPEG from a JPEG

This is the single most destructive workflow error in image handling. Every time you open a JPEG, make any edit — even just cropping — and save it again as JPEG, you're running the quantization step on already-quantized data. Artifacts from the first save get re-quantized in the second save, compounding into visible blocking and smearing. After 3–5 generations of re-saving, even a high-quality original becomes noticeably degraded. The fix: always keep the original in a lossless format and only export to JPEG as the final step, never as an intermediate.

2. Using quality settings below 70 for photographs

The file size savings below quality 70 are real, but so are the visible artifacts. Compression blocking becomes apparent in smooth areas like sky gradients, skin tones, and out-of-focus backgrounds. If your file size target requires going below 70, you're better served by resizing the image dimensions down first — a photograph at half resolution saved at quality 82 will almost always look better and be smaller than the full-resolution image saved at quality 55.

3. Ignoring chroma subsampling for text-heavy images

JPEG's default 4:2:0 chroma subsampling is tuned for photographs where color boundaries are soft. Apply it to an image with sharp color transitions — text on a solid background, a bar chart, a logo embedded in a photo — and you get color fringing: red or blue halos on black text, muddy edges on flat-color graphics. Switch to 4:4:4 subsampling (no color downsampling) for any JPEG that contains text or flat design elements.

4. Not stripping metadata before publishing

Camera-generated JPEGs can carry 50–200 KB of EXIF metadata — GPS location, device serial numbers, shooting parameters. This data is invisible to viewers but adds measurable weight to every file served. More importantly, if you're publishing images taken on a personal device, that GPS data reveals exactly where the photo was taken. Always strip metadata before serving images publicly.

5. Using JPEG for images that require transparency

JPEG has no alpha channel. If your image needs a transparent background — a product cut-out, a logo, an icon — JPEG will fill the transparency with a flat color (usually white or black, depending on the tool). Use PNG or WebP for any image requiring a transparent background. Using JPEG for transparency-dependent assets is a mistake no re-compression can fix.

💡 Pro tip Before finalising your JPEG quality setting, zoom to 200–400% in your image viewer and specifically check smooth gradient areas (sky, skin, blurred backgrounds) and any sharp edge transitions (text, object outlines). Artifacts hide in plain sight at 100% zoom but become obvious when you zoom in. If it looks clean at 400%, it's clean enough to publish.

Real-world compression examples

These results are from exporting common photograph types at quality 82 with metadata stripped and progressive encoding enabled, using the Rebrixe JPEG Compressor:

Product Photo
E-commerce product shot
−83%
5.4 MB → 920 KB. Clean at 100% zoom. Ready for web and email.
Landscape Photo
Hero banner photograph
−78%
7.1 MB → 1.56 MB. Sky gradient checked at 400% — no blocking.
Portrait / Headshot
Professional headshot
−71%
3.8 MB → 1.1 MB. Skin tones preserved; no visible ringing on edges.
Infographic as JPEG
Chart / data graphic
−44%
1.2 MB → 672 KB. 4:4:4 subsampling required — text edges clean.

The pattern: photographs compress dramatically with no visible loss at quality 82. Graphics with sharp color boundaries and text compress less and require different subsampling settings — and for those, PNG or WebP is almost always a better format choice.

JPEG quality setting comparison

Not all quality settings are created equal. Here's how different ranges perform across file size, artifact risk, and appropriate use cases:

Quality Range Typical Size Reduction Artifact Risk Transparency Best Use Case
95–100 20–35% None No Print, archival, editing masters
88–94 40–60% Minimal No Client deliverables, high-quality web heroes
75–87 65–85% Imperceptible No Web photographs, product photos, email images
60–74 80–90% Visible at 200%+ No Thumbnails, low-bandwidth contexts only
Below 60 90%+ Clearly visible No Avoid for any user-facing content

Compress your JPEG right now — free

The Rebrixe JPEG Compressor runs entirely in your browser. Your images are never uploaded to a server — compression happens locally with full control over quality settings, metadata stripping, and progressive encoding. No account, no file size limits, no watermarks.

Free JPEG Compressor — no uploads required Client-side only. Your files never leave your device.
Open JPEG Compressor →

Frequently asked questions

JPEG splits your image into 8×8 pixel blocks, converts each block to frequency data using the Discrete Cosine Transform, then discards high-frequency detail (fine textures, sharp transitions) that human vision is least sensitive to. The remaining data is compressed losslessly using Huffman coding. Your quality setting controls how aggressively that frequency data is discarded in the quantization step.
75–85 is the optimal range for most web photographs. At quality 82, a typical product photo compresses 75–85% with no perceptible difference at normal viewing sizes. For hero images and large display photos where quality matters more, use 85–90. Never go below 70 for anything users will see at meaningful size — the file size savings are marginal compared to the quality loss at that range.
Yes — this is called generation loss and it's a defining characteristic of lossy compression. Each save-and-re-open cycle applies quantization to already-quantized data, compounding artifacts. After 3–5 cycles, even a high-quality original becomes noticeably degraded. Always keep a lossless original (PNG, TIFF, or RAW) and only export to JPEG as the final step in your workflow.
JPEG artifacts are visual defects from over-compression. The three most common are: blocking (visible 8×8 pixel squares in smooth areas like sky or skin), ringing (dark halos around sharp edges like text or object outlines), and color banding (loss of smooth gradient transitions). They appear when quality settings drop below 70 or when re-saving from an already-compressed JPEG. Avoid them by using quality 75+ and always working from a lossless original.
Use JPEG for photographs and images with complex, continuous color variation — portraits, landscapes, product photos, food images. Use PNG for screenshots, logos, UI elements, illustrations, and anything requiring a transparent background — JPEG has no transparency support. Use WebP when you're targeting modern browsers and want the best of both worlds: smaller files than JPEG with transparency support like PNG. WebP is now supported by all major browsers and is worth adopting for new web projects.
Chroma subsampling reduces color resolution separately from brightness resolution, since human eyes are less sensitive to color detail than brightness detail. The default 4:2:0 setting halves color resolution in both dimensions — completely invisible in photographs. But for images with sharp color edges (text on colored backgrounds, infographics, logos embedded in photos), it causes color fringing. Switch to 4:4:4 (no subsampling) for those image types to prevent muddy edges.
For web delivery, yes. Progressive JPEGs load in multiple low-to-high resolution passes, so users see a blurry version of the image almost immediately rather than waiting for the top-to-bottom scan of a baseline JPEG. This improves perceived performance — the page feels faster even if the total load time is identical. For large hero images and product photos, always use progressive encoding. File size is usually similar or slightly smaller than baseline.

Compress your JPEG in seconds

The Rebrixe JPEG Compressor runs entirely in your browser — no uploads, no account, no file size limits. Your images never leave your device.

Launch the JPEG Compressor →
← Back to blogs