# Accept-Language Header — Syntax, Values & Examples

> The user's preferred languages, in order, from their browser settings.

Browsers build Accept-Language from the user's language settings — for example `en-GB,en;q=0.9,fr;q=0.8`. Servers can use it to choose a default language on a first visit. It's a hint, not a command: let users switch, and remember their choice.

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

## Syntax

```http
Accept-Language: <language-tag>[;q=<weight>], …
```

## Examples

```http
Accept-Language: en-GB,en;q=0.9,fr;q=0.8
```

British English, then any English, then French

```http
Accept-Language: de-DE,de;q=0.9,en;q=0.8
```

German first, English as a fallback

## Good to know

- Don't redirect on Accept-Language alone — someone on a borrowed or work computer gets the wrong language with no way out. Suggest a switch, and let a cookie or the URL override it.
- If one URL returns different languages, send `Vary: Accept-Language`; separate URLs per language (`/de/…`) are better for search engines.
- Googlebot usually crawls without Accept-Language, so content that depends on it may never be indexed.
- In the browser, `navigator.languages` gives JavaScript the same list.

## How to set Accept-Language

### fetch

```
await fetch("https://api.example.com/", {
  headers: { "Accept-Language": "en-GB,en;q=0.9,fr;q=0.8" },
});
```

### curl

```
curl -H 'Accept-Language: en-GB,en;q=0.9,fr;q=0.8' https://api.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

### What does q=0.9 mean?

It's a weight from 0 to 1 that ranks the languages; a language without q counts as 1. en-GB,en;q=0.9 means British English first, then any English.

## Related headers

- [Accept](https://www.devkult.com/headers/accept.md): Lists the response media types the client can handle, in order of preference.
- [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.
- [Content-Type](https://www.devkult.com/headers/content-type.md): States the media type of the body — HTML, JSON, form data, an image — and often its character encoding.

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