Choosing the right image format affects page load speed, visual quality, and user experience. The landscape has changed dramatically with the introduction of WebP and AVIF, which offer better compression than the traditional PNG and JPEG formats. Here's how to choose.
JPEG (JPG)
The oldest format still in widespread use. JPEG uses lossy compression — it discards visual information to achieve small file sizes. Best for:
- Photographs and images with many colours and gradients
- Hero images and background photos on websites
- Any image where slight quality loss is acceptable for smaller file size
JPEG doesn't support transparency. Each time you re-save a JPEG, quality degrades (generation loss). Always edit from a lossless original and export to JPEG only when finished.
Typical compression: 10:1 at acceptable quality. A 5MB photo compresses to about 500KB.
PNG
PNG uses lossless compression — no quality loss, no generation loss. Supports transparency (alpha channel). Best for:
- Logos, icons, and graphics with sharp edges and few colours
- Screenshots of user interfaces
- Images that need transparency
- Any image where quality must be preserved exactly
PNG files are significantly larger than JPEG for photographic content. A photo that's 500KB as JPEG might be 3MB as PNG. Use PNG for graphics, JPEG for photos.
WebP
Google's modern image format, supported by all major browsers since 2020. WebP supports both lossy and lossless compression, plus transparency and animation. It typically produces files 25-35% smaller than JPEG and PNG at equivalent quality.
Best for: Everything. WebP can replace both JPEG (lossy photos) and PNG (lossless graphics with transparency). If you're starting a new project, use WebP as your default format.
Typical savings: A 500KB JPEG becomes about 350KB as WebP at the same visual quality. A 3MB PNG with transparency becomes about 800KB as lossless WebP.
AVIF
The newest image format, based on the AV1 video codec. AVIF supports lossy and lossless compression, transparency, animation, and high dynamic range (HDR). It typically achieves 50% smaller files than JPEG at equivalent quality — better than WebP.
Browser support: Chrome, Firefox, and Safari (since 2022). Not supported on older browsers, so you need fallback formats.
Best for: Photography-heavy websites targeting modern browsers. Use with <picture> element for fallbacks.
The Picture Element for Modern Delivery
For maximum compatibility and performance, use the <picture> element:
<picture>
<source srcset="hero.avif" type="image/avif">
<source srcset="hero.webp" type="image/webp">
<img src="hero.jpg" alt="Hero image">
</picture>
The browser picks the first format it supports. AVIF for modern browsers, WebP for slightly older ones, JPEG as the universal fallback.
Decision Guide
| Image Type | Best Format |
|---|---|
| Photograph | AVIF → WebP → JPEG |
| Logo / icon | SVG (or WebP/PNG) |
| Screenshot | WebP (lossless) → PNG |
| Transparent graphic | WebP → PNG |
| Animation | WebP (animated) → GIF |
Resolution and Display Density
For high-DPI (Retina) displays, you need 2x resolution images. A 400×300 pixel display area needs an 800×600 pixel image. But don't serve the 2x image to non-Retina screens — use srcset to deliver the right resolution:
<img src="photo-1x.jpg"
srcset="photo-1x.jpg 1x, photo-2x.jpg 2x"
alt="Photo">
The image tool on this site handles format conversion, resizing, cropping, and compression — all in your browser using the Canvas API. Upload an image, convert between formats, and download the result. No images are uploaded to a server.