What Is Image Compression? A Simple Explanation
Understand how image compression works, the difference between lossy and lossless compression, and how to choose the right settings for your needs.
What Is Image Compression? A Simple Explanation
Every digital image is made up of pixels, and every pixel stores color information. A 12-megapixel photo from your phone contains 12 million pixels, each described by red, green, and blue values. Without compression, that single photo would take up around 36 MB of storage.
Image compression reduces that file size by encoding the pixel data more efficiently. Some methods preserve every detail. Others discard information the human eye is unlikely to notice. Understanding the difference helps you make better decisions about quality, file size, and which format to use.
Two Types of Compression
All image compression falls into one of two categories: lossless and lossy.
Lossless Compression
Lossless compression reduces file size without discarding any image data. When you decompress the file, you get back the exact original, pixel for pixel.
Think of it like packing a suitcase more efficiently. You're not leaving anything behind. You're just folding things better so they take up less space.
How it works: Lossless algorithms find patterns and redundancies in the data. If a row of 200 pixels are all the same shade of blue, instead of storing "blue, blue, blue..." 200 times, the algorithm stores "blue x 200." This is a simplification, but it captures the core idea.
Real-world savings: Lossless compression typically reduces file size by 20-50%, depending on the image content. Images with large areas of uniform color (like screenshots, diagrams, or illustrations) compress very well. Photos with complex textures and gradients compress less.
Formats that use lossless compression:
- PNG is the most common lossless format for everyday use.
- WebP supports a lossless mode as well.
- TIFF is used in professional photography and publishing.
- GIF uses lossless compression but is limited to 256 colors.
Lossy Compression
Lossy compression achieves much smaller file sizes by permanently removing some image data. The removed information is chosen carefully so that the visual impact is minimal, at least at reasonable compression levels.
Think of it like summarizing a book. You lose some of the exact wording, but the main content comes through clearly.
How it works: Lossy algorithms analyze the image and identify details that human vision is less sensitive to. We notice changes in brightness more than changes in color. We notice sharp edges more than subtle gradients. The algorithm exploits these perceptual traits, discarding data in areas where the loss is hardest to detect.
Real-world savings: Lossy compression can reduce file size by 80-95% while maintaining good visual quality. A 10 MB raw photo can become a 500 KB JPG that looks nearly identical on screen.
Formats that use lossy compression:
- JPG (JPEG) is the standard lossy format and the most widely supported.
- WebP supports a lossy mode that typically beats JPG on file size.
Quality Settings: Finding the Sweet Spot
Most image tools let you choose a quality level, usually expressed as a percentage from 1 to 100. This number controls how aggressively the lossy algorithm compresses the image.
Here's what different quality levels actually mean in practice:
95-100%: Almost no visible compression. File sizes are significantly larger than at lower settings. Useful for archival purposes or when the image will be edited and re-saved later.
85-92%: The sweet spot for most purposes. Files are 60-80% smaller than the original, and the quality difference is essentially invisible in normal viewing conditions. This range works great for website images, social media posts, and documents.
70-84%: Compression becomes noticeable if you zoom in and compare side by side with the original. Fine for thumbnails, previews, and situations where file size is more important than perfect quality.
50-69%: Clearly visible artifacts, especially around text and sharp edges. Acceptable for very small thumbnails or low-bandwidth situations.
Below 50%: Severe quality loss. Only useful when extreme file size reduction is absolutely necessary.
How Each Format Handles Compression
Understanding how formats apply compression helps you pick the right one.
JPG applies lossy compression only. Every time you save a JPG, some quality is lost. Saving, editing, and re-saving repeatedly degrades the image over time, a process sometimes called "generation loss." For files you plan to edit multiple times, work in a lossless format and export to JPG only at the end.
PNG applies lossless compression only. The quality slider in PNG tools doesn't affect visual quality. Instead, it controls how much time the algorithm spends looking for compression patterns. Higher effort means smaller files, but the image looks identical either way.
WebP supports both lossy and lossless modes. In lossy mode, it typically produces files 25-35% smaller than JPG at the same visual quality. In lossless mode, it beats PNG by about 20-25% on file size. This flexibility makes it the most versatile format for web use.
Practical Examples
Here's how compression plays out with real numbers on a typical 1920x1080 photo:
| Format & Setting | File Size | Quality |
|---|---|---|
| Uncompressed BMP | ~6 MB | Perfect |
| PNG (lossless) | ~3 MB | Perfect |
| JPG at 95% | ~800 KB | Excellent |
| JPG at 85% | ~400 KB | Very good |
| JPG at 70% | ~200 KB | Good |
| WebP at 85% | ~300 KB | Very good |
| WebP lossless | ~2.2 MB | Perfect |
The jump from uncompressed to JPG at 85% is dramatic: a 93% reduction in file size with minimal visual impact.
When to Use Which Type
Use lossless compression when:
- The image contains text, screenshots, or sharp graphics.
- You need to preserve every detail (medical imaging, technical diagrams).
- You'll edit and re-save the file multiple times.
- Transparency is required.
Use lossy compression when:
- The image is a photograph.
- You're preparing images for the web, email, or social media.
- File size needs to be as small as possible.
- The image will be viewed at a fixed size (not zoomed in closely).
Try It Yourself
The best way to understand image compression is to experiment. Our image compression tool lets you adjust quality settings and see the resulting file size in real time. All processing runs locally in your browser, so your images stay private and you can test as many files as you want without limits.