JPEG vs PNG vs WebP vs AVIF
Which image format to use for photos, graphics, transparency and modern browsers.
Four formats cover almost every image on the web. Each makes a different trade-off between file size, quality and features. The right choice depends on whether the picture is a photograph or a graphic, whether it needs transparency, and which browsers your visitors use.
| Option | Best for | Strengths | Limits |
|---|---|---|---|
| JPEG | Photographs with smooth gradients | Universal support, small files for photos, adjustable quality | No transparency, artefacts around sharp edges and text |
| PNG | Logos, screenshots and flat graphics | Lossless, supports transparency, crisp edges | Large files for photographs |
| WebP | General web images needing a smaller file | Usually smaller than JPEG or PNG, supports transparency and animation | Very old software may not open it |
| AVIF | Maximum compression for modern browsers | Often the smallest files at good quality, HDR-capable | Slower to encode and not supported by some older tools |
Photographs
For photographs, JPEG has been the standard for decades and every device can display it. WebP and AVIF usually produce smaller files at the same visual quality, which improves page speed. If you serve modern formats, provide a JPEG fallback in your markup so older browsers still show the picture.
Graphics, logos and transparency
PNG is the safe choice for logos, interface screenshots and anything with sharp edges or text. It keeps every pixel and supports transparent backgrounds. WebP can also handle transparency at a smaller size, which makes it a good replacement for PNG when your tools and audience support it. For simple vector logos, SVG is usually better than any raster format.
Verdict
For most sites, use WebP for photographs and graphics with a JPEG or PNG fallback, keep PNG for logos that need exact edges, and consider AVIF if you have the tooling to generate it.