Invalid Outgoing Hreflang Annotations: Fix Malformed Language Codes

No Comments
Invalid outgoing hreflang annotations: fix malformed language codes

What this check flags

SEO ProCheck detected outgoing hreflang annotations whose language-region codes are malformed — things like en-UK, gb, en_us, or a made-up region. Google validates every code against ISO 639-1 for language and ISO 3166-1 Alpha-2 for region; anything that fails is silently dropped, so the annotation does nothing and the intended market never gets its localized page.

Why the exact string matters

Hreflang codes look forgiving but aren't. The language must be a two-letter ISO 639-1 code, optionally followed by a hyphen and a two-letter ISO 3166-1 country code — and the country subtag is a country, not a language or a common abbreviation. The single most frequent mistake is en-UK: "UK" is not the ISO country code for the United Kingdom, GB is. Google reads en-UK, finds no matching region, and discards the row. The same fate meets an underscore instead of a hyphen, a three-letter code, an uppercase-only language, or a region attached to a language that can't take one.

A real failing example

Four of these five rows are invalid — and each fails for a different reason:

<link rel="alternate" hreflang="en-UK" href="https://example.io/uk/" />    <!-- UK is not a country code; use GB -->
<link rel="alternate" hreflang="en_us" href="https://example.io/us/" />    <!-- underscore; must be a hyphen -->
<link rel="alternate" hreflang="eng-ca" href="https://example.io/ca/" />   <!-- eng is ISO 639-2; hreflang uses 639-1 (en) -->
<link rel="alternate" hreflang="es-419" href="https://example.io/latam/" /><!-- 419 is a UN M49 region, unsupported by Google -->
<link rel="alternate" hreflang="de-de" href="https://example.io/de/" />    <!-- the only valid row -->

Corrected to codes Google accepts:

<link rel="alternate" hreflang="en-gb" href="https://example.io/uk/" />
<link rel="alternate" hreflang="en-us" href="https://example.io/us/" />
<link rel="alternate" hreflang="en-ca" href="https://example.io/ca/" />
<link rel="alternate" hreflang="es" href="https://example.io/latam/" />   <!-- generic Spanish instead of es-419 -->
<link rel="alternate" hreflang="de-de" href="https://example.io/de/" />
<link rel="alternate" hreflang="x-default" href="https://example.io/us/" />

The mistakes, spelled out

Invalid codeWhy it failsCorrect form
en-UKUK is not an ISO 3166-1 codeen-gb
en_usUnderscore separator; hyphen requireden-us
eng / eng-caThree-letter (ISO 639-2) languageen / en-ca
us aloneCountry with no language prefixen-us
es-419UN M49 region code, unsupportedes
zh-cmnExtra subtag Google ignoreszh or zh-cn

How to detect it

  1. Screaming Frog — Hreflang tab. Crawl and apply the Incorrect Language & Region Codes filter, which lists every annotation whose subtags don't validate. Export it, and note that Frog checks the syntax even when the URL resolves fine, so it catches codes GSC would just drop.
  2. Google Search Console. The legacy International Targeting report surfaces "unknown language code" and "no return tags for the specified language" — both are classic invalid-code symptoms. URL Inspection shows you the alternates Google actually accepted for a page, so anything missing there was rejected.
  3. An hreflang validator. Run the set through a validator such as the Hreflang Validator; it checks each subtag against the ISO lists and names the exact offending row. To avoid re-introducing typos, build fresh markup with the Hreflang Tag Generator.

How to fix it

  1. Pull every distinct hreflang value used across the site and check each against the ISO 639-1 language list and the ISO 3166-1 Alpha-2 country list.
  2. Replace abbreviations with real codes — the big one is UK → GB. Swap underscores for hyphens and trim any three-letter or M49 subtags.
  3. Decide, per market, whether you actually need a region subtag. If you serve all Spanish speakers one page, use bare es; don't invent es-419.
  4. Push the corrected codes through your single delivery method, keep the return tags consistent with the new keys, and re-crawl to confirm the Incorrect Language & Region Codes filter is empty.

If the mislabelled versions overlap with other flags, our writeups on unsupported or misconfigured hreflang and conflicting hreflang entries cover the neighbouring failure modes, and the hreflang implementation guide lists the accepted code format in full. Stick to one method for the whole set and never split it across head tags and a sitemap.

FAQ

Is the region subtag ever required?

No. Language alone (fr, de, ja) is valid and often preferable. Add a region only when you truly serve a country-specific page, because fr-ca and fr-fr then compete for the same speakers.

Does case matter?

Google is case-insensitive, so en-GB and en-gb both work. Pick one style and keep it consistent to make audits easier — but casing alone won't cause the flag.

Why is en-UK so common if it's wrong?

Because "UK" is the everyday abbreviation and feels obviously correct. ISO 3166-1 assigns the United Kingdom the code GB; UK is reserved but not the assigned Alpha-2 country code Google expects.

Can I use a script subtag like zh-Hant?

Google supports language plus country, not script subtags, for hreflang. Use zh-tw or zh-hk to target traditional-script markets rather than a script tag.

Claude Vincent is a technical SEO consultant focused on crawlability, rendering, and AI-search visibility. He writes the field guides and case studies at SEO ProCheck, with a bias toward the durable, unglamorous work that decides whether search engines and AI answer engines can actually read and cite a site.

About SEO ProCheck

Technical SEO consulting and GEO strategy with 20 years of enterprise experience. Case studies, resources, and tools for search and AI visibility.

Work With Me

Technical SEO audits, GEO strategy, site migrations, and international SEO. Hourly consulting for teams who need hands-on support, not just reports.

Subscribe to our newsletter!

More from our blog