# Accept-Encoding Header — Syntax, Values & Examples

> Lists the compression formats the client can decompress, so the server can pick one.

Accept-Encoding is the request half of compression negotiation. The server picks one of the listed encodings, compresses the body and labels it with `Content-Encoding` — or sends it uncompressed if nothing matches.

- Type: Request header
- Category: Content
- Defined in: [RFC 9110 §12.5.3 — Accept-Encoding](https://www.rfc-editor.org/rfc/rfc9110.html#section-12.5.3)

## Syntax

```http
Accept-Encoding: <encoding>[;q=<weight>], …
```

## Examples

```http
Accept-Encoding: gzip, deflate, br, zstd
```

what current browsers send

```http
Accept-Encoding: identity
```

no compression, please

## Good to know

- Browsers only advertise `br` and `zstd` over HTTPS.
- curl sends no Accept-Encoding by default; `curl --compressed` adds one and decompresses the result.

## Who sets Accept-Encoding

Browsers and most HTTP clients send Accept-Encoding and decompress responses for you. To test compression, set it explicitly: `curl -sI -H "Accept-Encoding: br, gzip" https://example.com/`.

## Check it

In the browser, open DevTools → Network, pick a request and look under Request Headers. From the command line, curl's verbose mode prints every header it sends, prefixed with `>`:

```sh
curl -sv https://example.com/ -o /dev/null 2>&1 | grep '^>'
```

## FAQ

### Do I need to set Accept-Encoding in fetch?

No — browsers and Node.js's fetch set it themselves and decompress transparently. In browsers it's a forbidden header that scripts can't change.

## Related headers

- [Content-Encoding](https://www.devkult.com/headers/content-encoding.md): Says how the body was compressed — gzip, Brotli or zstd — so the client can decompress it.
- [Vary](https://www.devkult.com/headers/vary.md): Lists the request headers that change the response, so caches keep a separate copy for each variant.
- [Accept](https://www.devkult.com/headers/accept.md): Lists the response media types the client can handle, in order of preference.

Open the interactive page: https://www.devkult.com/headers/accept-encoding