# Use WebP/AVIF if appropriate

- Check 16.03 · Images and multimodal search · Important
- Source: https://checklist-seo-geo.com/en/images-multimodal-search/use-webp-avif-if-appropriate
- Serve your images as WebP or AVIF with a JPEG fallback via picture, Apache, Nginx, Cloudflare, WordPress, Shopify or Next.js, and know when to keep JPEG.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/images-multimodal-search/use-webp-avif-if-appropriate.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

WebP and AVIF are image formats more recent than JPEG and PNG: at comparable visual quality, they produce much lighter files. All current browsers read them and Google Search indexes them. The task is to serve them to browsers that accept them, with a JPEG or PNG fallback for the others, and to keep the classic formats where they are still needed (social sharing image, Merchant Center feeds, emails). Expected result: the site's photos and illustrations go out as AVIF or WebP, with no broken image anywhere.

## Why it matters

Google states that its lossy WebP files are 25 to 34% smaller than comparable JPEGs, and that lossless WebP is 26% smaller than PNG. The Next.js documentation sums up the following gap: AVIF compresses about 20% better than WebP, but takes about 50% longer to encode. These figures vary widely from one image to another; measure on your own.

On the search engine side, Google Search indexes BMP, GIF, JPEG, PNG, WebP, SVG and AVIF images referenced in the `src` attribute of an `<img>`, and asks that the extension match the real format. It also points out that some crawlers do not understand `<picture>` or `srcset`: the `src` attribute of the `<img>` must always point to a valid image.

“If appropriate” is not a stylistic precaution. Some uses do not tolerate these formats:

| Use | Recommended format | Reason |
| --- | --- | --- |
| Photos and content visuals | AVIF or WebP, JPEG fallback | Maximum weight savings |
| Screenshots, flat-color illustrations | Lossless WebP or optimized PNG | Sharp text and edges |
| Logos, icons, simple diagrams | SVG | Vector, light, sharp at any size |
| Animations | MP4 or WebM video, otherwise animated WebP | An animated GIF often weighs several megabytes |
| Sharing image (`og:image`) | JPEG or PNG | Uneven support for recent formats across sharing platforms |
| Google Merchant Center feeds | JPEG, WebP or PNG | AVIF is not in the list of accepted formats |
| Emails | JPEG, PNG or GIF | Support for recent formats varies widely across email clients |

## What it improves

- **Page weight**: often the biggest gain in a performance audit.
- **LCP** (Largest Contentful Paint, display of the largest visible element): the main image downloads faster. See [optimize the LCP image without lazy loading](https://checklist-seo-geo.com/en/performance-core-web-vitals/optimize-lcp-image-without-lazy-loading).
- **Lighthouse audit**: the “Improve image delivery” insight lists fewer files.
- **Costs**: fewer bytes served by the host and the CDN (Content Delivery Network).
- **Google Images**: no direct effect on rankings; recent formats are simply indexed just like JPEG.

## How to check

Request an image while announcing AVIF and WebP support, as a browser does, then read the type returned:

```bash
curl -s -o /dev/null -D - -H "Accept: image/avif,image/webp,*/*" https://example.com/images/atelier.jpg | grep -i -E "^(content-type|vary|cf-polished|content-length):"
```

Compliant result with negotiation by the server or the CDN: `content-type: image/avif` or `image/webp`, with `vary: Accept`. With the `<picture>` element, the `.jpg` URL stays JPEG: this is normal, check the markup instead.

In the browser, Network tab, “Img” filter, “Type” column: photos should appear as `avif` or `webp`. The console lists images still served as JPEG or PNG:

```js
performance.getEntriesByType('resource')
  .filter((entry) => entry.initiatorType === 'img' && /\.(jpe?g|png)(\?|$)/i.test(entry.name))
  .map((entry) => `${Math.round(entry.encodedBodySize / 1024)} KB ${entry.name}`);
```

PageSpeed Insights, “Improve image delivery” insight, estimates the possible savings file by file. See [analyze PageSpeed Insights and Lighthouse](https://checklist-seo-geo.com/en/performance-core-web-vitals/analyze-pagespeed-insights-lighthouse).

## How to implement

### Before you start

Three methods, to choose according to your environment:

| Method | Principle | When to choose it |
| --- | --- | --- |
| `<picture>` element | The HTML offers AVIF, WebP and JPEG; the browser chooses | Code under your control, no transforming CDN; the safest |
| Conversion by the CDN or platform | Same URL, format chosen from the `Accept` header | Cloudflare, CloudFront, Shopify, Next.js: the simplest |
| Negotiation by the web server | The server serves `photo.jpg.webp` instead of `photo.jpg` | Existing site with templates that are hard to change |

Target markup with `<picture>`:

```html
<picture>
  <source type="image/avif" srcset="/images/atelier-800.avif 800w, /images/atelier-1600.avif 1600w" sizes="(max-width: 800px) 100vw, 800px">
  <source type="image/webp" srcset="/images/atelier-800.webp 800w, /images/atelier-1600.webp 1600w" sizes="(max-width: 800px) 100vw, 800px">
  <img src="/images/atelier-800.jpg" srcset="/images/atelier-800.jpg 800w, /images/atelier-1600.jpg 1600w" sizes="(max-width: 800px) 100vw, 800px"
       width="800" height="533" alt="TIG welding station in the workshop" loading="lazy" decoding="async">
</picture>
```

The `alt`, `width`, `height`, `loading` and `fetchpriority` attributes go on the `<img>`. A `<source>` element only accepts `width` and `height` for a crop that differs from the `<img>`. See [use srcset and sizes](https://checklist-seo-geo.com/en/images-multimodal-search/use-srcset-sizes).

Command-line conversion, with the official libwebp (`cwebp`) and libavif (`avifenc`) tools or ImageMagick:

```bash
cwebp -q 80 atelier.jpg -o atelier.webp
avifenc -q 60 atelier.jpg atelier.avif
magick atelier.jpg -quality 80 atelier.webp
```

Quality scales differ from one encoder to another: compare visually, for example in Squoosh, before rolling out a setting. See [compress images](https://checklist-seo-geo.com/en/images-multimodal-search/compress-images).

> **Warning:** behind a CDN, negotiation by the origin server is risky. If the CDN ignores the `Vary: Accept` header, it may cache the AVIF version and serve it to a browser that cannot read it. In that case, use `<picture>` or the CDN's conversion.

### Apache

Versions: Apache 2.4.

Negotiation method: generate `atelier.jpg.avif` and `atelier.jpg.webp` next to each `atelier.jpg`, then add to the `.htaccess` at the site root:

```apache
<IfModule mod_mime.c>
    AddType image/avif .avif
    AddType image/webp .webp
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTP_ACCEPT} image/avif
    RewriteCond %{REQUEST_FILENAME} \.(jpe?g|png)$
    RewriteCond %{REQUEST_FILENAME}.avif -f
    RewriteRule \.(jpe?g|png)$ %{REQUEST_URI}.avif [T=image/avif,L]

    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{REQUEST_FILENAME} \.(jpe?g|png)$
    RewriteCond %{REQUEST_FILENAME}.webp -f
    RewriteRule \.(jpe?g|png)$ %{REQUEST_URI}.webp [T=image/webp,L]
</IfModule>

<IfModule mod_headers.c>
    <FilesMatch "\.(jpe?g|png|avif|webp)$">
        Header merge Vary Accept
    </FilesMatch>
</IfModule>
```

In a `<VirtualHost>` block rather than an `.htaccess`, replace `%{REQUEST_FILENAME}` with `%{DOCUMENT_ROOT}%{REQUEST_URI}`, then run `sudo apachectl configtest && sudo systemctl reload apache2`. An image without a converted version keeps being served as JPEG or PNG.

### Nginx

Versions: Nginx 1.18 and later.

In the `http` context (for example `/etc/nginx/conf.d/images.conf`), choose the suffix according to the `Accept` header:

```nginx
map $http_accept $img_suffix {
    default        "";
    "~*image/avif" ".avif";
    "~*image/webp" ".webp";
}
```

Then in the site's `server` block:

```nginx
location ~* \.(?:jpe?g|png)$ {
    add_header Vary Accept;
    try_files $uri$img_suffix $uri =404;
}
```

The `map` expressions are tested in order: a browser that accepts AVIF receives `atelier.jpg.avif`. If that file is missing, Nginx serves the original, not the WebP version: generate both formats. The `mime.types` file shipped with Nginx contains the line `image/avif avif;` since version 1.21.4; on an older version or a file replaced by the distribution, check `/etc/nginx/mime.types` and add it if it is missing, then run `sudo nginx -t && sudo systemctl reload nginx`.

### Cloudflare

Versions: Cloudflare dashboard, Polish on Pro, Business and Enterprise plans, image transformations on all plans, November 2026.

Two features, without touching the templates:

- **Polish** (Pro, Business and Enterprise plans): in the domain, `Speed > Settings > Image Optimization` ([optimization](https://dash.cloudflare.com/?to=/:account/:zone/speed/optimization)), choose Lossless or Lossy, then enable WebP and AVIF. Polish keeps the same URLs and only serves these formats to browsers that announce them; it converts JPEGs to WebP only in Lossy mode. It skips images whose origin returns a `Vary` header other than `Vary: Accept-Encoding`: do not enable the Apache or Nginx negotiation described above at the same time.
- **Image transformations**: enable them for the zone in the account dashboard (`Images > Transformations`), then request images through a URL of the form `/cdn-cgi/image/width=800,format=auto/images/atelier.jpg`. `format=auto` serves the most efficient format accepted by the browser. Usage-based billing beyond a free volume: check the pricing.

Purge the cache after enabling them ([`Caching > Configuration`](https://dash.cloudflare.com/?to=/:account/:zone/caching/configuration), “Purge Everything”).

### AWS

Versions: AWS console (CloudFront, S3), Dynamic Image Transformation for Amazon CloudFront solution, November 2026.

**CloudFront** does not convert images on its own. Two options:

- Deploy the AWS “Dynamic Image Transformation for Amazon CloudFront” solution (formerly Serverless Image Handler), which resizes images and serves the format best suited to the browser from originals stored in S3.
- Generate the AVIF and WebP versions at build or upload time, and use `<picture>`.

**S3** serves the content type recorded at upload: specify it for recent formats.

```bash
aws s3 cp ./images/ s3://mon-bucket/images/ --recursive --exclude "*" --include "*.avif" --content-type image/avif
aws s3 cp ./images/ s3://mon-bucket/images/ --recursive --exclude "*" --include "*.webp" --content-type image/webp
```

If you negotiate the format at the origin, add the `Accept` header to the cache key of the CloudFront policy, otherwise a single version will be cached for all browsers.

### Plesk

Versions: Plesk Obsidian 18.0 for Linux.

On Plesk for Linux, Nginx often serves static files itself, before Apache: `.htaccess` rules then do not apply to images. In `Websites & Domains > your domain > Apache & nginx Settings`, check the “Serve static files directly by nginx” option: remove `jpg`, `jpeg` and `png` from the list so that Apache negotiation works, or prefer `<picture>` and a CMS plugin.

### Shared hosting

On Apache or LiteSpeed hosting (OVHcloud, o2switch, Ionos, Hostinger, most cPanel plans), the block from the Apache section works in `.htaccess`. Conversion happens before uploading the files or through a CMS plugin; if the server's image library does not support AVIF, stick with WebP.

### WordPress

Versions: WordPress 6.5 and later; Modern Image Formats plugin 2 (WordPress 6.9 and later).

WordPress accepts WebP uploads since version 5.8 and AVIF since 6.5, if the server's image library supports them. Check this in `Tools > Site Health > Info > Media Handling`.

To convert uploaded JPEGs automatically, there are three options:

- **Modern Image Formats plugin** from the WordPress Performance Team: it generates intermediate sizes as AVIF (or WebP if AVIF is not available), with a fallback option in `Settings > Media` and a `<picture>` element option. It only handles new uploads: regenerate thumbnails for existing images (`wp media regenerate`).
- **Custom filter**, without a plugin: intermediate sizes are produced as AVIF, the original is kept.

```php
add_filter('image_editor_output_format', function (array $formats): array {
    $formats['image/jpeg'] = 'image/avif';

    return $formats;
});
```

- **Optimization plugins** (Converter for Media, EWWW Image Optimizer, ShortPixel, Imagify): they also convert the existing media library and serve the new formats through `.htaccess` rewriting or `<picture>`. Only one conversion plugin at a time.

### Shopify

Versions: Online Store 2.0 themes, Liquid, all Shopify plans, November 2026.

Automatic. Shopify's CDN detects the formats the browser accepts (WebP, AVIF) and picks the most suitable one, provided the image is requested through the `image_url` filter. This filter's `format` parameter only accepts `jpg` and `pjpg`: do not use it, except to force JPEG in a specific case.

### PrestaShop

Versions: PrestaShop 1.7 to 9.

#### PrestaShop 8.1 to 9

PrestaShop itself generates the AVIF and WebP versions of each image type:

1. On PrestaShop 8.1 and 8.2 only, first enable the “Multiple image formats” feature in `Advanced Parameters > New & Experimental Features`: it is disabled by default. On PrestaShop 9, the option is available directly.
2. In `Design > Image Settings`, check AVIF and WebP among the formats to generate, then save.
3. At the bottom of the same page, regenerate thumbnails to convert existing images.

The Classic theme of these versions already offers the generated formats in a `<picture>` element, with JPEG as the fallback; so does Hummingbird. An older third-party theme must be adapted in the same way.

#### PrestaShop 8.0 and 1.7

The core only generates JPEG or PNG. Use a conversion module, which rewrites URLs or modifies templates, or a CDN that converts images on the fly.

### Magento

Versions: Magento Open Source and Adobe Commerce 2.4.

Magento Open Source does not convert catalog images to WebP or AVIF by itself: use a converting CDN or a module. On Adobe Commerce on cloud infrastructure, Fastly image optimization can handle it, depending on your contract.

### Drupal

Versions: Drupal 10 and 11 (AVIF from Drupal 11.2).

In `Configuration > Media > Image styles`, add the “Convert” effect to each style with the `webp` extension, or `avif` from Drupal 11.2 if PHP's GD library can encode that format (the site's status report flags it otherwise). The core Responsive Image module then produces a `<picture>` element from these styles.

### Wix

Versions: Wix Editor and Wix Studio, Squarespace 7.1, November 2026.

Automatic: the platform converts images and serves them in a format suited to the browser. Squarespace also optimizes images on delivery. There is nothing to configure; upload good-quality originals.

### Webflow

Versions: Webflow Designer, all plans, November 2026.

In the Assets panel, select the images and run the conversion offered (WebP, or even AVIF depending on your account). Keep social sharing images as JPEG or PNG.

### Laravel

Versions: Laravel 11 to 13, Intervention Image 3 and 4.

Generate the variants on upload with Intervention Image. The API changed between versions 3 and 4: check the installed version with `composer show intervention/image`. Run this processing in a queued job: AVIF encoding is slow.

#### Intervention Image 4

```php
use Intervention\Image\Drivers\Gd\Driver;
use Intervention\Image\ImageManager;

$manager = ImageManager::usingDriver(Driver::class);

$image = $manager->decodePath(storage_path('app/public/images/atelier.jpg'))->scaleDown(width: 1600);

$image->save(storage_path('app/public/images/atelier.avif'), quality: 60);
$image->save(storage_path('app/public/images/atelier.webp'), quality: 80);
```

The destination file's extension determines the format: version 3's `read()`, `toAvif()` and `toWebp()` are replaced by `decode…()` and `save()` or `encodeUsingFormat()`.

#### Intervention Image 3

```php
use Intervention\Image\Drivers\Gd\Driver;
use Intervention\Image\ImageManager;

$manager = new ImageManager(new Driver());

$image = $manager->read(storage_path('app/public/images/atelier.jpg'))->scaleDown(width: 1600);

$image->toAvif(60)->save(storage_path('app/public/images/atelier.avif'));
$image->toWebp(80)->save(storage_path('app/public/images/atelier.webp'));
```

### Next.js

Versions: Next.js 15 and 16 (App Router and Pages Router).

`next/image` chooses the format from the `Accept` header. By default, it only produces WebP; add AVIF in `next.config.js`:

```js
module.exports = {
  images: {
    formats: ['image/avif', 'image/webp'],
  },
};
```

Order matters: the first format accepted by the browser is served. With a static export (`output: 'export'`), the optimizer is not available: generate the formats at build time.

### Nuxt

Versions: Nuxt 3 and 4, @nuxt/image module 1 and 2.

With Nuxt Image, `NuxtPicture` produces a `<picture>` element with several formats:

```html
<NuxtPicture src="/images/atelier.jpg" format="avif,webp" width="800" height="533"
             alt="TIG welding station in the workshop" loading="lazy" />
```

### Astro

Versions: Astro 5 to 7.

The `Image` component produces WebP by default. To offer AVIF with a fallback, use `Picture`:

```html
---
import { Picture } from 'astro:assets';
import atelier from '../assets/atelier.jpg';
---
<Picture src={atelier} formats={['avif', 'webp']} alt="TIG welding station in the workshop" />
```

## Common mistakes

- **Removing the JPEG fallback**: `<picture>` without a valid `<img src>`, or `src` pointing to an AVIF, and some crawlers or older browsers no longer get an image.
- **Negotiating at the origin behind a CDN** that ignores `Vary: Accept`: a browser receives a format it cannot read.
- **Switching the logo or diagrams to WebP** when an SVG would be lighter and sharper.
- **Making the `og:image` an AVIF**: the sharing preview may not display on some platforms.
- **Sending AVIF files in the Merchant Center feed**: the format is not accepted.
- **Stacking a conversion plugin, Polish and server negotiation**: three conversions, images recompressed twice and conflicting `Vary` headers.

## Frequently asked questions

### WebP or AVIF: which one should I choose?

Both, with a JPEG fallback. AVIF generally compresses better than WebP, at the cost of slower encoding; WebP remains an excellent second choice. With a picture element, the browser takes the first format it can read. If you can only generate one, WebP is the simplest to produce, and almost every CMS, CDN and conversion tool supports it.

### Does Google index WebP and AVIF images?

Yes. Google Search indexes BMP, GIF, JPEG, PNG, WebP, SVG and AVIF images referenced in the src attribute of an img element. It asks that the file extension match its real format, and points out that some crawlers do not read picture or srcset: always keep a src attribute that points to a valid image, preferably a JPEG for the fallback.

### Should the og:image be converted to WebP?

No, keep it as JPEG or PNG. The social network and messaging platforms that generate link previews do not all support recent formats in the same way, and a preview without an image costs clicks. The weight savings are pointless here: this image is not displayed in the page, it is only downloaded by sharing platforms.

### My site is on Shopify or Wix: do I need to convert my images?

No. Shopify and Wix convert images themselves and serve them in the format best suited to the browser. On Shopify, all you need to do is request images through the image_url filter in the theme, without forcing a format. Your job is to upload good-quality originals at the right dimensions and to fill in the alt text.

## Resources

- [Google Search Central: image SEO best practices (supported formats)](https://developers.google.com/search/docs/appearance/google-images)
- [Google: WebP format](https://developers.google.com/speed/webp) and [libavif](https://github.com/AOMediaCodec/libavif)
- [MDN: image file type and format guide](https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Formats/Image_types)
- [web.dev: choose the right image format](https://web.dev/articles/choose-the-right-image-format)
- [Can I use: AVIF](https://caniuse.com/avif)
- [Cloudflare: Polish compression](https://developers.cloudflare.com/images/polish/compression/) and [transform via URL](https://developers.cloudflare.com/images/transform-images/transform-via-url/)
- [AWS: Dynamic Image Transformation for Amazon CloudFront](https://docs.aws.amazon.com/solutions/dynamic-image-transformation-for-amazon-cloudfront/)
- [WordPress: AVIF support in 6.5](https://make.wordpress.org/core/2024/02/23/wordpress-6-5-adds-avif-support/) and [Modern Image Formats](https://wordpress.org/plugins/webp-uploads/)
- [Shopify: image_url filter](https://shopify.dev/docs/api/liquid/filters/image_url)
- [Next.js: image format configuration](https://nextjs.org/docs/app/api-reference/components/image)
- [Google Merchant Center: image requirements](https://support.google.com/merchants/answer/6324350)

Next steps: [compress images](https://checklist-seo-geo.com/en/images-multimodal-search/compress-images) and [size images appropriately](https://checklist-seo-geo.com/en/images-multimodal-search/size-images-appropriately).
