Technical Guides
Is PNG Lossy or Lossless? The Direct Answer
PNG is a lossless image format. Learn how PNG compression works, why PNG files can still be optimized, and when tools like TinyPNG or pngquant make PNG workflows lossy.
By Sunny Kumar · Editor
PNG is lossless. A normal PNG file preserves every pixel exactly. You can decode it, edit it, and save it again without JPEG-style generation loss. The confusion comes from tools that create smaller PNG files by reducing colors first. The PNG format is lossless; some PNG optimization workflows are not.
TL;DR: PNG is a lossless image format. Its compression is reversible and does not throw away image data. Use PNG for screenshots, UI images, diagrams, transparent graphics, and raster logos when exact pixels matter. The exception is not the PNG format itself. It is tools like TinyPNG, pngquant, or PNG-8 export settings that reduce colors before saving. Those workflows can be lossy even though the output file is still .png.
Direct Answer
The short answer and the real exception.
How PNG Works
Filtering, DEFLATE, and why it is reversible.
Lossy Exceptions
TinyPNG, pngquant, PNG-8, and JPEG-to-PNG confusion.
When to Use
PNG vs JPEG, WebP, AVIF, SVG, and source files.
Simple Rule
PNG itself is lossless. If quality is lost, it usually happened before the PNG was saved: JPEG source artifacts, palette reduction, color quantization, resizing, or an optimizer that deliberately changed the pixels.
PNG Delivery Tip
For websites, keep the original PNG when you need exact pixels, then serve WebP or AVIF derivatives to modern browsers through an image CDN. BunnyCDN Optimizer can handle this kind of format conversion, and coupon THEWPX gives $5 free credit through this signup link.
Is PNG Lossy or Lossless?
PNG is lossless by design.
The W3C PNG Third Edition specification describes PNG as a lossless, portable, well-compressed format for static and animated raster images. That means the format is built to store pixel data without discarding it.
If you save a clean screenshot as PNG, the text and UI edges remain exact. If you open that PNG and save it again as PNG, it does not degrade the way JPEG does.
The important distinction:
| Situation | Is quality lost? | Why |
|---|---|---|
| Save image as normal PNG | No | PNG compression is reversible |
| Re-save PNG as PNG | No, if pixels are unchanged | No generation loss |
| Compress PNG with OptiPNG/oxipng | No | Recompresses same pixels |
| Convert JPEG to PNG | Quality is not restored | JPEG damage already exists |
| Use TinyPNG/pngquant aggressively | Yes, often | Colors may be reduced |
| Export PNG-8 from a full-color image | Yes, if colors are reduced | Palette limit changes pixels |
So the clean answer is: PNG is lossless, but a PNG file can contain image data that was already damaged or reduced before it became PNG.
How Does PNG Compression Work?
PNG compression has two main ideas: filtering and DEFLATE.
1. PNG Filters the Pixel Rows
Before compression, PNG can transform each row of pixels with prediction filters. Instead of storing every value directly, the file can store differences from nearby pixels.
For example, a row like this:
200, 201, 202, 203
can become something closer to:
200, 1, 1, 1
That is easier to compress because repeated small values are common.
PNG has several filter types, including None, Sub, Up, Average, and Paeth. The encoder chooses filters that make the data easier to compress.
2. PNG Uses DEFLATE Compression
After filtering, PNG uses DEFLATE compression. DEFLATE combines repeated-pattern matching with entropy coding. It is the same broad family of compression used by ZIP and gzip.
The important part: this compression is reversible.
Nothing is thrown away. The decoder can reconstruct the original pixel values from the compressed stream.
That is why PNG is good for screenshots, interface images, flat graphics, diagrams, and text-heavy visuals. These images often have repeated shapes, flat regions, and sharp edges that PNG can represent cleanly.
When Can a PNG Workflow Be Lossy?
The PNG format is lossless. The workflow around it can still be lossy.
1. Converting JPEG to PNG
Saving a JPEG as PNG does not restore lost quality.
JPEG compression already discarded image data. If the JPEG has block artifacts, color shifts, or blurred text, the PNG will preserve those damaged pixels exactly.
That usually gives you the worst result: a larger PNG file with the same JPEG artifacts.
2. TinyPNG and pngquant
Tools like TinyPNG and pngquant can make PNG files much smaller by reducing colors. This is useful, but it can be lossy.
The common method is color quantization: reduce a full-color image to a smaller palette, often 256 colors. For simple icons or flat logos, the change may be invisible. For gradients, shadows, photos, or complex UI screenshots, it can create banding or color shifts.
The output is still a valid PNG file. It is just not pixel-identical to the original.
3. PNG-8 Export
PNG-8 usually means indexed-color PNG with up to 256 colors.
If your image genuinely has only a small set of colors, PNG-8 can be fine. If your image has gradients, transparency, shadows, or anti-aliased edges, reducing it to PNG-8 can throw away color detail.
This is why "PNG is lossless" and "this PNG export was lossy" can both be true.
4. Resizing, Cropping, or Color Conversion
PNG does not protect you from edits.
If you resize an image, change color profiles, flatten transparency, or remove colors before saving, those changes are baked into the PNG. PNG will preserve the result losslessly, but it cannot preserve data you already changed.
PNG-8, PNG-24, and PNG-32 Explained
These names are common in design tools, but they are not the cleanest technical names from the spec. Still, they are useful shorthand.
| Name | What it usually means | Best for |
|---|---|---|
| PNG-8 | Indexed color, up to 256 colors | Simple icons, flat graphics |
| PNG-24 | Truecolor RGB, no alpha | Complex graphics without transparency |
| PNG-32 | Truecolor RGB plus alpha | Transparent graphics, shadows, anti-aliased edges |
PNG-8 can be smaller, but palette reduction can be lossy when the source has more colors than the palette can represent.
PNG-24 and PNG-32 can preserve much more visual detail, but they are often larger.
For transparent UI assets, PNG-32 or lossless WebP is usually safer than forcing PNG-8.
PNG Optimization: Lossless vs Lossy
There are two kinds of PNG optimization.
Lossless PNG Optimization
Lossless optimizers keep the pixels the same and try to store them more efficiently.
Examples:
oxipngOptiPNGpngcrushzopflipng
These tools can remove unnecessary metadata, try better filters, and search for smaller DEFLATE encodings. When used in lossless mode, decoded pixels stay the same.
This is safe for source files, screenshots, and graphics where exact pixels matter.
Lossy PNG Optimization
Lossy PNG optimizers change the pixels to make the file smaller.
Examples:
- TinyPNG
- pngquant
- PNG-8 palette export
These can be useful for web delivery, but they are not pixel-perfect. The quality loss may be invisible on simple graphics and obvious on gradients or screenshots.
Quick Note: If your goal is smaller web delivery with exact pixels, try lossless WebP. Google's WebP lossless and alpha study found WebP lossless could beat PNG encodings in its test corpus while preserving pixels.
When Should You Use PNG?
Use PNG when exact pixels, transparency, or compatibility matters.
| Use case | Should you use PNG? | Better alternative sometimes |
|---|---|---|
| Screenshots | Yes | Lossless WebP for web delivery |
| UI mockups | Yes | Lossless WebP |
| Raster logos | Yes | SVG if vector source exists |
| Icons | Sometimes | SVG or WebP |
| Transparent graphics | Yes | WebP/AVIF if alpha is preserved |
| Photos | Usually no | JPEG, WebP, AVIF |
| Hero images | Usually no | WebP or AVIF |
| Source files for edits | Yes, if raster | PSD, TIFF, RAW, project-native file |
PNG is still excellent for documentation screenshots, UI examples, simple diagrams, and transparent raster graphics.
PNG is a poor default for photography. A photo saved as PNG can be many times heavier than the same visual image delivered as JPEG, WebP, or AVIF.
For a wider format comparison, see image formats explained and WebP vs AVIF vs JPEG.
PNG vs WebP Lossless
PNG is the compatibility baseline. WebP lossless is the modern web upgrade.
| Feature | PNG | WebP lossless |
|---|---|---|
| Pixel preservation | Yes | Yes |
| Transparency | Yes | Yes |
| Browser support | Universal | 95.97% global |
| Tool compatibility | Excellent | Good in browsers, weaker in old software |
| Typical web file size | Larger | Often smaller |
| Best role | Fallback and compatibility | Modern web delivery |
For websites, the practical setup is simple:
<picture>
<source srcset="/images/screenshot.webp" type="image/webp" />
<img
src="/images/screenshot.png"
alt="Dashboard screenshot showing image optimization settings"
width="1200"
height="800"
loading="lazy"
/>
</picture>
Modern browsers get WebP. Everyone else gets PNG.
An image CDN format conversion setup can handle this automatically through the browser's Accept header.
PNG on the Web
PNG is still everywhere.
HTTP Archive's 2024 Media chapter reported PNG at 28.4% of mobile image resources, behind JPEG at 32.4% and ahead of GIF, WebP, SVG, and AVIF in raw format share.
That does not mean PNG is always the best delivery format. It means PNG is deeply embedded in web workflows because it is reliable, simple, transparent, and universally supported.
The better 2026 pattern is:
- keep PNG when exact pixels and compatibility matter
- serve lossless WebP where browser support allows
- use JPEG/WebP/AVIF for photos
- use SVG for true vector logos and icons
For more PNG-specific delivery advice, read image CDNs for PNG images.
Frequently Asked Questions
Is PNG lossy or lossless?
PNG is lossless. Standard PNG compression preserves the original pixels exactly. If quality is lost, it usually came from a lossy source file, palette reduction, resizing, or an optimizer that changed the pixels before saving the PNG.
Does converting JPEG to PNG improve quality?
No. Converting JPEG to PNG does not recover lost JPEG detail. It only stores the already-compressed JPEG pixels in a lossless PNG container, usually making the file larger without improving quality.
Is TinyPNG lossless?
Not always. TinyPNG commonly uses color quantization to reduce PNG file size. That can be visually acceptable for simple graphics, but it is not guaranteed to preserve every original pixel.
Can I save a PNG many times without quality loss?
Yes, if you are not changing the pixels during editing. PNG does not have JPEG-style generation loss. Re-saving a PNG as PNG can preserve the same pixels exactly.
Is PNG better than JPEG?
For screenshots, transparent graphics, logos, and text-heavy images, PNG is usually better because it is lossless. For photos, JPEG, WebP, or AVIF are usually better because PNG files become much larger.
Is WebP lossless better than PNG?
For modern web delivery, often yes. WebP lossless can preserve the same pixels with smaller files. PNG still wins for maximum compatibility and fallback support.
Does PNG support animation?
PNG itself is mainly known for static images, but APNG extends PNG for animation and is covered in the modern PNG specification. For most web animation, animated WebP or video is usually a better delivery choice.
Summing Up!
PNG is lossless. The format preserves pixels exactly and does not degrade from repeated saves the way JPEG does.
The catch is workflow. If you start from a damaged JPEG, reduce colors with pngquant or TinyPNG, export as PNG-8, resize, or flatten transparency, the resulting PNG will preserve those changed pixels. PNG cannot restore information that was already removed.
Use PNG for screenshots, UI images, transparent graphics, and compatibility. Use lossless WebP when you control modern web delivery. Use JPEG, WebP, or AVIF for photos. For production sites, an image CDN can keep your PNG originals intact while serving smaller modern formats to browsers that support them.