The Core Trade-Off of Digital Media
Every digital file you share faces the same fundamental tension: quality versus size. A raw photograph from a modern camera can exceed 50 megabytes. A single minute of uncompressed video is over 1 gigabyte. Without compression, the internet as we know it would not function—pages would take minutes to load, and streaming would be impossible.
Compression solves this problem by making files smaller. There are two approaches: lossless compression, which preserves every bit of the original data, and lossy compression, which permanently discards data to achieve much greater size reductions.
| Attribute | Lossless Compression | Lossy Compression |
|---|---|---|
| Data Integrity | Preserves 100% of original data | Permanently removes some data |
| Typical Size Reduction | 5% to 20% | 50% to 90% |
| Reversibility | Fully reversible | Irreversible—data is gone forever |
| Example Formats | PNG (lossless mode), FLAC, ZIP | JPG, WebP, AVIF, HEIC |
Lossy compression became the foundation of modern media because the trade-off is so favorable. By discarding data that humans cannot easily perceive, it delivers files that are 5 to 10 times smaller with quality that looks nearly identical to the original.
Lossy compression asks: what can we throw away that you will never miss? The answer, it turns out, is quite a lot. Human perception has predictable blind spots, and modern algorithms are very good at exploiting them.
For a detailed comparison of both compression types, including when to use each, see our guide on lossless compression and lossy compression.
How Lossy Compression Actually Works
Lossy compression is not random data deletion. It is a sophisticated process that analyzes the content of a file and strategically removes information that humans are unlikely to notice. This process relies on decades of research into human perception—how our eyes process images.
Transform Coding: Breaking Files into Pieces
Most lossy compression begins with transform coding. Instead of working with raw pixel values or audio samples, the algorithm transforms the data into a different representation that separates important information from less important information.
For images, the most common transform is the Discrete Cosine Transform (DCT). This mathematical operation converts an 8x8 block of pixels into a set of frequency components. Low-frequency components represent gradual changes (smooth gradients, large color areas). High-frequency components represent rapid changes (fine details, sharp edges, noise).
Why frequency matters
Human vision is more sensitive to low-frequency information (overall brightness, large shapes) than high-frequency information (fine texture, subtle details). By converting image data to frequencies, compression algorithms can easily identify which parts of the image contribute most to what we actually see—and which parts can be discarded.
Quantization: Where Data Is Actually Lost
After the transform, quantization performs the actual data reduction. This step rounds frequency values to fewer precision levels—effectively throwing away subtle differences. High-frequency components (fine details) are quantized more aggressively than low-frequency components (overall structure).
The quality setting in a JPG compressor controls how aggressive this quantization is. A quality of 100 preserves more frequency detail. A quality of 50 discards more, resulting in a smaller file but potentially visible artifacts.
Perceptual Modeling: Working With Human Vision
Modern codecs go beyond simple frequency analysis. They incorporate perceptual models that understand how humans actually see.
- Chroma Subsampling — Human eyes are more sensitive to changes in brightness than changes in color. Lossy image formats reduce color information (chroma) while preserving brightness (luma) in full detail. A typical JPG stores half or quarter resolution color data—you never notice because your visual system fills in the gaps.
- Visual Masking — Bright areas mask subtle details. High-contrast edges make nearby artifacts less visible. Perceptual codecs exploit these masking effects to hide compression artifacts in parts of the image where you would not notice them anyway.
The genius of lossy compression is not just mathematics—it is psychology. By understanding the limits and biases of human perception, algorithms can discard vast amounts of data while preserving what actually matters to the viewer.
Common Lossy Image Formats
Lossy compression powers the image formats you encounter most often on the web. Understanding these formats helps you choose the right one for your needs.
- JPG (JPEG) — The original web image format, introduced in 1992. Uses DCT-based compression with adjustable quality. Ideal for photographs but struggles with sharp edges and text. Files use the .jpg or .jpeg extension.
- WebP — Google's modern format that supports both lossy and lossless compression. Typically 25-35% smaller than equivalent JPGs with the same visual quality. Supports transparency (alpha channel), making it versatile for web use.
- AVIF — The newest major image format, based on the AV1 video codec. Achieves up to 50% smaller files than JPG at the same quality. Excellent for high-quality web images but slower to encode. Browser support is now widespread.
- HEIC/HEIF — Apple's preferred format for iPhone photos. Uses the same compression technology as HEVC video. Produces smaller files than JPG but has limited web browser support, requiring conversion for many use cases.
Choosing the right format
Use WebP for most web content—it has excellent browser support and efficiency. Use AVIF when you need maximum compression and can accept slower encoding. Use JPG when you need maximum compatibility with older software.
What Happens When You Compress Too Much
Lossy compression has limits. Push it too far, and the quality loss becomes visible or audible. Understanding compression artifacts helps you find the right balance between file size and quality.
Common Image Compression Artifacts
- Blocking (DCT Artifacts) — The most recognizable JPG artifact. Appears as visible 8x8 pixel squares, especially in smooth gradients like skies or skin tones. Caused by overly aggressive quantization of DCT coefficients.
- Ringing (Gibbs Phenomenon) — Halos or "echoes" that appear around sharp edges and high-contrast boundaries. Common around text, logos, or any sharp transition between light and dark areas.
- Color Banding — Smooth gradients break into visible steps of distinct colors instead of smooth transitions. Caused by reducing color precision too aggressively.
- Mosquito Noise — A shimmering or "buzzing" effect around edges in video. Named because it looks like mosquitoes hovering around objects. Particularly noticeable in areas with fine detail or motion.
Generation Loss: The Compounding Problem
One of the most important concepts to understand about lossy compression is generation loss. Each time you open, edit, and re-save a lossy file, the compression algorithm runs again, discarding more data. After several generations, the accumulated losses become severe.
This is why professionals maintain master files in lossless formats. You edit the master, then export to lossy formats only as the final step. Never edit the exported lossy file—always go back to the master.
How to avoid generation loss
Keep your original files in a lossless format (PNG, TIFF, or your camera's RAW). Perform all edits on the lossless original. Only export to JPG or WebP as the final step when you need a smaller file for web use or sharing. If you need to make changes later, go back to the lossless original—never re-edit the lossy export.
Measuring Quality: SSIM and PSNR
How do you objectively measure how much quality was lost? Two metrics are commonly used:
- PSNR (Peak Signal-to-Noise Ratio) — Measures the mathematical difference between the original and compressed image in decibels. Higher is better. A PSNR of 40 dB is generally considered excellent quality, while below 30 dB shows visible degradation.
- SSIM (Structural Similarity Index) — A perceptual metric that considers how humans actually perceive differences. Values range from 0 to 1, with 1 being identical. SSIM above 0.95 is typically considered visually lossless to most viewers.
These metrics help compression tools and researchers evaluate codec performance objectively, rather than relying solely on subjective "does it look good?" assessments.
When to Use Lossy vs Lossless Compression
The choice between lossy and lossless compression depends on your priorities: do you need maximum quality retention, or is smaller file size more important?
Use Lossy Compression When:
- Publishing to the Web — Website performance depends on fast-loading images. A lossy JPG or WebP at quality 80-85 looks nearly identical to the original but loads much faster.
- Sharing via Email or Messaging — File size limits and slow connections make lossy compression practical. A 500 KB image sends faster and displays well on mobile screens.
- Social Media Uploads — Platforms like Instagram, Facebook, and Twitter re-compress uploaded images anyway. Uploading already-optimized lossy files gives you more control over the final quality.
- Streaming Media — Video and audio streaming would be impossible without lossy compression. Even "high quality" streams use lossy codecs—the files would otherwise be too large to transmit in real time.
Use Lossless Compression When:
- Archiving Original Files — Your camera's RAW files or master edits should never be saved as lossy. Keep the original quality for future use.
- Graphics with Sharp Edges — Logos, icons, screenshots, and text render poorly with JPG compression. Use lossless PNG to keep edges crisp.
- Medical or Scientific Imaging — Diagnostic accuracy depends on every pixel. Lossy compression is unacceptable for medical images, satellite imagery, or scientific data.
- Source Files for Further Editing — If you will edit the file again, keep it lossless to avoid generation loss.
| Scenario | Recommended Method | Why |
|---|---|---|
| Website hero image | Lossy (WebP/AVIF) | Page speed matters more than pixel-perfect quality |
| Company logo | Lossless (PNG/SVG) | Sharp edges must remain crisp |
| Photo archive | Lossless (original RAW/TIFF) | Preserve full quality for future use |
| Email attachment | Lossy (JPG quality 80-85) | Smaller files avoid size limits |
| Screenshot with text | Lossless (PNG) | Text clarity requires lossless |
The practical rule: use lossy compression for delivery (web, email, social media) and lossless compression for storage (archives, masters, source files). This gives you small files where size matters and full quality where permanence matters.
All processing on Compress.FAST happens on encrypted EU-based servers. Files are protected with TLS 1.3 during transfer and AES-256 at rest. We permanently delete all files within one hour. For details, see our encryption and privacy documentation.
Frequently Asked Questions
Here are direct answers to common questions about lossy compression.
Does lossy compression change my image's resolution?
No. Lossy compression does not change the dimensions (width and height) of your image. A 1920x1080 image remains 1920x1080 after compression.
What changes is the data within each pixel. The compression algorithm simplifies color information and removes fine details to reduce file size. The image has the same number of pixels, but each pixel may contain slightly less precise information than the original.
Can I undo lossy compression?
No. Lossy compression permanently removes data—it cannot be recovered. This is the fundamental trade-off: you get much smaller files, but the original information is gone.
You can save a JPG as a PNG, but this only puts the already-compressed image into a different container. It does not restore the lost quality. This is why professionals always keep lossless master files and only export to lossy formats as the final step.
What is a good quality setting for a JPG?
For most web use, quality 75-85 provides an excellent balance of file size and visual quality. Most viewers cannot distinguish between quality 85 and quality 100, but the file size difference can be 50% or more.
For high-quality prints or professional delivery, use quality 90-95. Going above 95 rarely produces visible improvement but significantly increases file size.
Below quality 70, compression artifacts (blocking, color banding) become increasingly visible. Use lower settings only when extreme file size reduction is more important than quality.
Is PNG lossy or lossless?
PNG is natively a lossless format. When you save an image as PNG, every pixel is preserved exactly. This makes PNG ideal for graphics, logos, screenshots, and any image where you need perfect accuracy.
However, tools like Compress.FAST and TinyPNG can apply lossy techniques to PNG files by reducing the color palette. This achieves much greater compression (50-80%) while keeping the PNG format. Our PNG compressor lets you choose between lossless mode (pixel-perfect) and lossy mode (smaller files).
Compress.FAST uses MozJPEG to deliver JPG files up to 30% smaller than standard encoders at the same visual quality. Process files on encrypted EU servers with automatic deletion—fast, simple, and secure.

Stewart Celani
Founder
15+ years in enterprise infrastructure and web development. Stewart built Tools.FAST after repeatedly hitting the same problem at work: bulk file processing felt either slow, unreliable, or unsafe. Compress.FAST is the tool he wished existed—now available for anyone who needs to get through real workloads, quickly and safely.
Read more about Stewart