Skip to content
Nazmul Nikhil
Menu

Hreflang Annotation Invalid (Ahrefs): Fix Wrong Language and Region Codes

Ahrefs flags hreflang values Google can't use, like en-UK or a region on its own. Here's the correct format and the most common mistakes.

Nazmul Nikhil

By

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

Published 1 min read
Hreflang Annotation Invalid (Ahrefs): Fix Wrong Language and Region Codes
Photo: Andrew Ruiz on Unsplash

In short

Ahrefs flags "Hreflang annotation invalid" when an hreflang value isn't a valid language code or language-region combination. Google requires an ISO 639-1 language code, optionally followed by an ISO 3166-1 Alpha 2 region code, such as en, en-US. A region code can't be used on its own. The classic mistake is en-UK; the UK's code is GB.

Hreflang values follow a strict format. One wrong code and Google ignores that annotation.

Valid and invalid examples

Value Valid? Why
en Yes Language only
en-GB Yes Language + region
x-default Yes Special fallback value
en-UK No UK isn't an ISO region code; use GB
us No Region only; needs a language (en-US)
eng No Three-letter language code
en_US No Underscore instead of hyphen
jp No Japanese is ja; JP is the country

es-419 (Spanish for Latin America) is a valid BCP 47 code but uses a numeric region. Google's documentation describes two-letter ISO region codes, so test carefully if you use it.

How to fix it

  1. Export the invalid values from Ahrefs.

  2. Correct each code in your plugin settings, templates or sitemap.

  3. Recrawl and check the annotations again.

WordPress: check language settings in WPML, Polylang or TranslatePress, where each language has a locale code.

Shopify: codes come from your Markets and language settings. Invalid codes are rare; check manually added tags in theme.liquid.

Webflow: check each locale's subdirectory and language settings in Localization.

Wix: check the language and region chosen for each language in Wix Multilingual.

Custom builds: keep a single list of locales in config and generate tags from it.

This guide isn't affiliated with or endorsed by Ahrefs.

Sources and references

TAGSAhrefs Site AuditHreflang annotation invalidInvalid hreflang codeEn-uk vs en-gb
Nazmul Nikhil

About the author

Nazmul Nikhil

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.

Need help with this?

Get it fixed with International SEO

I find the issues that cost you traffic and fix them, starting with the pages that matter most.

Keep reading

Related articles

All Site Audit Issues posts →

Get the next guide in your inbox

One email when a new SEO or AI search guide goes live.

Ready to grow?

Get a free audit of your website, or book a 30-minute call to talk through your goals.

Nazmul Hasan

Talk to Nazmul directly

Reply within 24h

WhatsApp +880 1682835118
nazmulnikhil@gmail.com