What Does "Invalid hreflang value" Mean?

Hreflang tags were found containing invalid values.

Hreflang is a way to tell search engines that there are multiple versions of a page in different languages. This will help search engines serve visitors the most appropriate version of each URL by language or region.

Here's an example of hreflang tags for https://example.com/en-us/products, which is an English page targeting visitors in the United States that also has an English version targeting United Kingdom, a French version, a German version, and a default version available:

<link rel="alternate" hreflang="en-us" href="https://example.com/en-us/products" />

<link rel="alternate" hreflang="en-gb" href="https://example.com/en-gb/products" />

<link rel="alternate" hreflang="fr" href="https://example.com/fr/products" />

<link rel="alternate" hreflang="de" href="https://example.com/de/products" />

<link rel="alternate" hreflang="x-default" href="https://example.com/products" />

There are two parts to an hreflang value: language in ISO 639-1 format (required) and region in ISO 3166-1 Alpha 2 format (optional), separated by a hyphen. When no language or region matches the user's browser setting, "x-default" is a valid hreflang value as well (even though it does not fit the language-region format).

Therefore, an hreflang value is considered valid if one of the following conditions are met:

  • It contains only a language and is in the ISO 639-1 format.

  • It contains a language and a region, the language is in the ISO 639-1 format, the region is in the ISO 3166-1 Alpha 2 format, and the language and region are separated with a hyphen.

  • It contains the value "x-default".

Why It's Important

If hreflang tags are set incorrectly, search engines may ignore the tag completely. If this happens, it's possible search engines will get confused and the wrong version of the page could be ranked in a particular region or language.

For example, visitors from the UK could be served links to the US version of the page on search engines, or visitors from France could be served links to the Switzerland version.

How To Fix

Take a look at each invalid hreflang value of each URL. Decide what the correct value should be by comparing it to ISO 639-1 and ISO 3166-1 Alpha 2 formats. Then visit the linking URL that contains this hreflang tag and modify the value to the correct value.

Hreflang can be complicated. We recommend carefully reading Google's guidelines on hreflang and testing thoroughly before implementing any changes.

Did this answer your question?