The advice usually arrives as a ranking. AVIF beats WebP beats JPEG, PNG is the one with transparency, use the newest thing your users can open. It is not wrong exactly, but it is the answer to a question nobody asked, because these four formats are not four points on one quality scale. They are two fundamentally different theories about what an image is, with two implementations each.
Get that distinction right and the choice stops being a matter of dates.
Two theories of a picture
A photograph is a signal. Real-world light is continuous. Neighbouring pixels are almost always similar, edges are soft, and the eye is far more sensitive to changes in brightness than to changes in colour. If you accept those assumptions, the efficient move is to transform blocks of pixels into frequency components, keep the low frequencies precisely, quantise the high ones aggressively, and store colour at a lower resolution than brightness. That is JPEG, and in a more sophisticated form it is also lossy WebP and AVIF.
A screenshot is data. A user interface has exactly the colours the designer chose, in large flat regions, separated by edges precisely one pixel wide. There are no assumptions to exploit about smoothness, and every one of the frequency model’s assumptions is actively false. What there is instead is enormous literal repetition: identical pixels in runs, identical rows, a small palette. The efficient move is to predict each pixel from its neighbours, store the difference exactly, and compress the resulting stream of mostly-zeroes. That is PNG, and it is also lossless WebP.
Neither theory is better. Applying the wrong one is what produces the two classic failures: a photograph stored losslessly, which is enormous, and a screenshot stored lossily, which looks dirty.
What each format actually is
JPEG, standardised in 1992 as ITU-T T.81, is the original signal model: eight-by-eight blocks, a discrete cosine transform, a quantisation table scaled by the quality setting, chroma subsampling, Huffman coding. Baseline JPEG carries eight bits per channel and has no alpha channel at all. Its enduring advantage is not technical. It is that everything, everywhere, opens it.
PNG is the data model, and it is genuinely lossless: an encoder predicts each pixel from the ones above and to the left using one of a small set of per-row filters, then compresses the residuals. It supports palettes, greyscale, eight or sixteen bits per channel, and a real per-pixel alpha channel rather than a single colour designated as transparent. It has no lossy mode whatsoever, which is why “compress this PNG” always means “find a smaller encoding of these exact pixels”.
WebP is really two formats sharing one container. Lossy WebP uses the intra-frame coding from the VP8 video codec, which predicts each block from its already-decoded neighbours before transforming the difference, so it starts from a better guess than JPEG does. Lossless WebP is a separate algorithm entirely, closer in spirit to PNG but with colour transforms and back-references PNG lacks. Both support alpha, which was WebP’s most practically useful contribution: before it, transparency meant giving up lossy compression. Two limits are worth knowing: lossy WebP is always 4:2:0, storing one colour sample per two-by-two block of pixels, and no WebP may exceed 16383 pixels in either dimension.
AVIF applies the same idea one generation on, wrapping AV1’s intra-frame coding in a container derived from the same ISO base media format that HEIC uses. Relative to WebP it can do things WebP structurally cannot: up to twelve bits per channel, full-resolution 4:4:4 colour when asked, high dynamic range transfer functions, and much larger dimensions. It also encodes considerably more slowly, and carries enough container overhead that on very small images it can lose to a well-optimised PNG.
Picking by content
Photographs and anything camera-shaped. Use a lossy format, and pick it by who has to open the file. AVIF gives the best detail per byte, WebP is a solid middle, JPEG is what you use when the recipient is unknown or the system is old. Converting a JPEG to WebP with a JPG to WebP converter typically buys real savings at a quality of 80 on its 1 to 100 scale, which is the default there, but remember that it is a second lossy pass over an already-lossy image, not a free win.
Screenshots, UI captures, diagrams, charts and line art. Use PNG. Not as a compatibility fallback but because it is genuinely the right model, and it is exact. If the file feels large, the fix is not a lossy conversion, it is a real optimiser. A PNG optimiser re-runs the filter search and the compression pass at a configurable effort level, and every pixel of the decoded result is identical to the input. The implementation here deliberately leaves interlacing off, since interlacing usually makes a PNG bigger, and leaves alpha optimisation off, since rewriting the hidden colour values under fully transparent pixels would shrink the file at the cost of the byte-identical guarantee. If the optimised output does not come out smaller than the original, you get your original back untouched.
Logos, icons and flat-colour graphics. PNG again, and often by a wide margin, because a handful of distinct colours in large regions is the case lossless coding was built for. This is the clearest example of “newest” being the wrong instinct: a 64-pixel icon as AVIF can easily be larger than the same icon as an optimised PNG.
Anything needing transparency. PNG, WebP and AVIF all have a real alpha channel. JPEG does not, and this is the one conversion that changes your image whether you like it or not. A PNG to JPG converter has to composite transparent pixels onto something opaque before encoding, which is why it offers a background colour at all; the default here is white, because a bare canvas would otherwise composite them onto black and turn a soft drop shadow into a dark smear.
Text over an image, or saturated red and blue edges. Be careful with lossy WebP specifically, because its mandatory 4:2:0 chroma means colour detail is stored at a quarter of the sample count. Red text on a dark background is the classic case that falls apart. AVIF at 4:4:4, or PNG, will hold it.
Two things that are true regardless of format
Every lossy save compounds. Quality loss is not a property of a file, it is a property of a history. A photograph that has been JPEG’d, resized, saved again and passed through a messaging app carries all four rounds of damage, and no later format choice removes any of it. When you need to shrink something, do it once, deliberately: a general image compressor here keeps the input format rather than silently switching it, and when you have not asked it to downscale, it hands you back the original bytes rather than a re-encode that did not actually come out smaller. An explicit resize is always honoured, even in the rare case where the resized file is the larger one, since at that point you have asked for different pixels and not just fewer bytes.
Quality numbers are not comparable across formats. They scale different internal machinery. Nothing meaningful connects them, and treating a number as a portable measure of quality is the most common way people end up with files that are simultaneously too big and too damaged.
There is one exception worth naming for accuracy: AVIF encoding is not built into browsers the way JPEG, PNG and WebP encoding is. The HTML specification says a canvas asked to serialise to a format the browser does not support for that purpose falls back to PNG, silently, which is why a PNG to AVIF converter that actually produces AVIF has to carry a real WebAssembly build of the codec rather than asking the canvas for it. That converter takes quality on AVIF’s own 1 to 100 scale, defaulting to 60. It is also the reason AVIF conversion feels slow in a browser tab: you are running a video codec’s intra encoder, in software, on one thread.
The short version
Ask what is in the picture before you ask what year it is. Continuous tone wants a lossy format and the newest one your audience can open. Flat colour, sharp edges and text want a lossless one, and PNG has not been improved on for that job in any way that matters. Transparency rules JPEG out. And whatever you choose, choose it once, because the conversions themselves are what cost you.

