Skip to main content
All posts
Image Compression·

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.

How to compress images without losing quality

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:

VariableWhat it altersTypical savingRisk if pushed too far
Pixel dimensionsTotal pixel count stored in raster50-90% on oversized mastersBlurriness when scaled up beyond source pixels
Format and codecCompression algorithm (JPEG, WebP, AVIF)20-50% vs legacy formatsCompatibility issues in older software
Quality settingQuantization loss during discrete cosine/wavelet transform10-40% per tierRinging artifacts around text, banding in gradients
Embedded metadataEXIF data, GPS coordinates, color profiles5-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 typeRecommended formatQuality floorReason
Portraits and landscape photosWebP or JPEG75-85Complex grain and natural gradients absorb quantization noise well
E-commerce product shotsWebP or AVIF80Sharp edge contrast and brand typography require higher fidelity
App screenshots with small UI textPNG or lossless WebPLosslessLossy quantization introduces halos around sharp letterforms
Logos and transparent illustrationsPNG or SVGLosslessCrisp 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):

ResolutionFormat & qualityOutput sizeSpace savedSSIM scoreVisual fidelity assessment
4000x2667 (Original)JPEG Q954,210 KB71.5%0.994Unnecessary byte overhead for web display
1600x1067 (Resized)JPEG Q90480 KB96.7%0.989Pristine detail; excessive size for mobile feeds
1600x1067 (Resized)WebP Q82192 KB98.7%0.982Visually lossless sweet spot; recommended
1600x1067 (Resized)WebP Q70114 KB99.2%0.953Minor macroblocking visible in shadow areas
800x533 (Mobile)WebP Q8078 KB99.4%0.981Optimized 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 modePixel data altered?Best application
Pure losslessNo, bit-for-bit exactArchival assets, medical imaging, legal documentation
Visually losslessYes, below human perceptual thresholdsWeb articles, social media, marketing collateral
Metadata strippingNo, image pixels untouchedQuick 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.

Try it now — 100% in your browser

No upload, no sign-up, no watermark. Your files never leave your device.

Open Image Compressor