Image Formats Explained: JPEG, PNG, WebP, AVIF

Picking the right image format is one of the highest-leverage performance decisions you can make. The wrong format wastes bandwidth, slows pages, and degrades visual quality. This guide compares the major web image formats and gives you a decision framework.

Format Comparison

FormatTypeTransparencyBest forNotes
JPEGLossy bitmapNoPhotographsUniversal support; tunable quality
PNGLossless bitmapYesScreenshots, icons, line artLarger files; perfect for sharp edges
WebPLossy or losslessYesMost web images25-35% smaller than JPEG/PNG
AVIFLossy or losslessYesHero images, large assets~50% smaller than JPEG
SVGVector XMLYesLogos, icons, illustrationsInfinite scale; CSS-stylable
GIFLossless animation1-bitLegacy onlyMP4/WebM almost always better

The Decision Framework

  1. Is it a logo, icon, or geometric illustration? → SVG.
  2. Does it need to be a small animation? → MP4 or WebM, not GIF.
  3. Is it a photograph or photographic asset? → AVIF primary, WebP fallback, JPEG for legacy.
  4. Does it need transparency or pixel-perfect edges (screenshots, UI assets)? → WebP lossless primary, PNG fallback.
  5. Is it a complex composite that needs both? → Use <picture> with AVIF → WebP → JPEG/PNG fallback.

The <picture> Pattern

<picture>
  <source srcset="hero.avif" type="image/avif">
  <source srcset="hero.webp" type="image/webp">
  <img src="hero.jpg" alt="..." width="1600" height="900" loading="lazy">
</picture>

Browsers pick the first supported format. Always include the img as the last child — it's the universal fallback and the element actually rendered.

Typical Savings

  • JPEG → WebP: 25-35% smaller at same visual quality.
  • JPEG → AVIF: 40-55% smaller at same visual quality.
  • PNG → WebP lossless: 25% smaller.
  • GIF animation → MP4: 80-95% smaller.

Try It Yourself

Resize and crop images for web with DesignKit's image tools.

Image Resizer →

Frequently Asked Questions

JPEG for photos; PNG for screenshots, icons, line art, or anything needing transparency.
Yes — universal support and 25-35% smaller than JPEG/PNG. Serve with JPEG/PNG fallback via <picture>.
Newest format; ~50% smaller than JPEG. Now widely supported. Use for hero images with WebP/JPEG fallback.
Always for logos, icons, illustrations. Infinite scale; not for photos.
Rarely. MP4/WebM are 5-10x smaller for animation.