Technical Deep Dive
Why Is WebP So Much Smaller Than PNG?
Updated: March 2026
If you have ever converted a PNG image to WebP, you have probably been surprised by the dramatic file size reduction. A 2.5 MB PNG photograph can shrink to 400 KB in WebP lossy mode, or around 1.8 MB in WebP lossless mode, all without a visible difference in quality. This is not magic but rather the result of fundamentally different compression algorithms. While both formats can produce identical visual output in lossless mode, WebP uses more advanced compression techniques developed decades after PNG's algorithm was designed. This article breaks down the technical reasons behind WebP's size advantage in a way that is accessible even if you are not a computer scientist.
How PNG Compression Works: DEFLATE
PNG uses a compression algorithm called DEFLATE, which is the same algorithm used in ZIP files and gzip. DEFLATE was developed in the early 1990s and works in two stages. First, it applies a prediction filter to each row of pixels. PNG offers five simple filters (None, Sub, Up, Average, and Paeth) that predict each pixel's value based on its immediate neighbors. The filter calculates the difference between the predicted value and the actual value, which ideally results in many small numbers and zeros that are easier to compress.
After filtering, DEFLATE combines LZ77 pattern matching with Huffman coding. LZ77 finds repeated sequences of bytes and replaces them with short references pointing back to the first occurrence. Huffman coding then assigns shorter binary codes to more frequent values. This two-step approach works well, but it is limited by the simplicity of its prediction model and the fact that it processes data as a one-dimensional stream, unable to take full advantage of the two-dimensional patterns that naturally occur in images.
How WebP Lossy Compression Works: VP8
WebP lossy mode is based on the VP8 video codec, which Google acquired when it purchased On2 Technologies in 2010. VP8 was designed for video, where compression efficiency is critical because you are encoding 30 or more frames per second. The techniques VP8 uses are far more sophisticated than DEFLATE.
VP8 divides the image into macroblocks of 16x16 pixels. For each block, it performs intra-prediction, which predicts the block's content based on already-decoded neighboring blocks using multiple prediction modes (horizontal, vertical, DC, and various diagonal modes). The difference between the prediction and actual content is then transformed using a Discrete Cosine Transform (DCT), which converts the spatial pixel data into frequency coefficients. High frequency details that the human eye is less sensitive to can then be quantized, meaning their precision is reduced, which is where the lossy compression happens. Finally, the remaining data is encoded using arithmetic coding, which is more efficient than Huffman coding for this type of data.
Why This Matters
The block-based prediction in VP8 is dramatically more effective than PNG's row-based filters. By analyzing 2D blocks of pixels and using multiple prediction modes, VP8 can model the actual patterns in an image far more accurately, leaving much less residual data to encode.
How WebP Lossless Compression Works
WebP lossless uses a completely different algorithm than its lossy mode. Instead of VP8, it employs a suite of specialized techniques designed specifically for lossless image compression. These techniques work together to exploit patterns in image data more effectively than PNG's DEFLATE can.
The WebP lossless encoder applies several transform passes before the final entropy coding stage. These include a spatial predictor that uses up to 13 different prediction modes (compared to PNG's 5 filters), choosing the best one for each pixel. It also applies a color transform that decorrelates the RGB channels, exploiting the fact that color channels in natural images are often related. A subtract-green transform is particularly effective, removing redundancy between channels. Additionally, the encoder can build a color cache of recently seen pixel values and a palette for images with few unique colors. All of these intermediate results are then compressed using a combination of LZ77 and Huffman coding, similar to DEFLATE but with more sophisticated preprocessing that reduces the data's entropy before the final encoding step.
Key Technical Differences Explained
Predictive Coding
PNG uses 5 simple row-based filters. WebP lossless uses 13 prediction modes that analyze 2D pixel neighborhoods. Better prediction means smaller residuals, which compress more efficiently.
Color Transforms
PNG compresses each color channel somewhat independently. WebP applies cross-channel decorrelation transforms that exploit relationships between red, green, and blue values, reducing redundancy significantly.
Block-Based vs Pixel-Based
WebP lossy processes images in 16x16 or 4x4 blocks, allowing it to adapt its compression strategy to local image characteristics. PNG processes pixels in a linear stream, missing spatial patterns that block-based approaches can exploit.
Entropy Coding
WebP lossy uses arithmetic coding, which can approach the theoretical entropy limit more closely than PNG's Huffman coding. WebP lossless uses enhanced Huffman coding with more context for better compression ratios.
Real File Size Comparisons
Here are real-world file size comparisons for common image types at 1920x1080 resolution, demonstrating how the compression differences translate to actual savings:
| Image Type | PNG | WebP Lossless | WebP Lossy (q85) | Savings vs PNG |
|---|---|---|---|---|
| Photograph (landscape) | 2.5 MB | 1.8 MB | 350 KB | 86% |
| Portrait photo | 3.1 MB | 2.3 MB | 420 KB | 86% |
| Screenshot (text heavy) | 450 KB | 310 KB | 180 KB | 31% (lossless) |
| Graphic / illustration | 680 KB | 480 KB | 210 KB | 29% (lossless) |
| Logo (transparent bg) | 85 KB | 62 KB | 28 KB | 27% (lossless) |
| E-commerce product | 1.8 MB | 1.3 MB | 280 KB | 84% |
Note: WebP lossless is always smaller than PNG with identical quality. WebP lossy at quality 85 produces dramatically smaller files with negligible visual quality loss for photographs. The savings percentage depends on image content, with photographs showing the largest improvements.
Why This Matters for Web Performance
The file size difference between PNG and WebP has real, measurable impact on website performance. Every byte saved reduces the time visitors spend waiting for your page to load. On a 3G mobile connection, downloading a 2.5 MB PNG photograph takes approximately 8 seconds. The same image as a 350 KB WebP file loads in just over 1 second. This difference directly affects bounce rates, user engagement, and search engine rankings. Google's research shows that 53% of mobile users abandon pages that take longer than 3 seconds to load, making image optimization one of the most impactful performance improvements you can make.
At scale, the bandwidth savings are substantial. A website serving 50,000 page views per month with just 5 images per page could save over 500 GB of data transfer annually by switching from PNG to WebP. This translates to lower hosting costs, faster global delivery, and a better experience for every user, particularly those on mobile devices or in regions with slower internet connections.
Frequently Asked Questions
Q: If WebP lossless is smaller than PNG, does it lose any quality?
A: No. WebP lossless compression is mathematically perfect, meaning every pixel is preserved exactly. The smaller file size comes from more efficient compression algorithms, not from discarding data. Think of it like a more efficient ZIP algorithm: the data is identical when decompressed, it is just packed more tightly.
Q: Why didn't PNG use these better compression techniques?
A: PNG was designed in 1996 when computational resources were far more limited. DEFLATE was chosen because it was fast, well-understood, and patent-free. The advanced techniques WebP uses, such as cross-channel decorrelation and multi-mode spatial prediction, require more processing power than was commonly available in the 1990s. Additionally, PNG is an ISO standard, making it extremely difficult to update its core algorithm.
Q: Does WebP take longer to encode or decode than PNG?
A: WebP encoding is generally slower than PNG because of its more complex algorithms. However, WebP decoding is fast and comparable to PNG on modern hardware. For web delivery, encoding speed rarely matters since images are converted once and served many times. The decoding speed is what affects the user's experience, and it is more than adequate for real-time display.
Q: Are there any image types where PNG produces smaller files than WebP?
A: In rare cases, very small images (under 100x100 pixels) with very few unique colors can be slightly smaller as PNG with indexed color mode. This is because PNG's palette-based encoding has less overhead for tiny, simple images. However, for the vast majority of real-world images, WebP produces smaller files.
See the size difference yourself - convert PNG to WebP free
Convert PNG to WebP Free