The 30-Second Answer
Pick by use case:
- **PNG** for logos, icons, screenshots, and any image with sharp edges, text, or transparency you must keep pixel-perfect.
- **WebP** as your default for photos and most web imagery. Excellent compression, near-universal browser support, handles transparency and animation.
- **AVIF** when you want the smallest possible photos and can accept slightly slower encoding and older-browser fallbacks.
A practical workflow in 2026: author in PNG (or JPEG for source), serve **AVIF with a WebP and PNG fallback**, and let the browser pick. You can compress and convert any of these in the browser with the [image compressor](/en/image-compressor).
How We Got Here
For two decades the web ran on three formats: **JPEG** for photos, **PNG** for graphics with transparency, and **GIF** for animation. They are universally supported but inefficient by modern standards.
Google shipped **WebP** in 2010. Based on the VP8 video codec, it beats JPEG and PNG on size while adding transparency and animation. By 2024 every major browser supported it.
**AVIF** arrived in 2019, built on the AV1 video codec. It compresses better than WebP, supports 12-bit color, HDR, film grain, and alpha. The cost is slower encoding and some compatibility gaps in older browsers and tooling.
**HEIC** is worth a mention: it powers iPhone photos and is efficient, but patent licensing makes it unsafe for the open web. Stick with AVIF and WebP instead.
Format-by-Format
PNG (Portable Network Graphics)
PNG uses lossless compression. It keeps every pixel exactly as authored.
**Best for:** logos, UI icons, diagrams, screenshots, line art, anything with text, anything needing lossless alpha transparency.
**Strengths:**
- Lossless; identical pixels on every render.
- Full alpha-channel transparency (8-bit, smooth edges).
- Universally supported, including ancient browsers and email clients.
- Lossless optimization is safe to run repeatedly.
**Weaknesses:**
- Large files for photographic content.
- No animation (APNG exists but support is uneven).
- 8-bit-per-channel color ceiling sRGB without extensions.
A 1920x1080 screenshot of a UI is typically 300 to 800 KB as PNG but only 60 to 150 KB as a well-tuned WebP. Keep PNG for what you author; convert before serving when size matters.
WebP
WebP supports both lossy and lossless modes, alpha transparency, and animation in a single container.
**Best for:** photos and most general web imagery where you want a strong size/quality tradeoff with broad support.
**Strengths:**
- Lossy WebP is roughly **25 to 35 percent smaller** than JPEG at the same visual quality.
- Lossless WebP is typically **20 to 30 percent smaller** than PNG.
- Supports alpha and animation.
- Supported by 97 percent of global browsers, including all evergreen engines.
**Weaknesses:**
- Slower to encode than JPEG, especially at high quality.
- A few older image tools and CMS plugins still mishandle it.
- Lossy WebP is still lossy; not a source-of-truth format.
AVIF
AVIF is the most efficient mainstream image format today. It uses the AV1 codec's intra-frame compression.
**Best for:** bandwidth-critical photo delivery, hero images, product photos, and large editorial imagery.
**Strengths:**
- Often **20 to 30 percent smaller than WebP** and ~50 percent smaller than JPEG at similar quality.
- Supports 10- and 12-bit color, HDR, and wide gamut.
- Film grain synthesis handles noisy source material efficiently.
- Alpha channel and animation supported.
**Weaknesses:**
- Encoding is slow, especially on the CPU; many teams encode offline or via CDN.
- Multiple images in one AVIF can be slow to decode.
- Older Safari and some smart-TV browsers lack support, so a fallback is still required.
- Some older image editors cannot open or save AVIF directly.
Browser Support Snapshot
| Format | Chrome | Edge | Firefox | Safari | iOS Safari | Global support |
| PNG | Yes | Yes | Yes | Yes | Yes | ~100% |
| WebP | Yes | Yes | Yes | 14+ | 14+ | ~97% |
| AVIF | Yes | Yes | Yes | 16+ | 16+ | ~93% |
| JPEG | Yes | Yes | Yes | Yes | Yes | ~100% |
| JPEG XL | Partial | Partial | Off | No | No | Limited |
Treat these as a snapshot. Confirm current coverage on caniuse before you commit. Support for AVIF now includes Safari 16+ and recent iOS, so AVIF is safe for the vast majority of users in 2026; only very long-tail browsers need the fallback.
Compression Ratios: Real Numbers
A 1920x1080 photographic hero image, optimized for the same visual quality (roughly matched via SSIM):
| Format | Typical size | Notes |
| PNG (lossless) | 2.5 to 4 MB | Far too large for hero use |
| JPEG q80 | 250 to 350 KB | Legacy baseline |
| WebP lossy q80 | 180 to 250 KB | ~25 percent under JPEG |
| AVIF q60 | 120 to 180 KB | ~30 percent under WebP |
For a 512x512 logo with transparency:
| Format | Typical size | Notes |
| PNG 24-bit | 35 to 80 KB | Lossless, perfect edges |
| WebP lossless | 25 to 55 KB | Smaller, still lossless |
| AVIF lossless | 20 to 45 KB | Smallest lossless |
Numbers vary by content; photographic detail, gradients, and noise all change the math. The pattern is consistent: WebP beats the legacy formats, AVIF beats WebP, and PNG stays best for pixel-perfect graphics.
You can reproduce these on your own assets with the [image compressor](/en/image-compressor), which lets you compare formats side by side at a target quality.
Transparency and Animation
| Feature | PNG | WebP | AVIF |
| Lossless transparency | Yes | Yes | Yes |
| Smooth 8-bit alpha | Yes | Yes | Yes |
| Animation | APNG only | Yes | Yes |
| HDR / wide gamut | No | Partial | Yes |
If you need an animated replacement for GIF, WebP and AVIF both shrink file sizes dramatically versus GIF. Pick WebP if compatibility matters most, AVIF if size matters most.
Performance Impact on Page Load
Images are the largest share of most page weight, so format choice drives real performance. Switching a 350 KB JPEG hero to a 150 KB AVIF cuts roughly 200 KB off the largest contentful paint candidate. On a typical mobile connection that is a meaningful chunk of LCP time.
The compounding effects matter:
- Smaller images load faster, especially on mobile networks.
- Smaller payloads reduce server egress cost.
- Fewer bytes mean less decoding work, though AVIF decoding can be heavier per byte than WebP.
Core Web Vitals treat images as part of Largest Contentful Paint, so this work shows up directly in your field data.
When to Use Each Format
**Use PNG when:**
- The image has text, sharp edges, or geometric shapes.
- You need pixel-perfect transparency (logos, UI chrome).
- Source-of-truth lossless quality matters more than size.
**Use WebP when:**
- You want a safe default for photos and complex imagery.
- You need broad compatibility with one fallback.
- You are animating and AVIF support is a concern.
**Use AVIF when:**
- Bandwidth savings are critical (mobile, large catalogs, hero images).
- You can tolerate slower encoding and a WebP/PNG fallback.
- You want HDR or wide-gamut support.
How to Convert Between Formats
Three common paths:
1. **In-browser tools.** Drop an image into the [image compressor](/en/image-compressor) to compress and convert between PNG, WebP, AVIF, and JPEG without uploading to a server. Fast for one-offs and small batches.
2. **CLI tools.** `cwebp`, `avifenc`, ImageMagick, and `sharp` (Node) let you script conversions and tune quality per format.
3. **CDN transforms.** Cloudflare, Cloudinary, Imgix, Fastly, and Akamai can deliver AVIF or WebP automatically based on the browser's `Accept` header. This is the lowest-effort path at scale.
For source images that arrive in iPhone HEIC format, run them through a [HEIC converter](/en/heic-converter) before publishing.
Serving Modern Formats with Fallbacks
Use the `<picture>` element so browsers pick the best format they support:
<picture>
<source srcset="hero.avif" type="image/avif">
<source srcset="hero.webp" type="image/webp">
<img src="hero.jpg" alt="..." width="1920" height="1080" loading="lazy">
</picture>
Always include width and height to prevent layout shift, and keep a JPEG or PNG fallback as the final `<img>`.
Common Mistakes
- **Serving PNG for hero photos.** Easy 3 to 5x size penalty.
- **Forgetting the `<picture>` fallback.** AVIF breaks on a small but real share of browsers.
- **Omitting width and height.** Causes Cumulative Layout Shift.
- **Re-encoding lossy formats repeatedly.** Each save degrades quality; always re-encode from the source.
- **Using HEIC on the open web.** Patent and support issues; convert first.
- **Ignoring JPEG XL.** It is promising but not yet safe to ship without fallbacks; treat it as experimental.
The Verdict
Author in PNG and JPEG. Serve **AVIF first, WebP second, PNG/JPEG fallback**. Compress everything. The [image compressor](/en/image-compressor) handles format conversion and compression in one step, so you can ship small, sharp images without leaving the browser.