Seoxpert.io
mediumTechnical SEO

Invalid Hreflang Locale Values

Hreflang attributes with invalid locale values (such as malformed language or region codes) prevent search engines from correctly understanding your site's inte

By Seoxpert Editorial · Published · Updated

Why it matters

Hreflang tags are essential for international SEO, ensuring users see the correct language or regional version of your content. If locale values are invalid, search engines like Google may ignore all hreflang annotations on the page, causing users to be served the wrong version or reducing your site's visibility in international search results.

Impact

Invalid hreflang locale values can cause search engines to disregard your international targeting signals, leading to decreased relevance for users in specific regions or languages. This can result in lower click-through rates, increased bounce rates, and missed opportunities in international markets.

How it's detected

This issue is typically detected through SEO audits using tools like Google Search Console, Screaming Frog, or Sitebulb, which flag invalid hreflang values. Manual inspection of the page source or HTTP headers can also reveal malformed hreflang codes.

Common causes

  • Using underscores instead of hyphens (e.g., en_US instead of en-US)
  • Typos in language or region codes (e.g., 'en-UK' instead of 'en-GB')
  • Using non-existent or deprecated language/region codes
  • Omitting the region code when required for disambiguation
  • Incorrect placement of x-default value

How to fix it

Review all hreflang attributes and ensure they use valid BCP 47 language tags. Use hyphens to separate language and region codes (e.g., en-US, de-AT). Double-check for typos and confirm that all codes are valid and recognized. Use 'x-default' for the default page. Validate your hreflang implementation with tools like Google's International Targeting report or third-party validators.

Code examples

Incorrect hreflang with underscore and typo

<link rel="alternate" hreflang="en_US" href="https://example.com/en/" />
<link rel="alternate" hreflang="en-UK" href="https://example.com/uk/" />

Corrected hreflang with valid BCP 47 codes

<link rel="alternate" hreflang="en-US" href="https://example.com/en/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/" />

Incorrect: Non-existent region code

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

Correct: Valid language and region codes, including x-defaul

<link rel="alternate" hreflang="en-US" href="https://example.com/en/" />
<link rel="alternate" hreflang="de-AT" href="https://example.com/at/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

FAQ

What is a valid hreflang locale value?

A valid hreflang locale value is a language code (ISO 639-1) optionally followed by a region code (ISO 3166-1 Alpha 2), separated by a hyphen (e.g., en, en-US, de-AT). 'x-default' is also valid for specifying a default page.

Can I use underscores in hreflang values?

No, hreflang values must use hyphens to separate language and region codes (e.g., en-US, not en_US). Underscores are invalid and will cause the hreflang annotation to be ignored.

What happens if one hreflang value is invalid?

If any hreflang value is invalid, search engines may ignore the entire set of hreflang annotations for that page, not just the invalid one.

How can I check if my hreflang codes are valid?

You can use tools like Google Search Console's International Targeting report, or third-party validators such as Screaming Frog or Sitebulb, to check for invalid hreflang codes.

Is 'en-UK' a valid hreflang value?

No, 'en-UK' is not valid. The correct region code for the United Kingdom is 'GB', so use 'en-GB'.

Do I always need to specify a region code in hreflang?

No, the region code is optional unless you want to target a specific country. For general language targeting, use only the language code (e.g., 'en').

Found this issue on your site?

Run a scan to see if Invalid Hreflang Locale Values affects your pages.

Scan my website →