Images are usually the largest files on a web page, and the format you choose has a big effect on their size. Modern formats like WebP and AVIF can deliver the same visual quality as JPEG at a fraction of the size. This guide compares the main formats and explains how to serve them without breaking anything.
JPEG: the long-time standard
JPEG has been the standard for photographs for decades. It compresses photos well, is supported everywhere and can be adjusted for quality. Its weaknesses are no transparency support and visible artefacts at low quality settings.
JPEG remains a safe fallback format. Modern encoders such as MozJPEG produce smaller JPEGs than older tools at the same quality, so even if you keep JPEG, how you compress matters.
PNG: for graphics and transparency
PNG uses lossless compression, which keeps every pixel exact. It suits logos, icons, screenshots and graphics with sharp edges and flat colours, and it supports transparency. For photographs, PNG files are usually far larger than JPEG.
Many sites accidentally upload photos as PNG, creating huge files. Convert photographs to JPEG, WebP or AVIF. For logos and icons, consider SVG, which is often smaller and scales perfectly.
| Format | Best for | Transparency | Size |
|---|---|---|---|
| JPEG | Photos, fallback | No | Medium |
| PNG | Graphics, screenshots | Yes | Large for photos |
| WebP | Most images | Yes | Small |
| AVIF | Photos, max savings | Yes | Smallest |
| SVG | Logos, icons | Yes | Tiny |
WebP: the practical default
WebP, developed by Google, supports both lossy and lossless compression and transparency. Lossy WebP images are typically noticeably smaller than equivalent JPEGs, and lossless WebP is usually smaller than PNG. All modern browsers support it.
For most sites, WebP is the practical default today: wide support, good compression and fast encoding. WordPress supports WebP uploads, and optimisation plugins can convert existing images automatically.
AVIF: the smallest files
AVIF is a newer format based on the AV1 video codec. It often produces smaller files than WebP at the same quality, especially for photographs, and supports transparency and high dynamic range. Support is now available in all major modern browsers.
AVIF encoding is slower and more CPU-intensive, which matters when converting large libraries on a server. Some very fine details or gradients may look different at aggressive settings. Many sites serve AVIF where supported and WebP or JPEG as fallbacks.
SVG for logos and icons
SVG is a vector format, describing shapes rather than pixels. Logos, icons and simple illustrations in SVG are usually tiny and look sharp at any size. They can be styled with CSS and inlined in HTML to avoid extra requests.
SVG files from design tools often contain unnecessary data. Optimise them with tools such as SVGO. Be careful with SVG uploads from untrusted sources, since SVG can contain scripts; WordPress blocks SVG uploads by default for this reason.
Comparing quality and size
File size savings depend on the image and settings. Photographs benefit most from AVIF and WebP; simple graphics may compress better as PNG or SVG. Always compare visually at the size images are actually displayed, not zoomed in.
Use a quality setting that looks identical to the original at normal viewing size. For many photos, a WebP or AVIF quality around the middle of the range is enough. Test a few representative images before converting your whole library.
Serving modern formats on WordPress
WordPress can store and display WebP and AVIF images. Optimisation plugins such as ShortPixel, Imagify, EWWW and LiteSpeed Cache can create WebP or AVIF versions of uploads and serve them to supporting browsers, using picture elements or server rewrite rules.
Image CDNs can convert formats on the fly based on the browser’s Accept header. Check which approach works best with your host and caching setup. After enabling, verify in DevTools that images load in the new format.
Serving modern formats on Shopify
Shopify’s CDN automatically serves images in modern formats such as WebP and AVIF where browsers support them, as long as themes use Shopify’s image_url filter. You can upload JPEGs and PNGs and let Shopify handle conversion.
Focus on uploading images at sensible dimensions and using responsive sizes in the theme. See speeding up a Shopify store.
Fallbacks and compatibility
Although modern browsers support WebP and AVIF, some email clients, older systems and social media previews may not. Keep JPEG or PNG originals and use fallbacks where needed, such as in picture elements or for Open Graph images.
For social sharing images, JPEG or PNG is safest. For on-site images, modern formats with fallbacks give the best balance.
Beyond format: size and loading
The best format will not help if images are uploaded at five times the displayed size. Resize images to their display dimensions, use srcset for different screens and lazy-load images below the fold. See lazy loading images.
For stores, follow my image optimization guide for WooCommerce. Format, size and loading together determine image performance.
Getting help
Converting a large image library safely and configuring correct delivery is part of my speed optimization service. The result is usually a big reduction in page weight with no visible change.
For the wider plan, read how to speed up a WordPress website.
Key takeaways
- WebP is the practical default with wide support and good compression.
- AVIF often gives the smallest files but encodes more slowly.
- Use SVG for logos and icons, and never PNG for photographs.
- Resize and lazy-load images; format alone is not enough.
Frequently asked questions
Is AVIF better than WebP?
AVIF often produces smaller files at similar quality, but encoding is slower. Many sites serve both with fallbacks.
Does WordPress support WebP?
Yes. WordPress supports WebP uploads and display, and plugins can convert existing images.
Will WebP images work in all browsers?
All modern browsers support WebP. Keep fallbacks for older systems and some email clients.
Should I convert my logo to WebP?
SVG is usually better for logos. Use PNG or WebP only if SVG is not available.
Does Shopify convert images to WebP?
Yes. Shopify's CDN serves modern formats automatically when themes use its image filters.
