ubricHelp

What are valid hreflang codes?

Rubric check: invalid hreflang codes (check id hreflang_invalid)

A valid hreflang code is an ISO 639-1 language code, with an optional ISO 3166-1 region after it, such as en, en-GB or fr-CA, or the special value x-default. Google ignores codes that don't follow this, such as en-UK.

Free, no card. Your report opens with this check first.

Why it matters for SEO

Hreflang tells Google which language or country version of a page to show each searcher. An invalid code is skipped, so the wrong version may rank in that country, or two versions may compete. Common mistakes are en-UK (the UK's code is GB), a region on its own like GB, and underscores like en_GB.

Does this matter for ChatGPT and AI Overviews?

There's no public evidence that AI search tools read hreflang directly. They do draw on search indexes that use it, so correct codes help the right language version get indexed and shown. Like all hreflang checks, this only applies to sites in more than one language.

How Rubric scores it

StandardStandard checks are the baseline every other tier is measured against.

Why this tier: Invalid codes are ignored.

It is judged on every page Rubric scores. It is only judged on sites with more than one language.

Every Rubric score starts at 100. When this check fails, it takes up to 12 points off. Even one failing page costs at least 6 points (half of the most), and the rest comes off as the share of affected pages grows. A warning costs less than a failure.

This check doesn't cap your score. It only takes off its own points.

From the engine's scoring files, scoring 2026-v2.1 (engine d5c591d).

How common it is

Found on 2 of 95 sites where Rubric could judge it (2.1%). That is 2 of 91 judged sites in Rubric's 313-site test set and 0 of 4 sites audited on Rubric between 11 Nov 2026 and 17 Nov 2026 under the current check rules (scoring 2026-11k or later). Measured 17 Nov 2026 with scoring 2026-v2.1.

2.1% of the sites Rubric could judge have this problem. Check yours.

Free, no card. Your report opens with this check first.

How accurate the check is

Lab test: passed. On test pages built with this problem, it caught 4 of 4. On clean test pages, it stayed quiet 1 of 1 times. (Engine build bbcec7c.)

Real sites: people checked 5 of its findings by hand and 0 were wrong (0%). Last checked 14 Nov 2026. That's a small sample, so treat the rate as rough.

Latest review round: 0 of 3 findings judged were still wrong after the last fix.

Lab as of 16 Nov 2026; judged findings as of 15 Nov 2026.

How to fix it

WordPress

  1. In WPML, check each language's code and locale under WPML > Languages > Edit Languages.
  2. In Polylang, check Languages > Languages: the Language code and Locale fields drive the hreflang output.
  3. If a plugin or theme adds hreflang by hand, fix the codes there. View the page source and search for hreflang to confirm.

Shopify

Shopify adds hreflang for you when you sell in several languages or markets with Shopify Markets, using valid codes.

  1. If Rubric reports invalid codes, look for an app or theme snippet adding its own hreflang tags in Online Store > Themes > Edit code.
  2. Remove or fix that extra code so only Shopify's tags remain.

Webflow

Webflow Localization adds hreflang for you from the locales you set.

  1. Check each locale's language and region in Site settings > Localization.
  2. If you added hreflang tags in custom code, remove them or fix the codes. Publish.

Custom code

Use a language code, optionally a hyphen and a region code:

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

The language comes first and the region second. GB, en_GB and en-UK are all invalid.

More hreflang checks · The full AI SEO glossary

Free, no card. Your report opens with this check first.