Image Formats
Each format has strengths. Choose based on content, not habit.
Best for: photographs, complex images
Lossy compression | No transparency
JPEG excels at photographs with smooth gradients and millions of colors. Quality 80-85% is usually indistinguishable from 100% but significantly smaller.
Key point: JPEG: photographs and complex gradients
Checkerboard = transparency
PNG supports alpha transparency and lossless compression. Use PNG-8 for simple graphics with few colors, PNG-24 for transparency needs.
Key point: PNG: transparency and sharp edges
25-35% smaller than JPEG
Lossy + Lossless + Transparency + Animation
WebP does it all - photos, transparency, and animation. Supported by 95%+ of browsers. Should be your default format for most images.
Key point: WebP should be your default format
Scales infinitely, tiny file size
SVG is code, not pixels. Perfect for icons, logos, and illustrations. Scales to any size without quality loss. Can be styled with CSS and animated.
Key point: SVG: icons, logos, simple illustrations
50% smaller than JPEG
Slower to encode | Growing browser support
AVIF offers best-in-class compression. Use with fallbacks via picture element. Worth implementing for high-traffic sites.
Key point: AVIF: best compression, use with fallbacks