If your site serves the same content in multiple languages or regions, hreflang tells search engines which version to show which users. Done right, a French searcher lands on the French page and an American searcher on the US page. Done wrong, Google ignores it entirely — and it's surprisingly easy to do wrong.
What hreflang does
hreflang is a hint, not a redirect. It doesn't change what users see; it helps search engines choose the correct URL for a given language/region and prevents your translated pages from competing with each other as "duplicate content".
The syntax
You declare alternates with <link> tags in the <head> (you can also use HTTP headers or the XML sitemap). Each tag names a language, optionally a region, and the URL:
<link rel="alternate" hreflang="en" href="https://example.com/" />
<link rel="alternate" hreflang="uk" href="https://example.com/ua/" />
<link rel="alternate" hreflang="ru" href="https://example.com/ru/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
The value is an ISO 639-1 language code, optionally plus an ISO 3166-1 region: en, en-GB, en-US, pt-BR. Region is optional and should only be used when you genuinely have region-specific pages.
The three rules people break
- Reciprocity. If page A links to B as an alternate, B must link back to A. One-way hreflang is invalid and gets ignored. Every page in a set lists every version, including itself.
- Absolute URLs. Always use full
https://URLs, not relative paths. - Valid codes.
en-UKis wrong (the country code isGB). Made-up or misspelled codes silently break the whole set.
x-default
The special value x-default marks the fallback page for users whose language/region you don't explicitly cover — think of a language selector or your primary site. It's optional but strongly recommended: without it, search engines guess. If you only add one thing after your language tags, add x-default.
How to check it
Because the failure modes are silent, you need to verify — not assume. Check that every page lists all alternates, that they reciprocate, that codes are valid, and that x-default exists. SEO Inspector has a dedicated hreflang tab that lists every alternate on the current page and tells you whether an x-default is defined, so you can spot a broken set at a glance.