---
title: auto
summary: null
url: https://www.fastly.com/documentation/reference/io/auto
---


Enables optimizations based on [content negotiation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation).

The only negotiated optimizations currently available are for [AVIF](https://aomediacodec.github.io/av1-avif/) and [WebP](https://en.wikipedia.org/wiki/WebP), both image compression formats with limited browser support.

This functionality is also possible using [`format=auto`](/reference/io/format) which adds additional support for JPEGXL output.

## Syntax

```text
auto={value}
```

## Allowed values

|Value	|Description|
|-------|-----------|
|`avif`| If the browser's `Accept` header indicates compatibility, deliver an AVIF image. |
|`webp`| If the browser's `Accept` header indicates compatibility, deliver a WebP image. |

## Notes

1. Although the AVIF and WebP formats produce images at a higher compression ratio with a lower loss of quality compared to JPEG, they are not supported in all browsers.
1. When using Firefox version 66 to 71, automatic content negotiation will not occur when navigating to the image. To view WebP or AVIF images generated via `auto=avif` or `auto=webp` you must insert your image onto a web page.
1. AVIF is a premium feature of Fastly's Image Optimizer and choosing it as an encoding format will increase your bill. Charges will appear on your service order.
1. [`format=auto`](/reference/io/format) will take precedence if combined with `auto`.

## Examples

Click the links to view the transformed image using a demo Fastly IO service.

|Example usage|Description|
|-----------|-------------|
|[`?auto=avif`](https://www.fastly.io/image.png?auto=avif)|Deliver lossy AVIF from the lossless input image where client support is available, otherwise deliver a PNG|
|[`?auto=webp`](https://www.fastly.io/image.png?auto=webp)|Deliver lossless (because input image is lossless) WebP where client support is available, otherwise deliver a PNG|
|[`?format=pjpg&auto=webp`](https://www.fastly.io/image.jpg?format=pjpg&auto=webp)|Deliver lossy (because `format=pjpg` is lossy) WebP where client support is available, otherwise deliver a progressive JPEG|
|[`?format=png&auto=webp`](https://www.fastly.io/image.png?format=png&auto=webp)|Deliver lossless (because `format=png` is lossless) WebP where client support is available, otherwise deliver a PNG|

## Multiple format selection

Browsers that do not support AVIF may support WebP. You may wish to select from more than one possible negotiated format, based on browser support and a prioritized list of formats in a preferred order. Often this is AVIF, then WebP, then JPEG. This can be achieved by adding some custom VCL to your service:

```vcl context="sub vcl_recv { ... }"
if (querystring.get(req.url, "auto") == "avif,webp") {
  if (req.http.Accept ~ "\bimage/avif\b") {
      set req.url = querystring.set(req.url, "auto", "avif");
  } elsif (req.http.Accept ~ "\bimage/webp\b") {
      set req.url = querystring.set(req.url, "auto", "webp");
  }
}
```
