FUNDAMENTALS · EXPLAINER

What Is Image Compression?
How It Works, Types & When to Use Each

By ImgMin Team · May 5, 2026 · 7 min read

NEWImgMin for Chrome — right-click any image to compress, no upload.Add to Chrome →

Every image you see online has been compressed. Whether it's a product photo on Amazon, a meme on Reddit, or a banner on a corporate website — the image you see is almost always smaller than the original captured or created. Understanding how image compression works helps you make smarter decisions about quality, file size, and format choices.

In plain terms: Image compression reduces the file size of an image by encoding the pixel data more efficiently — either by removing less-important information (lossy) or by finding smarter ways to represent the same information (lossless).

Why Images Need Compression

A raw, uncompressed photograph is surprisingly large. A 12-megapixel photo (4032×3024 pixels) at 24-bit color depth requires:

4032 × 3024 × 3 bytes ≈ 36.6 MB

That's for a single photo. Compress it to JPEG at 85% quality, and it drops to roughly 3–5 MB. Compress to JPEG at 75% quality and you're at 1–2 MB — with no visible difference at normal screen sizes. For websites serving thousands of images, the bandwidth and storage savings are enormous.

The Two Types of Image Compression

⚡ Lossy Compression

Permanently removes some image data to achieve smaller files. The decompressed image is different from the original — but often indistinguishable to human eyes. Used by JPEG, lossy WebP, AVIF, and HEIC.

🔒 Lossless Compression

Reduces file size without discarding any data. The decompressed image is bit-for-bit identical to the original. Used by PNG, lossless WebP, GIF, and RAW formats. File sizes are larger than lossy.

Analogy: Lossy vs Lossless

Lossy is like summarizing a book — you capture the key ideas but lose some specific details. Most readers don't notice what's missing.

Lossless is like a word-for-word transcript — everything is preserved exactly. It takes more space, but nothing is lost.

How JPEG Compression Works (Lossy)

JPEG is the most widely used image format, and its compression algorithm is a masterpiece of applied mathematics:

  1. Color space conversion: The image is converted from RGB to a format (YCbCr) that separates brightness from color information. Human eyes are more sensitive to brightness than color, so color data is downsampled first.
  2. Block division: The image is divided into 8×8 pixel blocks.
  3. Discrete Cosine Transform (DCT): Each block is converted from pixel values into a frequency representation — essentially describing "how much of each pattern" is in the block.
  4. Quantization: High-frequency details (fine textures, sharp edges) are rounded off — this is where quality is actually "lost." Lower quality settings = more rounding = more loss = smaller file.
  5. Entropy coding: The quantized values are further compressed using a lossless method (Huffman coding), eliminating redundancy.

At 80% JPEG quality, the quantization is gentle enough that most humans can't detect the difference from the original at normal screen viewing distances.

How PNG Compression Works (Lossless)

PNG uses two stages of lossless compression:

  1. Filtering: Each row of pixels is encoded as the difference from the previous row (or in other ways) to reduce the range of values that need to be stored.
  2. DEFLATE compression: The filtered data is compressed using a combination of LZ77 and Huffman coding — the same algorithm used in ZIP files.

Because PNG compression is lossless, it works best on images with large areas of identical color — like logos, screenshots, and illustrations. For photographs (which have random-seeming pixel variation), PNG produces much larger files than JPEG.

How WebP Compression Works

WebP supports both lossy and lossless modes:

The Quality-Size Tradeoff

JPEG QualityFile Size (1MP photo)Visual QualityTypical Use Case
100%~2–4 MBNear-perfectProfessional archival
90%~800 KB–1.5 MBExcellentPrint-quality web images
85%~500–900 KBVery goodHigh-quality web photos
80%~300–600 KBGood (imperceptible)Standard web images
75%~200–400 KBGood (subtle artifacts)Email, thumbnails
60%~100–200 KBAcceptable (visible)Heavily trafficked pages
40%~60–120 KBPoor (blocky)Avoid for most uses
Sweet spot: For most web images, JPEG at 75–85% quality offers the best balance — you get 60–80% file size reduction with no perceptible quality loss at normal screen sizes. This is the range ImgMin optimizes for by default.

Lossy vs Lossless: Which to Use?

ScenarioRecommendedReason
Photos for websitesJPEG / Lossy WebP60–80% smaller, imperceptible quality loss
Logos & iconsPNG / SVGPixel-perfect edges; transparency support
Screenshots with textPNGText remains sharp; JPEG creates blurry text
Product images (e-commerce)JPEG 85–90%Quality matters; slightly larger files acceptable
Background texturesJPEG / Lossy WebPLossy artifacts rarely visible in backgrounds
Medical/legal imagesPNG / LosslessNo data loss; original preserved exactly
Social media posts (pre-upload)JPEG 95%+Platforms re-compress; start with highest quality

Metadata and Compression

Images contain more than just pixel data. EXIF metadata stores camera model, GPS coordinates, shooting settings, copyright information, and more. This data can add 50–200 KB to file sizes.

Stripping EXIF metadata is often called "metadata removal" or "exif stripping" and can reduce file size by 5–15% with zero impact on image quality. Most compression tools (including ImgMin) strip EXIF automatically. If you need to preserve metadata for archival or professional work, choose a tool that gives you the option to keep it.

Browser-Based vs Server-Based Compression

Image compression can happen in two places:

Frequently Asked Questions

What is image compression?

Image compression reduces the file size of an image by encoding its data more efficiently — either by removing less-important information (lossy) or finding smarter ways to store the same information (lossless). The result is a smaller file that loads faster and takes less storage.

What is the difference between lossy and lossless image compression?

Lossy permanently removes some image data — the result is slightly different from the original, though often imperceptible at normal viewing sizes. JPEG uses lossy compression. Lossless removes no data — the decompressed image is bit-for-bit identical to the original. PNG uses lossless compression.

Does image compression reduce quality?

Lossy compression (JPEG, WebP lossy) does reduce quality, but at 75–85% quality the difference is imperceptible at normal viewing sizes. Lossless compression (PNG, lossless WebP) never reduces quality. For most web and sharing purposes, JPEG at 80% offers the best balance.

Try Image Compression — Free & Private

Compress JPEG and PNG files instantly in your browser. No upload, no account, no limits.

Compress Images Now →

Last updated: May 2026. File size estimates are representative of typical photographic content.