Dev Resource Digest

A running log of useful tools, guides and articles from around the web.

JPG vs PNG vs WebP vs AVIF: Which Image Format Should You Use?

Published 2026-11-21

Images are often the heaviest part of a web page. Choosing the right format can cut page weight dramatically and make your site load faster, which visitors notice immediately. Here is a simple guide to the four formats you will meet most often.

JPG (JPEG)

The classic format for photos. JPG uses lossy compression, which throws away detail the eye barely notices, so files stay small. It does not support transparency and handles sharp edges and text poorly. Use it for photographs when you need maximum compatibility.

PNG

PNG uses lossless compression, so the image stays pixel-perfect, and it supports transparency. That makes it great for logos, icons, screenshots and graphics with text. For photos, though, PNG files are usually much larger than JPGs.

WebP

A modern format that supports both lossy and lossless compression, plus transparency. WebP images are typically noticeably smaller than equivalent JPG or PNG files, and every modern browser supports them. For most websites, WebP is a safe, efficient default.

AVIF

The newest of the four. AVIF often produces even smaller files than WebP at the same visual quality, especially for photos. Browser support is now broad, but encoding is slower, and some older tools cannot open AVIF files yet.

A practical rule of thumb

Do not forget size and compression

The format is only half the story. Resize images to the size they are actually displayed at. A 4000-pixel-wide photo shown at 800 pixels wastes bandwidth. Free tools like Squoosh let you compare formats and quality settings side by side before you publish.

← Git Basics: The 8 Commands You Will Use Every Day