GUIDE
JPEG, PNG, WebP and AVIF
The format decides the trade-off between size, quality and features. The dimensions decide whether the file was too large in the first place.
Most image-weight problems are not format problems. A 4000-pixel photograph displayed at 800 pixels is 25 times more pixels than needed, and no codec fixes that. Resize first, then choose a format.
The four formats
| Format | Best for | Transparency | Notes |
|---|---|---|---|
| JPEG | Photographs | No | Universal; lossy; no animation |
| PNG | Logos, screenshots, UI | Yes | Lossless; large for photos |
| WebP | Both, at smaller sizes | Yes | Wide support; lossy or lossless |
| AVIF | Smaller files at high quality | Yes | Best compression; slower to encode, newer support |
Quality is not a percentage of quality
JPEG quality 85 usually looks identical to the original at normal viewing size and is far smaller. Quality 100 often doubles the file for no visible gain. WebP at 80 is frequently smaller than JPEG at 85 with the same appearance. The right setting depends on the image: text and sharp edges suffer first.
Dimensions, not DPI
A web image has no physical size until it is printed. “300 DPI” is a print instruction, not a property of the file; what matters on screen is the pixel width and the CSS size it is displayed at. For a 2× display, serve roughly twice the CSS width.
Responsive images
Instead of one large file, provide a few widths and let the browser choose with srcset and sizes. A typical set is 480, 800, 1200 and 1600 pixels. The browser knows the viewport and the device pixel ratio; you do not have to guess.
Metadata
Photos often carry EXIF data: camera model, timestamp and GPS coordinates. Re-encoding through a canvas removes it, which is usually what you want for a public site. Some tools strip it explicitly; check before publishing location-tagged images.
Use the resizer to set dimensions and the converter to change format.