How to Compress a JPEG: What Actually Happens and What You Should Know
JPEG compression is one of those things most people do without fully understanding — and that gap can lead to blurry photos, unexpectedly large files, or quality loss you can't undo. Whether you're optimizing images for a website, clearing space on a phone, or preparing photos for email, understanding how JPEG compression works helps you make smarter decisions about when and how to apply it.
What JPEG Compression Actually Does
JPEG uses lossy compression, which means it permanently discards image data to reduce file size. Unlike ZIP compression (which is lossless and fully reversible), every time you compress a JPEG, some detail is thrown away — and once it's gone, it can't be recovered.
The compression works by dividing an image into small blocks of pixels (typically 8×8), analyzing the color and brightness patterns, and discarding information that human vision is least likely to notice — particularly fine detail in areas of subtle color variation. This is why over-compressed JPEGs often show blocky artifacts, especially around edges and in areas with gradients like sky or skin tones.
The trade-off is significant: a high-quality JPEG might be 3–5 MB, while the same image at 60% quality might be under 500 KB — with changes that are barely visible at normal viewing sizes.
The Quality Scale: What the Numbers Mean
Most compression tools use a quality scale from 0 to 100 (or sometimes 1 to 12 in older software like Photoshop). Higher numbers mean less compression and larger files. Lower numbers mean more aggressive compression and smaller files.
| Quality Range | Typical Use Case | Visual Impact |
|---|---|---|
| 90–100 | Print, archival, professional editing | Minimal to none |
| 70–85 | Web display, social media | Slight, usually invisible at screen size |
| 50–65 | Email attachments, thumbnails | Noticeable at close inspection |
| Below 50 | Extreme size reduction only | Visible artifacts likely |
These are general guidelines — the actual file size and visible quality depend heavily on the image content, resolution, and original source quality.
Common Ways to Compress JPEGs
In-Browser and Online Tools
Tools like Squoosh, TinyJPEG, and similar web-based compressors let you upload an image, adjust quality settings, and download the result — no software installation required. Most offer a before/after preview, which makes them practical for one-off tasks. They're best suited for occasional use where you want quick results without learning a dedicated app.
Desktop Software
Adobe Photoshop and GIMP (free) both offer granular control when exporting JPEGs. Photoshop's "Save for Web" feature shows live file size estimates as you drag the quality slider. GIMP's export dialog works similarly. These tools are better suited for batch workflows or when you need to balance quality carefully — such as preparing product images or editorial photos.
Command-Line Tools 🖥️
ImageMagick and jpegoptim are popular command-line utilities for bulk compression. They can process entire directories of images with a single command, making them practical for developers or anyone managing large image libraries. jpegoptim specifically targets JPEGs and can apply both lossy and lossless optimization (stripping metadata without reducing visual quality).
Built-In OS Options
- Windows: The Photos app and Paint both allow saving JPEGs with adjustable quality, though with limited control.
- macOS: Preview lets you adjust quality in the export dialog — a quick option for light compression without third-party tools.
- iOS/Android: Most camera apps let you adjust image capture quality before shooting, but post-capture compression typically requires a dedicated app.
Lossless vs. Lossy Compression: A Critical Distinction
Not all JPEG compression removes visual data. Lossless JPEG optimization strips out embedded metadata — like camera settings (EXIF data), color profiles, and thumbnails baked into the file — without touching the actual pixels. This can reduce file size by 10–20% with zero quality loss.
If you're compressing images for a website and want to preserve as much visual quality as possible, lossless optimization is always worth doing first. Lossy compression should only follow if file size targets still aren't met.
Factors That Shape Your Results 📁
How much you can compress a JPEG before quality degrades depends on several variables:
- Original resolution: A 20 MP photo has more data to work with than a 5 MP one — both can compress to 500 KB, but the 20 MP image will look sharper at that size.
- Image content: Photos with fine detail (textured fabric, hair, foliage) show compression artifacts sooner than smooth subjects (solid backgrounds, portraits at distance).
- Source file quality: If the original was already heavily compressed, compressing again stacks the losses.
- Intended display size: A 400-pixel-wide web thumbnail can tolerate much more compression than a 2,000-pixel hero image.
- Output destination: Print requires higher quality than screen; screen quality requirements vary between retina and standard displays.
Re-Saving Compressed JPEGs: The Generation Loss Problem
Every time you open a JPEG and re-save it — even at the same quality setting — you're introducing a new round of lossy compression. Over multiple saves, this generation loss accumulates and becomes visible. The practical implication: always keep an uncompressed original (in a lossless format like TIFF or PNG, or as a raw camera file) and compress only export copies. Never overwrite your original with a compressed version.
The Variables That Make This Personal
The right compression approach depends on factors only you can assess: how large your files are, where they're going, what tools you already have access to, and how much quality loss is acceptable for your specific use case. Someone preparing high-res product photos for print has completely different requirements than someone clearing 10 GB of vacation photos off their phone — and what works perfectly in one scenario could be entirely wrong in the other.