Skip to main content
Compression

Image Compression Guide 2026: Smaller JPG, PNG, WebP and AVIF Files

How image compression works, how JPG, PNG, WebP and AVIF compare, and which quality settings suit thumbnails, blog images, product photos and banners.

By ImgCompress.appUpdated 11 min read
Image compression guide showing JPG PNG WebP AVIF format comparison and file size reduction

Images account for roughly half of the total data transferred on the average web page. According to the HTTP Archive Web Almanac 2024, the median page weight for images on desktop sits around 1,000 KB, and on mobile it is not far behind. That is a significant chunk of bandwidth, and it directly affects how fast your site loads, how much data your visitors consume, and ultimately how well your pages rank in search results.

The good news is that most of that weight is optional. In our October 2026 benchmark, the default settings of our compressor shrank three camera photos by 90–99%, mostly because they cap the longest side at 1920 px; how much you save on your own images depends on their pixel size, the format and the quality setting. Whether you are optimizing product photos for an online store, preparing blog graphics, or trimming down a portfolio site, understanding how compression works — and which format to pick — gives you a real edge.

This guide walks through the fundamentals of image compression, compares the four major web formats side by side, and shows you exactly how to compress images using ImgCompress.app with real before-and-after data.

How Image Compression Works: Lossy vs Lossless

Every image compression algorithm falls into one of two categories: lossy or lossless. Knowing the difference helps you choose the right approach for each image.

Lossy Compression

Lossy compression permanently removes data that the human eye is unlikely to notice. The JPEG standard, defined in the ITU-T T.81 specification, is the most widely known example. The process works in three stages:

  1. Color space conversion — The image is converted from RGB to YCbCr, separating brightness (luminance) from color (chrominance). Human vision is more sensitive to brightness changes, so the color channels can be downsampled (a technique called chroma subsampling, typically 4:2:0) without obvious quality loss.

  2. Discrete Cosine Transform (DCT) — Each 8×8 pixel block is transformed from spatial data into frequency coefficients. High-frequency details (fine textures, subtle gradients) end up in coefficients that can be aggressively quantized.

  3. Quantization and entropy coding — A quantization matrix scales down the DCT coefficients, effectively discarding less important frequency data. The remaining values are then compressed with Huffman or arithmetic coding to produce the final bitstream.

The quality slider you see in most compression tools controls the quantization step. Lower quality means more aggressive quantization, smaller files, and eventually visible artifacts like banding or blockiness.

Lossless Compression

Lossless compression reduces file size without discarding any pixel data. PNG uses a combination of filtering (predicting each pixel from its neighbors) and DEFLATE compression (LZ77 + Huffman coding). The original image can be perfectly reconstructed from the compressed file.

On photographs, lossless compression saves far less than lossy compression, because every pixel has to survive. It is the right choice when pixel-perfect accuracy matters — think logos, UI screenshots, technical diagrams, or any image that will be edited again later.

① Lossy (JPG): after encoding and decoding, some pixels differ from the original (outlined). ② Lossless (PNG): the decoded pixels are exactly the original ones.

Format Comparison: JPG vs PNG vs WebP vs AVIF

Choosing the right format is just as important as choosing the right quality setting. Here is how the four major web image formats stack up:

FeatureJPEG (JPG)PNGWebPAVIF
Compression typeLossyLosslessLossy + LosslessLossy + Lossless
Typical compression ratio10:1 – 20:12:1 – 4:115:1 – 30:120:1 – 50:1
Transparency (alpha)NoYesYesYes
Animation supportNoNo (APNG yes)YesYes
Color depth8-bit8/16-bit8-bit8/10/12-bit, HDR
Browser support (2025)~100%~100%~97%~93%
Best forPhotosGraphics, logosGeneral web useMaximum compression
Encoding speedFastFastMediumSlow

Key takeaways from this table:

  • JPEG remains the universal safe choice for photographs. It is supported everywhere and encodes quickly, but it lacks transparency and cannot match the compression efficiency of newer formats.
  • PNG is unbeatable for images that require lossless quality or transparency, but its file sizes are significantly larger for photographic content.
  • WebP, developed by Google, offers both lossy and lossless modes with better compression than JPEG and PNG respectively. With roughly 97% global browser support according to Can I Use data, it is a practical default for most web projects today.
  • AVIF, based on the AV1 video codec developed by the Alliance for Open Media (AOM), delivers the best compression ratios of any current format. It supports HDR and wide color gamut. The trade-off is slower encoding and slightly lower browser support (~93%), though adoption is growing rapidly.

For a deeper look at JPEG-specific optimization, see our JPEG Compression Best Practices guide. If you are deciding between WebP and PNG for graphics, our WebP vs PNG comparison breaks down the decision in detail. And for everything about the newest format on the block, check out our AVIF Format Deep Dive.

Hands-On Tutorial: Compressing Images with ImgCompress

Let us put theory into practice. Below are the steps, followed by what our own benchmark measured.

Step-by-Step Compression Process

  1. Open our image compressor in your browser.
  2. Drag and drop your images onto the upload area, or click to browse files. You can add up to 10 images of up to 50 MB each per batch.
  3. Select your target format (JPG, PNG, WebP, or AVIF) and adjust the quality slider. The default 80% is a solid starting point for most photographs.
  4. Click compress and wait a few seconds. All processing happens locally in your browser — your images never leave your device.
  5. Preview the before-and-after comparison, then download the compressed files individually or as a ZIP archive.

What our benchmark measured

On 5 October 2026 we ran three CC0 camera photos through the compressor with its default settings (quality 80%, longest side capped at 1920 px, original format kept) in Chromium:

Test imageOriginalAfter default compressionReduction
Landscape (5184×3456)2.92 MB250 KB91.4%
Portrait (8256×5504)12.0 MB154 KB98.7%
Product shot (4080×3072)2.42 MB249 KB89.7%

What the numbers mean:

  • Most of the saving comes from the resize to 1920 px, not from the quality setting. If you turn on "keep resolution", expect much smaller reductions.
  • At the same 1920 px size, the open-source mozjpeg encoder at quality 80 produced files 26–40% smaller than our browser-based encoder. That is the honest weak spot of an in-browser tool.
  • At full resolution, AVIF at quality 50 came out 47–59% smaller than mozjpeg JPEG at quality 75, with similar SSIM scores, but it was also the slowest format to encode.

The full method, image sources and raw results are in our image compression tools comparison. The AVIF format guide covers AVIF in more detail.

What the default settings do to the landscape test photo, drawn to scale. ① The longest side is capped at 1920 px, so 5184 × 3456 becomes 1920 × 1280 and 86% of the pixels are gone before encoding starts. ② The image is encoded at quality 80. ③ The format stays the same. That is why most of the saving in our benchmark came from the resize.

Quality Settings Best Practices

The quality slider is the single most impactful control you have over the compression outcome. Setting it too high wastes bandwidth; setting it too low introduces visible artifacts. Here are our recommended ranges based on the image type and use case:

Use CaseFormatRecommended QualityNotes
Thumbnails and previewsJPEG or WebP60–70%Small display size hides artifacts
Blog and article imagesWebP75–82%Good balance of quality and speed
Hero and banner imagesWebP or AVIF80–88%Higher quality for large, prominent images
Product photographyJPEG or WebP82–90%Preserve detail for purchase decisions
Portfolio and fine artPNG (lossless) or AVIF (Q90+)90–100%Prioritize visual fidelity
Social media sharingJPEG80–85%Platforms re-compress anyway

Tips for Finding the Right Quality

  • Start at 80% and work down. For most photographs, quality 80 is visually indistinguishable from the original at web display sizes. Only drop lower if you need aggressive file size targets.
  • Use WebP as your default. Unless you need to support very old browsers, WebP usually gives you smaller files than JPEG at the quality levels used on the web (at very high settings, around 95 and up, it can come out larger). The Google WebP documentation confirms 25–34% smaller files compared to JPEG at equivalent visual quality.
  • Match quality to display size. A 200×200 thumbnail does not need quality 90. Conversely, a full-width hero image viewed on a 4K display benefits from higher quality settings.
  • Test on real devices. Compression artifacts that are invisible on a desktop monitor may be more noticeable on a high-DPI mobile screen, or vice versa. Always check your most important images on the devices your audience actually uses.
  • Avoid re-compressing lossy files. Each round of lossy compression introduces additional quality loss. Always compress from the highest-quality source file you have. If you need to convert between formats, our Image Format Conversion Guide covers how to minimize quality degradation.

Advanced Compression Strategies

Beyond basic quality settings, there are several techniques that can squeeze out additional savings:

Progressive JPEG

Progressive JPEG encodes the image in multiple passes, so the browser can display a low-resolution preview almost immediately and refine it as more data arrives. This improves perceived loading speed, especially on slower connections. Encoders such as mozjpeg write progressive JPEGs by default. ImgCompress.app uses your browser's built-in JPEG encoder, which writes baseline JPEGs, so use one of those encoders if you need progressive files.

Responsive Image Delivery

Rather than serving a single large image to every device, generate multiple sizes and let the browser pick the best one using the srcset attribute. A 400px-wide thumbnail on a mobile phone does not need a 4000px source file. Combining responsive images with compression usually cuts total image data far more than either step alone, because phones stop downloading pixels they never display.

Format Negotiation with the Picture Element

You can serve the most efficient format to each browser using the HTML <picture> element:

<picture>
  <source srcset="photo.avif" type="image/avif" />
  <source srcset="photo.webp" type="image/webp" />
  <img src="photo.jpg" alt="Description" />
</picture>

This approach delivers AVIF to browsers that support it, falls back to WebP, and uses JPEG as the universal safety net. Combined with proper compression at each format level, this is the gold standard for image delivery on the modern web.

Batch Processing

If you are working with more than a handful of images, compressing them one at a time is tedious. ImgCompress.app supports batch processing: add up to 10 images per batch (up to 50 on the bulk compressor), apply uniform settings, and download everything as one ZIP. For large-scale workflows, check out our Batch Image Compression Guide.

Conclusion

Image compression is not a nice-to-have — it is a fundamental part of building fast, efficient websites. The HTTP Archive data makes it clear: images dominate page weight, and unoptimized images are the single biggest performance bottleneck on most sites.

The core principles are straightforward:

  • Understand the difference between lossy and lossless compression and pick the right approach for each image.
  • Choose your format deliberately. WebP is the practical default for most web images in 2025. AVIF offers the best compression ratios for teams ready to adopt it. JPEG and PNG remain essential for universal compatibility and lossless needs respectively.
  • Use quality settings intentionally. Start at 80% for photographs and adjust based on the specific use case and display context.
  • Compress from the highest-quality source and avoid re-compressing lossy files.

Ready to optimize your images? Try our free image compressor — it runs entirely in your browser, supports JPG, PNG, WebP, and AVIF, and shows the before and after size of every file so you can judge the result yourself.

Related reading:

  • image compression
  • JPG compression
  • PNG compression
  • WebP
  • AVIF
  • file size reduction
  • web optimization