Best Image Compression Techniques for Faster Websites (2026)

Images account for an average of 51% of total page weight across the web (HTTP Archive, 2025). No other asset type has as much impact on page load time — and no other optimisation delivers faster, more dramatic results than getting your image compression right. A 2 MB page with unoptimised images can often be reduced to 600 KB with zero visible quality difference using the techniques in this guide.

This is the definitive guide to image compression for websites in 2026: what lossy and lossless mean, which quality settings to use, how to pick the right format for each image type, and which tools automate the entire process.

Lossy vs Lossless Image Compression — What Is the Difference?

All image compression falls into one of two categories. Understanding the difference is essential to making the right trade-off for each image on your site.

Lossy Compression

Lossy compression permanently discards image data to achieve smaller file sizes. The data removed is chosen carefully using algorithms that model human visual perception — specifically, we are less sensitive to high-frequency detail (fine texture) and colour variation than to luminance (brightness) and large-scale structure. Lossy encoders throw away the detail we are least likely to notice.

The result: files that are 5–15% of the original uncompressed size, with no visible quality difference at moderate settings. Every re-encode of a lossy image compounds the loss — which is why you should always keep an original master file.

Lossy formats: JPEG, lossy WebP, lossy AVIF, lossy HEIC.

Lossless Compression

Lossless compression finds patterns in the data and stores them more efficiently, without discarding anything. The decompressed result is identical to the original, pixel-for-pixel. Lossless compression algorithms (LZ77, Huffman coding, DEFLATE) look for repeated sequences and store them as references rather than full data — similar to how a ZIP file works.

The result: files that are 40–70% of the original uncompressed size. Larger than lossy, but no quality loss regardless of how many times you save.

Lossless formats: PNG, lossless WebP, lossless AVIF, TIFF, BMP.

PropertyLossyLossless
File size5–15% of original40–70% of original
QualitySlight degradation (usually invisible)Perfect — identical to original
Re-save safe?No — each re-save degrades furtherYes — unlimited re-saves
Best forPhotographs, hero images, product photosScreenshots, icons, logos, text-heavy images
FormatsJPEG, lossy WebP, lossy AVIFPNG, lossless WebP, TIFF

The rule of thumb: use lossy compression (WebP or JPEG) for any image with smooth colour gradients and photographic content. Use lossless compression (lossless WebP or PNG) for images with sharp edges, flat colour areas, text, logos, and screenshots.

Technique 1: Use the Right Format

Switch to WebP as Your Default

Saves 25–35% vs JPEG at same quality

WebP is the highest-impact single change for most websites. Serve lossy WebP for photographs (quality 80–85), lossless WebP for screenshots and graphics with transparency. Use a <picture> element with a JPEG fallback. This alone resolves Google PageSpeed's "Serve images in next-gen formats" audit.

Add AVIF as a First Choice

Saves 40–50% vs JPEG at same quality

AVIF achieves even better compression than WebP and is supported in Chrome, Firefox, and Safari 16+. Serve it as the first source in a <picture> element with WebP and JPEG as fallbacks. Pre-encode AVIF at build time (encoding is slow; decoding is fast). Use quality 60–70 for AVIF — equivalent visual quality to JPEG Q85 but much smaller files.

Never Use PNG for Photographs

PNG photos are 3–5× larger than WebP

PNG is lossless and produces huge files for photographic content. A photo that is 280 KB as WebP might be 1.2 MB as PNG. Use PNG only for images that specifically require lossless compression: screenshots, logos, diagrams, images with text, or images with transparency that would show JPEG artefacts around the alpha edge.

Use SVG for Logos and Icons

Vector graphics scale infinitely at near-zero size

Logos, icons, illustrations, and simple diagrams should be SVG (Scalable Vector Graphics) rather than any raster format. An SVG logo that renders perfectly at any size might weigh 2–8 KB; the same logo as a PNG for retina screens might be 50–200 KB. SVGs also render crisply on every screen density without needing @2x or @3x variants.

Technique 2: Get Quality Settings Right

Quality settings determine the compression aggressiveness — how much data is discarded (lossy) or how much effort the encoder expends finding patterns (lossless). Getting these right avoids the two failure modes: files that are unnecessarily large (quality too high) or visibly degraded (quality too low).

Use caseJPEG qualityWebP qualityExpected file size*
Hero/banner (1200×630)80–8578–83150–300 KB
Article inline images78–8376–8180–180 KB
Thumbnails (300×300)70–7868–7620–60 KB
Product photos (e-commerce)82–8880–86100–250 KB
Archive / master files92–95Keep as RAW/TIFF
Screenshots / UILossless40–120 KB

*For typical 12-megapixel photographs. Actual sizes vary by image complexity.

Note that WebP quality values are not directly equivalent to JPEG quality values — WebP Q80 typically produces results comparable to JPEG Q85-90 in visual quality. Start with WebP at 80 and compare visually with your source JPEG.

Technique 3: Serve Correctly Sized Images

Serving a 2000px-wide image in a 400px container wastes 96% of the pixel data. The browser downloads the full-resolution file and then scales it down in CSS. This is one of the most common and most wasteful image mistakes.

The fix is responsive images using the srcset attribute:

<img
  srcset="image-400.webp 400w, image-800.webp 800w, image-1200.webp 1200w"
  sizes="(max-width:600px) 100vw, (max-width:900px) 80vw, 1200px"
  src="image-1200.webp"
  alt="Description"
  width="1200"
  height="630"
  loading="lazy"
>

The browser selects the most appropriate resolution based on the device's screen width and pixel density. A mobile user with a 390px screen downloads the 400w variant; a desktop user with a 1440px screen downloads the 1200w variant. Combined with WebP format conversion, responsive images can reduce image payload by 60–70% for mobile users.

Technique 4: Strip Unnecessary Metadata

JPEG files often contain embedded metadata that adds 20–50 KB of file size with no visual benefit:

  • EXIF data — camera model, GPS coordinates, shooting settings, timestamps. Important to keep for personal archives; unnecessary on a web server.
  • ICC colour profiles — usually sRGB (3 KB) or a custom camera profile (50+ KB). Strip to a standard sRGB tag or remove entirely.
  • Thumbnail previews — embedded low-resolution previews used by photo management software. Not needed on the web.
  • XMP/IPTC data — editorial metadata from photo agencies. Often 10–30 KB per image.

Most image optimisation plugins (ShortPixel, Imagify) strip metadata automatically. To strip manually: convert input.jpg -strip output.jpg (ImageMagick) or jpegtran -copy none input.jpg output.jpg.

Technique 5: Lazy Loading

Lazy loading defers the download of off-screen images until the user scrolls near them. Adding it requires one HTML attribute:

<img src="image.webp" alt="Description" width="800" height="500" loading="lazy">

All modern browsers support loading="lazy" natively since 2020. The impact on initial page load depends on how many images are below the fold — on a typical blog post with 6 images, 3–4 are usually below the fold. Deferring those reduces the initial download by 40–70% of total image weight.

Critical rule: never add loading="lazy" to your LCP image (the hero/banner). The LCP image is in the viewport on load and should start downloading as early as possible. For the LCP image, add loading="eager" (or omit the attribute, since eager is the default) and add a <link rel="preload"> in the head.

Technique 6: Use a CDN for Image Delivery

Content Delivery Networks (CDNs) cache your images at servers located physically close to your visitors, reducing download latency regardless of file size. For global websites, CDN delivery can reduce image load times by 40–70% for international users compared to serving from a single origin.

Cloudflare (Free)

Free CDN for any website. Images are cached at 300+ global nodes. Cloudflare Images (paid add-on) adds automatic WebP conversion and resizing.

Cloudinary

Image and video CDN with automatic format conversion (WebP, AVIF), resizing, and quality optimization. Free tier: 25 GB storage, 25 GB bandwidth.

Imgix

Real-time image processing CDN. Append ?auto=format to any URL and it serves the best format each browser supports. Paid from $10/month.

Fastly Image Optimizer

Used internally by Shopify and Pinterest. Enterprise-grade CDN with automatic WebP and AVIF delivery. Best for high-traffic sites.

Start with Step 1: Convert JPG to WebP

Our free browser-based converter requires no upload, no registration, and handles multiple files at once. The fastest way to start compressing your images properly.

Best Image Compression Tools in 2026

ToolTypeBest forCost
Convertlo JPG→WebPBrowser-basedManual conversion, privacy-sensitive imagesFree
SquooshBrowser-basedQuality preview, format comparisonFree
ShortPixelWordPress plugin / APIWordPress sites, automated pipelineFree 100/mo; paid from $9.99/mo
ImagifyWordPress pluginWordPress + WP Rocket integrationFree 20MB/mo; paid from $4.99/mo
cwebp (CLI)Command-lineBatch conversion, scriptsFree (Google)
Sharp (Node.js)LibraryBuild pipelines, server-side processingFree (open source)
ImageMagickCommand-lineAny format, full metadata controlFree (open source)
CloudinaryCDN + APIAutomatic format/resize in URL paramsFree tier; paid from $89/mo

The Complete Image Optimisation Checklist

Apply these to every image before it goes live on your site:

  1. Choose the right format — WebP (or AVIF) for photos; lossless WebP or PNG for graphics; SVG for logos/icons
  2. Set the right quality — 80–85 for WebP/JPEG photos; lossless for screenshots and logos
  3. Resize to display dimensions — never serve a 2000px image in a 400px container
  4. Strip metadata — remove EXIF, ICC profiles, thumbnails
  5. Add explicit width and height — prevents layout shift (CLS)
  6. Add lazy loadingloading="lazy" on all below-the-fold images
  7. Preload the LCP image<link rel="preload" as="image"> in <head>
  8. Serve via CDN — for international visitors and cache efficiency
  9. Use responsive imagessrcset and sizes for multi-resolution delivery
  10. Serve with a JPEG fallback<picture> element for older browsers

Applying all ten to a typical blog produces a 60–80% reduction in image payload and brings most sites into the "Good" range for Core Web Vitals LCP on mobile.

Frequently Asked Questions

What is the best image compression technique for websites?
The highest-impact combination: (1) Switch to WebP — 25–35% smaller than JPEG at equivalent quality. (2) Use lossy compression at quality 80–85 for photographs. (3) Serve correctly sized images using srcset rather than scaling down in CSS. (4) Add loading="lazy" to below-the-fold images. Together, these typically cut image payload by 60–80% with no visible quality difference.
What is the difference between lossy and lossless image compression?
Lossy compression permanently removes data the human eye is unlikely to notice (fine texture, colour variation) to achieve 5–15% of original file size. JPEG and lossy WebP are lossy. Lossless compression finds patterns and stores them efficiently without discarding anything — the result is identical to the original. PNG and lossless WebP are lossless. Use lossy for photographs; lossless for screenshots, logos, and text-heavy images.
What quality setting should I use for JPEG compression?
For web delivery: quality 80–85 is the sweet spot. At quality 80, files are 60–70% smaller than quality 100 with no visible artefacts for photographic content. Quality 75–80 works for thumbnails. Below 70, blocky artefacts become visible. For archives and master files, use 92–95 or a lossless format. For WebP, equivalent visual quality is typically achieved at 3–5 points lower (WebP Q77 ≈ JPEG Q82).
Should I compress images before or after uploading to my website?
Ideally both. Pre-compress before upload: scale to correct dimensions and strip metadata. Post-upload: use a WordPress plugin (ShortPixel, Imagify) or CDN (Cloudinary, Cloudflare Images) to handle format conversion automatically. Pre-compressing ensures you never accidentally upload a 5 MB unoptimised photo. Post-compression tools handle the format conversion to WebP and serve the correct variant per browser automatically.
How much can image compression speed up a website?
Typically 30–60% faster page loads for image-heavy sites. A blog with 6 images totalling 2 MB of JPEG can be reduced to 800 KB–1.2 MB with WebP at quality 82. On a 10 Mbps mobile connection, that saves 500–960ms of download time — usually the difference between passing and failing Google's Core Web Vitals LCP threshold of 2.5 seconds.
Convertlo Editorial Team
The Convertlo team writes practical guides on image formats, file conversion, and web performance. All technical content is verified against current format specifications and tested in real browsers.
convertlo.pro