Accept-Language header

On this page 6

The Accept-Language header is an HTTP request header in which a browser or other client lists the human languages its user prefers, ranked by weight, so that a server can choose a suitable language version of a resource. In international SEO, it matters because sites often use it for automatic language detection, and that practice can hide language versions from search engine crawlers.

The header belongs to HTTP content negotiation, defined in the HTTP Semantics specification, and uses BCP 47 language tags such as en-US or de. It describes the user’s settings, not the user’s location, which makes it a more precise language signal than an IP address but still an unreliable basis for serving search engines.

How the Accept-Language header works

Each request from a browser typically carries a line such as Accept-Language: de-CH, de;q=0.9, en;q=0.7, fr;q=0.5. The browser builds this list from the language preferences in the browser or operating system, and the server may use it to select one representation among several. This process is called proactive, or server-driven, content negotiation.

Every entry can carry a quality value, written q, between 0 and 1 with up to three decimals. Entries without q default to a weight of 1, and a weight of 0 means the language is not acceptable. The table below breaks down the parts of a typical value.

ComponentExampleMeaning
Primary language subtagdeGerman in any region
Region subtagde-CHGerman as used in Switzerland
Script subtagzh-HantChinese written in traditional characters
Quality valueq=0.7Relative preference from 0 to 1
Wildcard*Any language not otherwise listed
Components of an Accept-Language value

When a server honors the header, it should return a Content-Language header describing the chosen version and a Vary: Accept-Language header, which tells caches and content delivery networks that the response differs by requested language. Omitting Vary can cause a cache to serve one language to every visitor.

Why search engines rarely send Accept-Language

Search engine crawlers are not human users with language settings. Googlebot generally crawls without an Accept-Language header and mostly from IP addresses in the United States, so a server that negotiates language may always deliver its default version to the crawler. Other versions then remain uncrawled and unindexed.

For this reason, Google recommends separate URLs for each language version, connected by hreflang annotations, rather than locale-adaptive pages that change content on a single URL. Search engines can only rank what they can retrieve at a stable address, and a URL whose content depends on request headers offers no stable address for each language.

The comparison below places the header among other signals used in international targeting.

SignalSet byWhat it indicatesRole for search engines
Accept-Language headerUser’s browserPreferred languagesGenerally not used for ranking
Content-Language headerServerLanguage of the responseMinor hint for some engines, not Google
hreflang annotationsSite ownerAlternate language and region URLsPrimary method for alternates
Geo-IP lookupServer or CDNApproximate visitor locationRisky when used for redirects
URL structureSite ownerccTLD, subdomain or subdirectoryStrong, stable targeting signal
Language and location signals in international SEO

Safe and unsafe ways to use the header

Using Accept-Language is not wrong in itself; the risk lies in forced redirects and content swapping. The safest pattern is to keep every language version on its own crawlable URL and use the header only to suggest a more suitable version through a dismissible banner or a language selector.

PatternUser experienceSEO effect
Suggestion bannerUser chooses and can dismissSafe, all versions remain crawlable
Redirect only on the homepage rootFast routing for new visitorsAcceptable with an x-default page and hreflang
Forced redirect on all URLsNo access to other languagesHides alternates from crawlers
Locale-adaptive content on one URLSeamless for some usersTypically only one version gets indexed
Remembered manual choiceRespects explicit preferenceSafe when stored in a cookie, not forced
Implementation patterns and their SEO effect
  • Never redirect crawlers differently from users, because that resembles cloaking.
  • Let an explicit user choice override the header, since many people browse with a default English setting.
  • Return Vary: Accept-Language whenever the response truly varies by header.
  • Keep the x-default URL neutral, for example a language selection page.

Common mistakes and how to diagnose them

Problems with the Accept-Language header usually surface as missing language versions in the index or users trapped in the wrong language. Diagnosis starts with requesting the same URL with and without the header, for example using curl with a custom header, and comparing status codes, redirects and the HTML lang attribute.

SymptomLikely causeFix
Only English pages indexedDefault version served when header is absentGive each language its own URL
Wrong language in cached pagesMissing Vary header at the CDNAdd Vary or separate cache keys
Users cannot reach other versionsForced redirect on every requestReplace with a banner and selector
hreflang errors in reportsAlternate URLs redirect elsewhereMake alternates return status 200
Mismatched language in snippetsContent swapped on a single URLStop locale-adaptive serving
Symptoms, causes and fixes

A frequent misconception is that the header reveals the visitor’s country. A tag such as en-US reflects a configured preference, often a factory default, so a traveler, an expatriate or a multilingual household can send values that contradict their location. Treat the header as a hint about language, never about geography.

Put simply

Every time a browser asks a website for a page, it quietly mentions which languages its user likes to read, in order of preference. That short note is the Accept-Language header.

A website can use the note to offer the right language, which is helpful. The trouble starts when a site forces everyone into one language automatically. Search engine robots usually do not send the note at all, so they may only ever see one version. The best approach is to suggest, not force, and to give every language its own web address.

In practice

An outdoor equipment retailer runs a site in English, German and French on separate subdirectories. A developer adds a rule that redirects every visitor to the version matching the first entry in their Accept-Language header. Within six weeks, the German and French sections lose most of their impressions, because the crawler, which sends no header, is redirected to English pages from every alternate URL.

The SEO team removes the forced rule, keeps all three versions reachable at their own URLs, and adds a dismissible banner that suggests the matching language. They also correct the hreflang annotations and set the language selector page as x-default. After recrawling, the German and French pages return to the index, and non-English organic clicks recover to earlier levels within about two months.