Skip to content
Back to Blog
Guides

Lossless vs Lossy Image Compression: What's the Difference?

Brandon Sorensen·May 23, 20268 min read

The Core Distinction

Every time you save an image, something has to decide how to store those pixels on disk. There are two fundamentally different strategies: keep every pixel exactly as it was (lossless), or discard some data to make the file smaller (lossy). The difference matters for everything from photo editing to web performance to archiving family photos.

This guide explains how each approach works, which image formats use which, and when one is the right choice over the other.

What Is Lossy Compression?

Lossy compression permanently discards some image data to achieve smaller file sizes. The discarded data cannot be recovered — once you save a file in a lossy format, the removed information is gone.

The key insight behind lossy compression is that human vision has limits. We are more sensitive to variations in brightness than to variations in color. We notice large smooth areas more than fine textures. Lossy compression algorithms exploit these perceptual limits to throw away image data that most people will not notice is missing.

JPEG is the most widely used lossy format. It uses an algorithm based on the discrete cosine transform (DCT), defined in ISO/IEC 10918-1. JPEG divides the image into 8×8 pixel blocks and transforms each block into frequency components. High-frequency components — fine details and sharp edges — are discarded more aggressively than low-frequency ones. The result is a compact file where only the perceptually important structure remains.

Most JPEG encoders expose a "quality" setting, typically from 0 to 100. At quality 95, the image looks essentially identical to the original. At quality 50, compression artifacts become visible as blockiness around edges and color banding in smooth gradients. The default quality setting in most software is around 75–85.

WebP lossy mode uses the VP8 video codec for its compression, as documented in Google's WebP compression specification. VP8 applies a more sophisticated transform than JPEG — it uses 4×4 and 16×16 block prediction modes, which means it understands context between blocks and can produce smoother results at the same file size.

AVIF lossy uses the AV1 video codec, developed by the Alliance for Open Media. AV1 is a more advanced codec than VP8, with larger transform sizes and more sophisticated intra-frame prediction, which is why AVIF typically achieves better compression than WebP or JPEG at equivalent visual quality.

What Is Lossless Compression?

Lossless compression reduces file size without discarding any pixel data. The original image can be perfectly reconstructed from the compressed file — every pixel value is preserved exactly.

Lossless algorithms work by finding and eliminating redundancy in the data. An image where a large area is all the same color can be stored far more compactly than its raw pixel array. Adjacent pixels in a photograph are often very similar to each other; predictive coding can record just the differences rather than full values.

PNG is the dominant lossless format for the web. It uses DEFLATE compression (the same algorithm as ZIP files) combined with PNG-specific filtering defined in the W3C PNG specification. Before compression, PNG applies a filter pass to each row of pixels that transforms the data into a form that compresses more efficiently — for example, the "Sub" filter stores each pixel's difference from the one to its left rather than its absolute value.

Because PNG is lossless, re-saving a PNG file multiple times produces identical output each time. There is no generational quality loss.

GIF uses LZW (Lempel-Ziv-Welch) compression, which is lossless — but GIF has a hard limit of 256 colors per frame. Photographs contain far more than 256 distinct colors, so GIF must reduce (quantize) the color palette before encoding. This quantization step is irreversible and produces visible color banding and dithering artifacts. GIF is effectively a lossless format applied to a lossy color representation.

BMP files can be stored uncompressed (raw pixel data) or with lossless RLE (run-length encoding) compression. Both preserve exact pixel values.

TIFF supports multiple compression schemes, including lossless options (LZW, ZIP/Deflate, PackBits) and a JPEG-based lossy mode. When you save a TIFF with LZW or ZIP compression, the file is lossless. TIFF is commonly used in professional photography and printing workflows for exactly this reason.

Which Formats Are Lossy, Lossless, or Both?

FormatCompression Type
JPEGLossy only
PNGLossless only
GIFLossless LZW (but 256-color limit)
BMPUncompressed or lossless RLE
TIFFLossless (LZW, ZIP) or lossy (JPEG)
WebPBoth lossy and lossless modes
AVIFBoth lossy and lossless modes

WebP and AVIF are particularly flexible: you can choose whether to use lossy or lossless compression on a file-by-file basis. A WebP file saved with lossless mode behaves like PNG — every pixel is preserved. The same file saved with lossy mode behaves like a high-quality JPEG, with smaller size but some data discarded.

When Lossless Is the Right Choice

Editing workflows — If you are still working on an image and plan to make more adjustments, save in a lossless format. Every time you re-encode a lossy file, you compound the loss. Editing a JPEG, saving it, editing it again, and saving again means the image has been degraded twice. Use PNG or TIFF as your working format; only convert to JPEG when the image is finished.

Screenshots and interface images — Screenshots contain text, solid-color buttons, and sharp edges. Lossy compression handles these poorly: JPEG adds visible artifacts around high-contrast edges, making text look blurry or fringe-colored. PNG is the right format for screenshots, UI mockups, and interface assets.

Line art, logos, and diagrams — Images with large areas of flat color and sharp edges compress well with PNG's DEFLATE and look terrible with JPEG compression. If you have a logo or diagram that needs to look crisp at any resolution, use PNG.

Archiving original photos — If you are storing the canonical copy of a photograph — the master you will derive everything else from — use a lossless format. TIFF with LZW compression is common in professional workflows. PNG works too and produces smaller files than uncompressed TIFF.

Transparency with sharp edges — PNG supports fully transparent pixels, making it the right choice for images that need to composite over different backgrounds, like icons or product shots with no background.

When Lossy Is the Right Choice

Photographs for web delivery — Photographs have enormous amounts of color and tonal variation. A lossless PNG of a full-resolution photo can be several megabytes. The same photo as a JPEG at quality 85 is typically a tenth of the size, with no visible difference to the human eye. For web pages where load time matters, lossy compression is almost always the right choice for photographic content.

Reducing storage for large collections — If you need to store thousands of photos and storage space is a constraint, JPEG or lossy WebP are practical. The savings are real and the quality loss at good quality settings is imperceptible for viewing purposes.

Social media and messaging — Platforms like Instagram, Twitter, and WhatsApp re-compress your uploaded images on their servers anyway. Uploading an uncompressed PNG does not preserve quality — the platform will apply its own lossy compression. It is not worth the larger upload size.

Any photo you will only view, not edit — For photos you are sharing or publishing as final outputs, lossy formats at high quality settings are indistinguishable from the originals for practical viewing purposes.

The Quality Trade-Off

The central trade-off in lossy compression is always quality versus file size. At the highest quality settings, lossy formats like JPEG and WebP are genuinely difficult to distinguish from lossless copies. As you increase compression (lower quality settings), the differences become visible — first as subtle color shifts, then as obvious blockiness and banding.

For web images, the practical recommendation is to find the lowest quality setting that looks acceptable at the largest size the image will be displayed. This is usually 80–90 for JPEG. Modern formats like WebP and AVIF achieve comparable visual quality at lower bitrates than JPEG, which is why they are the preferred choice for new web images.

For archiving or editing, treat quality loss as permanent and irreversible, and choose lossless formats for anything you might want to re-edit later.

Re-encoding Lossy to Lossless and Back

An important point: converting a lossy file to a lossless format does not recover the lost data. If you convert a JPEG to PNG, you get a lossless copy of the already-degraded JPEG data. The PNG is larger than the JPEG but it does not look better — it looks identical, because there is no more original data to recover. The compression artifacts that JPEG introduced are now permanently baked into the pixel values that PNG stores losslessly.

This has a practical implication: if you are going to archive a photo, archive the highest-quality version you have. Converting a heavily compressed JPEG to TIFF does not improve quality; it only wastes disk space.

Converting lossless to lossy (PNG to JPEG, PNG to WebP) does introduce quality loss — the lossy encoder discards information from the lossless source. This is a one-way degradation.

Converting between two lossy formats (JPEG to WebP, for example) compounds the loss from both encodings. Where possible, start from the lossless original when producing a lossy output.

Converting Images on PhotoFormatLab

PhotoFormatLab handles all these conversions directly in your browser, with no file uploads. Your images are processed locally and never sent to a server — which matters if you are converting private or sensitive photos.

For switching to lossless:

  • JPG to PNG — move from lossy JPEG to lossless PNG for editing or archiving
  • WebP to PNG — convert a lossy or lossless WebP to PNG
  • For switching to lossy:

  • PNG to JPG — convert a lossless PNG to a compact JPEG for web delivery
  • PNG to WebP — modern lossy (or lossless) format with better compression than JPEG
  • PNG to AVIF — best compression available; lossy AVIF from a lossless source
  • JPG to WebP — switch from JPEG to WebP for smaller web images
  • JPG to AVIF — convert JPEG to AVIF for maximum compression
  • For more on choosing between formats, see AVIF vs WebP vs JPEG and PNG vs JPG: when to use each. If you need practical guidance on reducing image file sizes, read how to compress images without losing quality.

    Frequently Asked Questions

    Is PNG always better than JPEG?

    Not always — it depends on the content. PNG is better for screenshots, logos, line art, and anything you plan to edit further, because it is lossless. JPEG is better for photographs destined for web delivery, because it produces much smaller files with no perceptible quality difference at good quality settings. See PNG vs JPG: when to use each for a full breakdown.

    Does converting JPEG to PNG improve quality?

    No. Converting a JPEG to PNG creates a lossless copy of whatever data the JPEG preserved, including any compression artifacts. The PNG does not restore information that JPEG discarded — that information is permanently gone. You get a larger file that looks identical to the JPEG.

    What is the best lossless format for the web?

    PNG is the standard for web use. WebP in lossless mode is typically smaller than PNG for equivalent content, but PNG has universal browser support while WebP lossless has 97%+ support. For most web images, lossy WebP or AVIF is the better choice over lossless PNG because photographs do not benefit from lossless compression in most web contexts.

    Can I tell by looking at a file whether it is lossy or lossless?

    Only from the file extension or file metadata — not from the image appearance at high quality. A JPEG saved at quality 95 is lossy but looks identical to the PNG original. You need to know the format to know the compression type, not the visual output.

    Why does saving a JPEG multiple times degrade it?

    Each time you re-encode a JPEG, the encoder discards more data. The first save from an uncompressed source produces one round of quality loss. Opening that JPEG and saving it again applies a second round of lossy compression to already-compressed data, adding new artifacts on top of existing ones. This compounding degradation is called generation loss. To avoid it, keep a lossless master and only produce JPEG as the final output step.

    What format should I use for photos I want to archive permanently?

    TIFF with LZW compression is the traditional archival format in professional photography, supported by most photo applications including Adobe Photoshop and Lightroom. PNG is a practical alternative for personal archives — it is universally readable, lossless, and produces smaller files than uncompressed TIFF. Either format preserves exact pixel values indefinitely.

    J
    Brandon Sorensen·Founder, PhotoFormatLab

    Brandon operates an independent network of privacy-focused web tools and resource sites. He built PhotoFormatLab to make image conversion free, instant, and fully browser-based — no file uploads, no accounts, no watermarks. Routine drafting on this site is AI-assisted; technical claims are verified against official format specs and browser documentation before publication. About PhotoFormatLab →

    Ad
    Ad