Blog
PNG vs JPG vs WebP: What Actually Changes When You Convert
Compression algorithms, transparency support, and how to pick the right format instead of guessing.
Ask five people when to use PNG versus JPG and you'll typically get some version of "PNG for graphics, JPG for photos" — a rule of thumb that's directionally right but skips over why it's right, which matters once you hit an edge case the rule doesn't cover, like a photo with text overlaid on it or a screenshot with gradients.
Two different compression philosophies
JPG is a lossy format built around how human vision actually works. It converts an image into a color space that separates brightness from color information (YCbCr), then downsamples the color channels more aggressively than the brightness channel, because the eye is far more sensitive to changes in luminance than in chrominance. On top of that, it breaks the image into 8x8 pixel blocks, applies a discrete cosine transform to each block, and discards the higher-frequency components — the fine detail — more aggressively as the quality setting drops. The result is a format that's extremely efficient at photographic content full of gradual tonal variation, but visibly bad at sharp edges: text, thin lines, and hard color boundaries pick up "ringing" artifacts and blocky halos, because those are exactly the high-frequency details the algorithm is designed to throw away first.
PNG takes the opposite approach: it's lossless. It uses DEFLATE compression (the same general-purpose algorithm behind ZIP) after a filtering step that predicts each pixel from its neighbors and encodes only the difference, which compresses well when neighboring pixels are similar — flat color fields, sharp UI edges, text. Every pixel comes back out exactly as it went in; there's no quality slider because there's no quality being traded away. The cost is file size: a detailed photograph, full of the kind of fine gradient noise PNG's predictive filter doesn't handle efficiently, can come out several times larger as a PNG than as a reasonably-compressed JPG of the same image.
Where WebP fits
WebP was built by Google specifically to beat both formats at their own games in one container, and it mostly does. Its lossy mode uses intra-frame prediction techniques borrowed from video codecs (WebP descends from the VP8 video format) rather than JPG's block-DCT approach, which generally produces smaller files at equivalent visual quality — commonly cited figures are 25-35% smaller than a comparable JPG. Its lossless mode uses a different entropy-coding scheme than PNG's DEFLATE and typically beats PNG's file size too, particularly on images with large flat-color areas. And critically, WebP supports transparency in both its lossy and lossless modes, something JPG has never supported at all.
The tradeoff isn't technical, it's compatibility: WebP is well supported in every modern browser at this point, but older software, some email clients, and certain print or design-tool workflows still don't handle it, which is the main reason JPG and PNG haven't disappeared despite WebP being technically superior on most axes.
The transparency question
Transparency is the cleanest dividing line for format choice, because it's binary rather than a quality tradeoff. JPG's color model has no alpha channel at all — there is no way to encode "this pixel is 40% transparent" in a JPG file, full stop. If you need a logo that sits cleanly over a colored background, a UI icon, or any graphic that needs to composite over varying content, PNG (or WebP) is the only option among these three; converting a transparent PNG to JPG will flatten transparent areas to a solid background color, usually white, which is a common source of "why did my logo get a white box around it" support questions.
A practical way to decide
For photographs and anything with continuous tonal variation — a landscape, a portrait, a scanned photo — lossy compression (JPG or lossy WebP) is the right call, because the algorithm's assumptions match the content: gradual color transitions compress well and any quality loss is hard to spot at reasonable settings. For screenshots, logos, icons, line art, and anything with sharp edges or flat color regions, lossless compression (PNG or lossless WebP) avoids the blocky artifacts lossy compression would introduce right where they're most visible. And whenever transparency is required, PNG or WebP are the only formats on the table. If browser compatibility isn't a constraint, WebP is a reasonable default in either case, since it covers both compression modes with better efficiency than the older formats it replaces. Converting between these three doesn't change the image's content or resolution — only how the pixel data is packed into bytes on disk — which is exactly what theImage Converter tool on this site does when you switch a file from one format to another.
