Technical Guides
Is PNG Lossy or Lossless? The Full Answer (With Exceptions)
Updated on March 3, 2026
PNG is a lossless format. Every pixel in the original image is preserved exactly — no data is discarded, no quality is lost, even after saving repeatedly. But there's a catch: some popular PNG optimization tools (like TinyPNG and pngquant) apply lossy compression to PNG files, which trips people up.
TL;DR: Standard PNG compression is 100% lossless — it uses the DEFLATE algorithm to reduce file size without discarding any image data. You can open, edit, and re-save a PNG a thousand times with zero quality degradation. The confusion arises because tools like pngquant and TinyPNG reduce PNGs from 24-bit to 8-bit color (256 colors), which is lossy. The PNG format itself is lossless; the tool you use to optimize it may not be.
Automatic PNG Optimization
BunnyCDN serves PNG files as WebP or AVIF to modern browsers — 26–50% smaller with transparency preserved. The original PNG stays untouched on your server.
Try BunnyCDN with $5 Free Credit → — use coupon THEWPX on the billing page.
How PNG Compression Actually Works
PNG compresses images through a three-stage pipeline. Every stage is fully reversible — which is what makes the format lossless.
Stage 1: Prediction Filtering
Before any compression happens, PNG runs each row of pixels through a prediction filter. Five filter types are available:
| Filter | What It Does |
|---|---|
| None | Passes raw pixel bytes through unchanged |
| Sub | Stores the difference between each byte and the byte to its left |
| Up | Stores the difference between each byte and the byte directly above |
| Average | Stores the difference between each byte and the average of left + above |
| Paeth | Uses a linear function of three neighbors (left, above, upper-left) to predict the value |
The encoder picks the best filter for each row. Filtering doesn't reduce the data size — it transforms pixel values into smaller differences that compress more efficiently in the next stages. A row of [200, 201, 202, 203] becomes [200, 1, 1, 1] with the Sub filter — much easier to compress.
Stage 2: LZ77 Compression
The filtered byte stream is scanned for repeating patterns using a sliding window. When the algorithm finds a sequence that already appeared earlier, it replaces the duplicate with a back-reference: "copy 15 bytes from 200 bytes back." This is why images with large areas of solid color — like logos on white backgrounds — compress extremely well as PNG.
Stage 3: Huffman Coding
The LZ77 output is further compressed by assigning shorter bit codes to frequently occurring values. Common byte patterns get short codes; rare ones get longer codes. This is the same principle used in ZIP files.
Stages 2 and 3 together form DEFLATE compression — the same algorithm used in ZIP and gzip. Every bit is perfectly reversible. The decompressor reconstructs the exact original pixel data, byte for byte.
For a broader view of how lossy and lossless approaches differ, the lossy vs lossless compression guide covers the fundamentals.
When PNG Quality Does Get Lost
The PNG format is lossless. But several common workflows silently introduce quality loss.
Converting JPEG to PNG
This is the most common misconception. Saving a JPEG as PNG does not restore quality lost during JPEG compression. The PNG faithfully preserves whatever data the JPEG contains — including all its compression artifacts. The result: a file that's 5–10x larger than the JPEG with zero quality improvement.
If someone sends you a JPEG and you need PNG, the artifacts are already baked in. No format conversion can undo lossy compression.
PNG Quantization (pngquant, TinyPNG)
Tools like pngquant and TinyPNG achieve dramatic file size reductions — often 60–70% — by converting 24-bit or 32-bit PNGs down to 8-bit indexed color (256 colors max). This is a lossy process.
The output is still a valid PNG file, which is why people assume it's lossless. But color information has been permanently discarded. A 16.7-million-color image mapped to 256 colors cannot be reversed.
For simple graphics like logos and icons, the quality difference from quantization is often invisible. For photographs or gradients, banding artifacts become obvious.
Color Depth Reduction (PNG-8 Export)
Exporting as PNG-8 in Photoshop or other editors is the same idea — the editor reduces the image from millions of colors to a 256-color palette. Colors not in the palette are mapped to the nearest match, with optional dithering to mask the transition.
This is fine for icons, simple logos, and flat-color graphics. It's destructive for anything with gradients, shadows, or photographic detail.
PNG-8 vs PNG-24 vs PNG-32
The PNG spec doesn't actually use these names — they're informal terms from image editors. Here's what each means:
| Type | Color Depth | Max Colors | Transparency | Typical Use |
|---|---|---|---|---|
| PNG-8 | 8-bit indexed | 256 | Binary (on/off) or limited palette alpha | Icons, simple logos, flat graphics |
| PNG-24 | 24-bit truecolor | 16.7 million | None | Complex graphics without transparency |
| PNG-32 | 32-bit truecolor + alpha | 16.7 million + 256 alpha levels | Full per-pixel alpha (smooth edges, shadows) | Logos with drop shadows, overlays, UI elements |
File size difference is significant. A small web icon might be 6 KB as PNG-8 but 12 KB as PNG-24 — roughly double. For simple graphics with flat colors, PNG-8 is the right choice. For anything with smooth transparency (drop shadows, glows, anti-aliased edges), PNG-32 is required.
Under the hood, the PNG spec defines this through color types: type 3 (indexed) for PNG-8, type 2 (RGB) for PNG-24, and type 6 (RGBA) for PNG-32.
PNG Optimization: Lossless vs Lossy Tools
Not all PNG optimization tools are created equal. Some are truly lossless; others trade quality for dramatic size savings.
Truly Lossless Tools
These recompress the same pixel data more efficiently — zero quality loss:
| Tool | Average Reduction | How It Works |
|---|---|---|
| OptiPNG | ~13% | Tries multiple filter/compression combinations to find the smallest valid encoding |
| pngcrush | ~5% | Tests up to 114 filter/compression methods, removes unnecessary metadata chunks |
| ZopfliPNG | ~18% | More thorough DEFLATE search that finds better compression at the cost of much slower encoding |
These tools produce bit-for-bit identical pixel data when decoded. The only change is more efficient compression of that data.
Lossy Tools (Significant Savings, Permanent Quality Loss)
| Tool | Average Reduction | How It Works |
|---|---|---|
| pngquant | ~64% | Reduces 24/32-bit PNGs to 8-bit indexed color using modified median-cut quantization with dithering |
| TinyPNG | ~70% | Quantization similar to pngquant, plus metadata stripping. Web-based service |
These tools output valid PNG files, but the pixel data has been permanently altered. The quality loss is usually imperceptible for web graphics but visible in photographs and gradients.
Quick Note: Running OptiPNG on a file that's already been through pngquant gives marginal additional savings (~2–3%). The big reduction comes from quantization; lossless recompression adds a small bonus on top.
PNG File Size: How It Compares
PNG compression efficiency varies dramatically depending on image content.
Compression Ratios by Content Type
| Content | PNG Compression Ratio | Why |
|---|---|---|
| Simple logos (flat colors) | 6:1 to 10:1 | Large areas of identical color compress very efficiently with LZ77 |
| Screenshots with text | 3:1 to 5:1 | Mix of text, UI elements, and gradients |
| Photographs | 1.5:1 to 2:1 | Complex color variation leaves little for DEFLATE to compress |
PNG vs Other Formats
| Format | Photo (1920×1080) | Logo (500×500, transparent) |
|---|---|---|
| PNG | ~3.2 MB | ~85 KB |
| JPEG (quality 85) | ~320 KB | N/A (no transparency) |
| WebP lossy (quality 80) | ~210 KB | ~45 KB |
| WebP lossless | ~1.9 MB | ~55 KB |
| AVIF lossy (quality 60) | ~155 KB | ~35 KB |
For photographic content, PNG files are roughly 10x larger than JPEG and 15–20x larger than AVIF. For logos and icons, the gap narrows — and PNG remains competitive when you need guaranteed lossless quality with maximum compatibility.
According to Google's WebP study, WebP lossless images are 26% smaller than PNGs on average. A lossless format benchmark by siipo.la found WebP lossless 41% smaller than baseline PNG, with optimized PNG (ZopfliPNG) closing that gap to ~28%.
For a detailed format comparison including lossy performance, see the WebP vs AVIF vs JPEG guide.
When to Use PNG (And When Not To)
PNG Is the Right Choice For
Logos, icons, and brand assets. PNG preserves exact colors, sharp edges, and transparency. A company logo with a transparent background renders cleanly on any background color.
Screenshots and UI elements. Text, lines, and interface elements stay pixel-perfect. JPEG compression blurs text and creates visible artifacts around sharp edges.
Source/archival images. Images you'll edit and re-save multiple times. PNG has zero generation loss — save it 100 times, the 100th save is identical to the first. JPEG degrades slightly on every re-save.
Graphics requiring transparency. JPEG doesn't support transparency at all. PNG-32 provides full per-pixel alpha transparency with smooth edges. WebP also supports transparency, but PNG has 100% browser/tool compatibility.
PNG Is the Wrong Choice For
Photographs. A 1920×1080 photo is ~3.2 MB as PNG vs ~320 KB as JPEG — 10x larger with no visible quality benefit. Use JPEG, WebP, or AVIF for photos.
Large background images. A full-width hero image as PNG can exceed 2 MB. The same image as JPEG or WebP: 150–300 KB. That's the difference between a fast page load and a slow one.
Photo galleries. Fifty photos as PNG: 150–200 MB. Fifty photos as WebP: 10–15 MB. The bandwidth cost and load time difference is massive.
For web delivery, an image CDN automatically converts PNG files to WebP or AVIF for browsers that support them — keeping the original PNG as a fallback. The image CDNs for PNG files guide covers CDN-specific optimization.
PNG on the Web: Usage Statistics
Despite modern alternatives, PNG remains one of the most-used image formats on the web.
According to W3Techs (March 2026), 77.7% of all websites use at least one PNG image. HTTP Archive's Web Almanac puts PNG at 28.4% of all image requests — second only to JPEG at 32.4%.
The median PNG on the web is only about 5 KB — skewed low because most PNGs are small icons and logos. The 90th percentile is 129 KB, and large PNG photos can easily exceed several megabytes.
PNG usage is declining slowly (down ~0.8% year-over-year) as WebP and AVIF adoption grows, but the format isn't going anywhere. Its combination of lossless quality, full transparency, and universal compatibility keeps it relevant for graphics, logos, and UI elements.
Frequently Asked Questions
Does converting JPEG to PNG improve quality?
No. Converting JPEG to PNG creates a larger file containing the same degraded data. JPEG compression is irreversible — converting to PNG preserves the artifacts losslessly but cannot restore discarded information. The result is a bigger file with identical visual quality.
Is TinyPNG really lossless?
No. Despite the name, TinyPNG uses color quantization to reduce 24/32-bit PNGs to 8-bit (256 colors). This is lossy compression — color data is permanently discarded. The output is a valid PNG file, but it's not pixel-identical to the input. For truly lossless optimization, use OptiPNG or ZopfliPNG.
Can I save a PNG file multiple times without losing quality?
Yes — this is one of PNG's key strengths. Unlike JPEG, which degrades slightly on every re-save, PNG preserves every pixel perfectly regardless of how many times you save it. This makes PNG ideal for working files and source images.
Is WebP lossless better than PNG?
For file size, yes. WebP lossless produces files 26% smaller than PNG on average with identical quality. The trade-off is compatibility — PNG works in every browser, image editor, and operating system. WebP support is at 96%+ in browsers but still lacks support in some legacy software.
Does PNG support animation?
Not in the base specification. APNG (Animated PNG) is an unofficial extension with decent browser support (~96%), but for animated web content, WebP or GIF are more widely supported. Animated WebP files are typically 30–50% smaller than equivalent GIFs.
Why are my PNG screenshots so large?
Screenshots of complex UIs with gradients, shadows, and many colors don't compress well with DEFLATE because there's less repeating pixel data. Screenshots of text-heavy interfaces or terminal output compress much better. Use the PNG to WebP converter to reduce screenshot file sizes by 26–50% with no visible quality loss.
Summing Up!
PNG is lossless — the format preserves every pixel exactly as saved. The confusion comes from tools like pngquant and TinyPNG that apply lossy quantization to PNG files for smaller sizes. The format itself never discards data; certain tools do.
Use PNG for logos, screenshots, icons, and anything requiring transparency or repeated editing. For photographs and large images, JPEG, WebP, or AVIF deliver dramatically smaller files. For web delivery at scale, an image CDN like BunnyCDN handles format conversion automatically — serving WebP or AVIF to modern browsers while keeping your PNG originals intact. Use coupon THEWPX for $5 free credit.
