PNG vs JPG: When Lossless Actually Matters
PNG and JPG get compared constantly, but they’re not really two options for the same problem — they’re tools built for genuinely different kinds of image content, and a huge amount of unnecessary file bloat on the web comes specifically from using one where the other belongs. Understanding the actual difference, rather than just picking whichever one your software defaulted to, fixes more of this than any compression tool can on its own.
The core difference: lossless versus lossy
PNG is a lossless format — every pixel you save comes back out exactly as it went in, with no exceptions, no matter how many times you open and re-save the file. JPG is lossy — it deliberately throws away some image detail in exchange for a much smaller file, using compression techniques designed around the assumption that some quality loss won’t be noticeable to the human eye.
Neither approach is inherently better. The right choice depends entirely on what kind of image content you’re actually compressing, because the two formats’ compression methods are good at fundamentally different things.
Why PNG is good at graphics and bad at photos
PNG’s lossless compression works by finding and exploiting exact repetition in the image data — large areas of identical color, repeated patterns, sharp boundaries between distinct color regions. That describes most graphics well: logos, icons, UI screenshots, diagrams, anything with flat color fields and crisp edges. PNG can compress that kind of content very efficiently while still being completely lossless, because there’s genuine exact repetition for it to take advantage of.
A photograph has almost none of that. Skin, sky, foliage, fabric — real-world photographic content is made of continuously, subtly varying color and tone, with very little exact repetition anywhere. PNG’s lossless compression has comparatively little to work with on that kind of image, so a photo saved as PNG often ends up five to ten times larger than the same photo saved as a reasonably-compressed JPG, without looking any better — the extra size is being spent maintaining pixel-perfect exactness in places where nobody would have noticed if it weren’t.
Why JPG is good at photos and bad at graphics
JPG’s lossy compression is built around the opposite assumption: that smooth, continuously-varying detail (exactly what photographs are full of) can be approximated rather than stored exactly, in ways the human eye won’t readily notice, in exchange for dramatically smaller files. This works very well for photographic content, which is why JPG remains the default format for digital photography decades after more modern formats have appeared.
It works much less well for the kind of content PNG excels at. JPG’s compression introduces artefacts that show up most visibly around sharp edges and fine text — exactly the content found in screenshots, logos, and diagrams. Save a screenshot with crisp text as a JPG and you’ll often see blurring or blocky discoloration right around the letters, an effect that’s far more noticeable and unpleasant than the same compression applied to an actual photo would be.
The most common mistake: using the wrong one by default
A lot of unnecessary file bloat comes from software defaults rather than deliberate choice. Screenshot tools on most operating systems save to PNG automatically, regardless of whether you’ve screenshotted a text-heavy interface or a full-screen photo. Some messaging apps and cloud services re-save shared images as PNG during processing. The result is photographic content trapped in a format that compresses it poorly, often without anyone realizing why a particular file seems unexpectedly large.
The fix is almost always to check what kind of content you’re actually compressing and match the format to it, rather than assuming whatever format the file currently happens to be in is the right one to keep. A photo saved as PNG should usually become a JPG. A screenshot or logo saved as JPG should usually become (or stay) a PNG, even though the PNG version may technically be larger — because the alternative is visible artefacts around the exact content where they’re most noticeable.
What about transparency?
This is the other major factor in the decision, independent of photo-versus-graphic content. JPG has no mechanism for representing transparent pixels at all — every pixel is fully opaque. If your image needs transparency for any reason (a logo meant to sit on top of other content, a cutout, a UI element with rounded or irregular edges), PNG is the only one of the two formats that can do this, regardless of whether the underlying content is more photo-like or more graphic-like. In that specific case, PNG may be the right choice even for content that would otherwise compress better as JPG, simply because JPG isn’t capable of the job at all.
A quick rule of thumb
If you’re not sure which to use: ask whether the image has sharp text, flat color regions, or needs transparency. If yes to any of those, PNG (or a format like WebP that offers similar lossless/transparency support with better compression) is the right call. If the image is a genuine photograph with continuous color and tone, and you don’t need transparency, JPG will almost always give you a dramatically smaller file at a quality level indistinguishable from the original at normal viewing sizes. Most of the unnecessary bloat people run into comes from skipping this question entirely and just using whatever format the file already happens to be in.