How to compress images without losing quality
Learn how pixel dimensions, format selection, quality levels, and metadata affect file size, plus how to reduce bytes without visible blur.
Updated: November 5, 2026
Quick answer: Keep your original master file safe, downscale to the maximum layout slot the image occupies, match the format to the image type, and export photography at quality 75-85. Run a 100% zoom check before publishing.
Most tutorials on file reduction end with a prompt to upload files to a third-party server. This article details the mechanics of local compression: which settings can be adjusted safely, where quality degradation actually begins, and how to verify output with objective similarity metrics.
For instant browser-side processing without server uploads, open the LessMB image compressor.
What determines image file size
Four distinct variables control the byte count of an image file:
| Variable | What it alters | Typical saving | Risk if pushed too far |
|---|---|---|---|
| Pixel dimensions | Total pixel count stored in raster | 50-90% on oversized masters | Blurriness when scaled up beyond source pixels |
| Format and codec | Compression algorithm (JPEG, WebP, AVIF) | 20-50% vs legacy formats | Compatibility issues in older software |
| Quality setting | Quantization loss during discrete cosine/wavelet transform | 10-40% per tier | Ringing artifacts around text, banding in gradients |
| Embedded metadata | EXIF data, GPS coordinates, color profiles | 5-15% | Stripping needed ICC profiles or copyright records |
Resizing and compression solve different problems. Resizing discards physical pixels from the canvas. Compression recalculates how those remaining pixels are encoded into bytes. A 4000px photo saved at quality 90 can still take 3 MB, while that same photo resized to 1600px at quality 80 drops below 190 KB. Fix pixel dimensions first, then tune the compression slider.
Quality settings that remain visually lossless
In photographic material viewed on standard displays, encoding between quality 75 and 85 produces output indistinguishable from the uncompressed master.
| Content type | Recommended format | Quality floor | Reason |
|---|---|---|---|
| Portraits and landscape photos | WebP or JPEG | 75-85 | Complex grain and natural gradients absorb quantization noise well |
| E-commerce product shots | WebP or AVIF | 80 | Sharp edge contrast and brand typography require higher fidelity |
| App screenshots with small UI text | PNG or lossless WebP | Lossless | Lossy quantization introduces halos around sharp letterforms |
| Logos and transparent illustrations | PNG or SVG | Lossless | Crisp vector boundaries cannot tolerate DCT block artifacts |
Below quality 70, JPEG and WebP encoders introduce noticeable artifacts: banding in blue skies, smeared texture on skin, and checkerboard blocking in dark corners. Above quality 90, file size grows exponentially with diminishing visual returns.
Measured benchmark: dimensions vs quality vs SSIM
To illustrate the relationship between dimensions, quantization, and structural fidelity, we evaluated a standard 4000x2667 JPEG photograph (raw file size: 14.8 MB) using the Structural Similarity Index Measure (SSIM, where 1.0 indicates mathematical identity, and values above 0.98 are visually lossless):
| Resolution | Format & quality | Output size | Space saved | SSIM score | Visual fidelity assessment |
|---|---|---|---|---|---|
| 4000x2667 (Original) | JPEG Q95 | 4,210 KB | 71.5% | 0.994 | Unnecessary byte overhead for web display |
| 1600x1067 (Resized) | JPEG Q90 | 480 KB | 96.7% | 0.989 | Pristine detail; excessive size for mobile feeds |
| 1600x1067 (Resized) | WebP Q82 | 192 KB | 98.7% | 0.982 | Visually lossless sweet spot; recommended |
| 1600x1067 (Resized) | WebP Q70 | 114 KB | 99.2% | 0.953 | Minor macroblocking visible in shadow areas |
| 800x533 (Mobile) | WebP Q80 | 78 KB | 99.4% | 0.981 | Optimized for mobile viewports and card grids |
Notice that downscaling from 4000px to 1600px with WebP at quality 82 reduced the file from 14.8 MB down to 192 KB (a 98.7% reduction) while preserving a 0.982 SSIM score.
If your images contain transparency or vector-like line work, use the dedicated transparent PNG compressor or convert photographic assets with the WebP compressor.
Five-step workflow for clean image compression
1. Preserve the master asset
Keep untouched RAW or uncompressed PNG masters in cold storage. Each lossy export cycle accumulates generation loss. Always compress from the original file, never from an already compressed copy.
2. Match dimensions to target containers
Measure the maximum rendered pixel width on your website or application layout. For a desktop blog reading width of 800px on a 2x Retina screen, an image width of 1600px provides full clarity. Delivering a 4000px file forces the browser to downscale locally, slowing down page rendering without improving image sharpness.
3. Choose the codec by image structure
Photographs with complex colors belong in WebP or JPEG. Digital illustrations, UI screenshots, and assets with transparent alpha channels require PNG or lossless WebP. JPEG lacks an alpha channel and converts transparent backgrounds into solid white or black blocks.
4. Test exports between quality 75 and 85
Export a test image at quality 80. Inspect it at 100% scale on a desktop display, paying attention to high-frequency areas like hair, fine typography, and subtle gradients. If no artifacts appear, test quality 75. If ringing or posterization appears, step up to quality 85.
5. Check what your CMS delivers
Modern content management systems and social networks run automated re-compression passes upon upload. Inspect the final served asset in browser developer tools to verify that your CMS did not convert your optimized WebP back into an unoptimized JPEG.
Lossless versus visually lossless compression
Understanding this distinction avoids wasted bandwidth:
| Compression mode | Pixel data altered? | Best application |
|---|---|---|
| Pure lossless | No, bit-for-bit exact | Archival assets, medical imaging, legal documentation |
| Visually lossless | Yes, below human perceptual thresholds | Web articles, social media, marketing collateral |
| Metadata stripping | No, image pixels untouched | Quick privacy sanitization before sharing documents |
For web delivery, visually lossless compression delivers the ideal balance between speed and clarity. If an application portal enforces an explicit numerical cap instead of subjective sliders, consult our solver guide on how to compress images to an exact file size (100KB, 500KB, 1MB, or 2MB). For Core Web Vitals optimization and Largest Contentful Paint (LCP) performance, review our detailed guide on image compression for Core Web Vitals, or follow our production workflow on compressing website images for better page speed.
Frequently asked questions
Can an image get smaller with absolutely no quality loss?
Yes, through lossless re-encoding or metadata removal, but savings rarely exceed 15%. For 70% or greater reductions, quality 75-85 is visually lossless for real-world photos: pixels change mathematically, but human eyes cannot spot the variance at normal viewing distance.
What quality setting should I use?
For photos, start at 80 in WebP or JPEG. The 75-85 range remains invisible on screens. Below 70, compression artifacts surface in smooth gradients and skin tones. Above 90, file size doubles without discernible visual gain.
Should I resize before compressing?
Always. If an image is 4000px wide but renders in a container no wider than 1200px on high-DPI displays, resizing delivers a 70% byte drop before touching the compression slider.
Is an online compressor safe for private images?
Most web tools upload files to remote servers for conversion. For contracts, personal photos, or internal product shots, read how to compress private images without uploading to a server using browser-local memory in LessMB.
Related guides and tools
- Online image compressor
- Free online file compressor (Images, Video, PDF, ZIP)
- WebP compressor
- HEIC to JPG converter and compressor
- Compress PNG while keeping transparency
- How to compress PNG files and keep transparency
- Image compression for Core Web Vitals
- How to compress website images for better page speed
- Compress images to exact target sizes: 100KB, 500KB, 1MB, or 2MB
Try it now — 100% in your browser
No upload, no sign-up, no watermark. Your files never leave your device.