How to Compress Images Without Losing Quality
8 min read · Updated 2026-06-15
Image compression is one of the highest-leverage optimizations available for websites, email attachments, and storage management. A photograph taken on a modern smartphone can easily be 6–12 MB. With the right compression settings, you can bring that to under 500 KB with no perceptible quality difference. Here is how.
Understanding What "Losing Quality" Actually Means
Quality loss in images is not binary — it exists on a spectrum. Mild JPG compression at 80% quality is invisible to most people in normal viewing conditions. Heavy compression at 40% quality produces blocky artifacts around edges and posterized colors that are immediately obvious. The goal is to find the point where compression artifacts are below the threshold of perception for your audience and display conditions.
The most important thing to understand is that "lossless" does not mean "uncompressed." Lossless compression (used in PNG and lossless WebP) removes redundancy in the file without changing any pixel values. Lossy compression (JPG, lossy WebP) actually modifies pixel values to achieve much smaller files.
Lossless Compression: Safe for Any Image
Lossless compression always produces an identical image on decompression. For PNGs, running them through an optimizer like pngcrush or oxipng can reduce file size by 10–40% with zero quality change. This works by finding more efficient ways to represent the same pixel data — the output is bit-for-bit identical to the original when decoded.
- Safe to apply to any image type with no risk of visible degradation
- PNG files benefit most — optimizers often find 20–40% savings
- JPG files can be losslessly recompressed with tools like jpegtran (reorders internal data for efficiency)
- Savings are smaller than lossy compression — typically 10–40%
Lossy Compression: The Big Gains Are Here
For photographs, lossy JPG or WebP compression delivers 60–90% file size reductions compared to uncompressed or lossless formats. The key is choosing a quality level that is high enough that the artifacts are not noticeable at typical viewing sizes.
Recommended Quality Settings
- JPG 85%: excellent quality, hard to distinguish from original, ~50–60% smaller than lossless
- JPG 75–80%: good quality for most web use, ~65–75% smaller
- JPG 60–70%: acceptable for thumbnails and previews, ~80% smaller
- JPG below 60%: visible artifacts, only appropriate for very small previews
- WebP 80%: typically matches JPG 85% quality at 25–35% smaller file size
A quick test: compress your image at two settings, then zoom into the compressed version at 100% and look at areas with fine detail like hair, foliage, or text. If you cannot spot the difference, the lower setting is fine.
Format Choice Is Part of Compression Strategy
Choosing the right format can have as much impact as the quality setting. For photographs, JPG or WebP are correct. PNG is a poor choice for photos because its lossless compression cannot compete with JPG's lossy approach in terms of file size. A photograph saved as PNG is typically 5–10x larger than the same image at high-quality JPG.
Conversely, for screenshots, diagrams, and graphics with text or flat colors, PNG often produces smaller files than JPG because its lossless algorithm efficiently handles the repetitive pixel patterns. JPG compression also creates obvious ringing artifacts around text edges that make it a poor choice for these images.
Resize Before You Compress
The single most effective way to reduce file size is to reduce dimensions. A 4000×3000 pixel photo has 12 million pixels. If it will be displayed at 800×600 on your website, you are storing 25 times more pixels than needed. Resizing to 800×600 first, then compressing, will produce a far smaller file than compressing the full-resolution image.
- Identify the maximum display dimensions for your use case
- Resize to that size (or 2x for retina displays)
- Then apply compression
- For social media, check the platform's recommended dimensions and serve exactly that size
Metadata Stripping
Photos taken on smartphones carry EXIF metadata: GPS coordinates, camera model, lens settings, timestamps, and sometimes embedded thumbnails. This metadata can add 20–100 KB to an image file and is usually unnecessary for web display. Stripping EXIF data is effectively free lossless compression — the image looks identical but is smaller.
Batch Processing Multiple Images
When you have dozens or hundreds of images to compress — product catalog photos, a photo gallery, screenshots for a blog post — doing them one at a time is impractical. Batch processing applies the same settings to all images at once.
Frequently asked questions
How much can I compress a JPG without visible quality loss?
For most images viewed on screen, a quality setting of 75–85% (on a 0–100 scale) is the threshold below which artifacts become noticeable. The exact level depends on image content — images with large flat areas tolerate more compression than images with fine textures.
Is it better to compress or to resize?
Both, in that order. Resize first to the actual display dimensions, then compress. Resizing eliminates pixels you do not need at all; compression reduces the data required to encode the pixels you keep.
Can I compress a PNG without converting it to JPG?
Yes. PNG-specific lossless optimizers can reduce file size by 10–40% without any pixel change. However, if the image is a photograph, converting to JPG or WebP and then compressing will produce a dramatically smaller file.
What is the difference between image compression and image conversion?
Compression reduces the file size of an image in its existing format (or via format change). Conversion changes the format — which often changes the compression method as a side effect. Compressing a JPG keeps it JPG but uses a higher compression ratio; converting it to WebP changes the format and usually also reduces size.
Does compressing images affect SEO?
Yes, positively. Google's Core Web Vitals metrics include Largest Contentful Paint (LCP), which is heavily influenced by image loading times. Smaller images load faster, improving LCP scores and potentially search rankings.
Related tools
Keep reading
- JPG vs PNG: Which Image Format Should You Use?JPG and PNG are the two most common image formats on the web, but they serve very different purposes. Learn which one to use for photos, logos, screenshots, and more.
- What Is WebP and Should You Use It?WebP is a modern image format from Google that delivers smaller files than JPG or PNG with comparable quality. Here is everything you need to know before switching.
- Image Resolution, DPI, and PPI ExplainedResolution, DPI, and PPI are among the most misunderstood concepts in digital imaging. This guide clarifies the difference and explains what matters for print and screen.