Guide
Best Image Format for Websites: JPEG vs PNG vs WebP vs AVIF
A practical comparison of every major web image format — which to choose for photographs, graphics, transparency, and animations, and how modern formats stack up against the legacy formats they're replacing.
The short answer
For most websites in 2025–2026:
- Photographs: WebP (lossy) — 25–35% smaller than JPEG with equivalent quality. Use AVIF for additional savings if your build pipeline supports dual-format output.
- Logos and icons: SVG if vector source is available. Otherwise WebP lossless, which is 25–35% smaller than PNG.
- Images with transparency: WebP — supports alpha in both lossy and lossless modes, smaller than PNG.
- Animations: MP4 (H.264 via
<video>tag) — 90–98% smaller than GIF. For animations requiring transparency, use animated WebP. - Diagrams and screenshots with text: WebP lossless or PNG. JPEG creates visible artifacts around sharp edges and text.
Full format comparison
| Format | Compression | Transparency | Animation | Browser support | Best for |
|---|---|---|---|---|---|
| JPEG | Lossy (excellent for photos) | No | No | Universal | Photos (legacy) |
| PNG | Lossless only | Yes (8-bit) | No (APNG rarely used) | Universal | Graphics (legacy) |
| WebP | Lossy or lossless | Yes (8-bit) | Yes (animated) | ~97% (all modern browsers) | Photos and graphics |
| AVIF | Lossy or lossless (best ratio) | Yes (8-bit) | Yes | ~90% (Chrome, Firefox, Safari 16+) | Maximum compression |
| GIF | LZW lossless (poor for photos) | Yes (1-bit only) | Yes | Universal | Avoid — use MP4 |
| SVG | Vector (XML-based) | Yes (native) | Yes (CSS/SMIL) | Universal | Logos, icons, diagrams |
File size comparison: same image, different formats
These are representative file sizes for a typical 1600×1067 photograph at comparable visual quality:
| Format | Settings | Approx. file size | vs JPEG baseline |
|---|---|---|---|
| PNG (lossless) | — | ~2.4 MB | +240% |
| JPEG | Quality 85 | ~700 KB | baseline |
| WebP (lossy) | Quality 82 | ~460 KB | −34% |
| AVIF (lossy) | Quality 68 | ~300 KB | −57% |
Actual savings vary by image content. High-detail photos with fine textures see lower percentage savings; smooth gradients and portraits see higher savings. These figures are representative of typical web photography.
Choosing by image type
Photographs (landscape, portrait, product shots): The photo's rich, continuous color variation makes lossy compression effective. WebP at quality 80–85 matches JPEG quality 90 with significantly smaller file size. AVIF at quality 65–75 pushes even further. Do not use PNG for photographs — lossless compression on photos produces enormous files (often 10× larger than JPEG).
Logos and brand marks: Always SVG if the original is vector. SVG files are typically 10–100 KB and scale perfectly to any size. If the logo must be rasterized (e.g., older systems), WebP lossless at 2× retina size is the right choice — never JPEG (compression artifacts on hard edges and text look terrible).
Screenshots and UI mockups: Use WebP lossless or PNG. Both formats handle the sharp pixel edges and text in screenshots without artifacts. JPEG is a poor choice here — even high-quality JPEG creates visible "ringing" artifacts around contrast edges, which are especially noticeable around text.
Illustrations and flat-color graphics: WebP lossless typically saves 25–35% over PNG with identical quality. If the illustration has gradients or complex shading, WebP lossy at high quality (90+) may produce smaller files with no visible difference. SVG is ideal if the source is vector.
Animated content: Replace GIF with MP4 wherever possible. The savings are dramatic — 10× to 50× smaller file with better quality and no perceptible frame limit. For animations requiring transparency, animated WebP is the only good option since MP4 doesn't support alpha channels.
Browser support considerations
All major browsers released since 2020 support WebP. AVIF support is close behind — Chrome, Firefox, Edge, and Safari 16+ support it. The gap in support is small but significant enough to require a fallback strategy for AVIF.
The standard approach for AVIF with fallback:
<picture>
<source srcset="image.avif" type="image/avif">
<source srcset="image.webp" type="image/webp">
<img src="image.jpg" alt="Description" width="800" height="600">
</picture> This serves AVIF to browsers that support it, WebP to those that support WebP but not AVIF, and JPEG to everything else. The browser downloads only the first source format it supports.
For most sites using a modern stack (Next.js, SvelteKit, Nuxt, Gatsby), image optimization plugins handle format conversion and <picture> generation automatically. You provide the source image; the framework outputs the right format per browser.
For sites where build-time conversion is not possible, serving WebP only (without AVIF) is a reasonable choice — it covers ~97% of users while avoiding the complexity of multi-format pipelines.
Quick decision guide
- Photo, modern browsers (2020+): WebP lossy. Add AVIF source if your pipeline supports it.
- Photo, broad legacy support: JPEG, or WebP with JPEG fallback via
<picture>. - Logo / icon, vector source available: SVG.
- Logo / icon, raster only: WebP lossless.
- Graphic with transparency: WebP (supports alpha). PNG as legacy fallback.
- Animation: MP4 via
<video autoplay loop muted playsinline>. Animated WebP if transparency needed. - Screenshot or diagram with text: WebP lossless or PNG.
- Archival or print export: TIFF or PNG (lossless, full quality).
Frequently asked questions
What is the best image format for websites?
WebP is the best all-around image format for most websites. It produces 25–35% smaller files than JPEG for photographs and 25–35% smaller than PNG for graphics, with full browser support since 2020. For maximum compression, AVIF is technically superior but requires a fallback for older browsers. Use SVG for logos and icons (infinite scalability, tiny file size). Use JPEG only when legacy browser support is required.
Should I use AVIF or WebP in 2025?
Use both — serve AVIF to browsers that support it and WebP as a fallback, using the <picture> element with multiple <source> tags. AVIF saves an additional 20–30% over WebP with equivalent visual quality, but browser support is lower (~90% vs ~97% for WebP). For a single-format choice, WebP provides excellent compression with near-universal support.
When should I use PNG instead of WebP?
Use PNG when you need transparency and cannot use WebP (very old browser targets), when delivering to design tools or image editors that may not handle WebP, or when the image will be further processed and you need a lossless intermediate format. For web delivery, WebP lossless is always at least as good as PNG and typically 25% smaller.
Is JPEG still worth using?
JPEG is worth using only as a fallback for browsers that do not support WebP or AVIF. All modern browsers released since 2020 support WebP. For new websites targeting modern browsers, WebP should be the primary format with no JPEG fallback needed. JPEG remains important for compatibility with email clients, old CMS systems, and tools that do not accept WebP.
