Hreflang Tags: A Complete Guide for Multilingual Sites
Hreflang annotations tell Google that several pages are language or regional versions of the same content, so Search can show each user the most suitable one. This guide covers when to use them, the three methods, the rules, language and region codes, x-default, common mistakes and testing.
- Three methods
- Reciprocal rules
- Valid codes
- x-default
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/"> <link rel="alternate" hreflang="x-default" href="https://example.com/">
Add hreflang with one of three equivalent methods: HTML link tags, an HTTP Link header, or an XML sitemap. Every version must list itself and every other version, with fully qualified URLs, and pages must link back to each other, or Google ignores the tags. Use a two-letter ISO 639-1 language code, optionally with an ISO 3166-1 Alpha-2 region, and consider an x-default fallback.
When to use hreflang
- Template-only translation: main content stays in one language; only navigation and footer are translated.
- Small regional differences: similar content aimed at different countries, such as English for the US, UK and Ireland.
- Full translation: every page exists in several languages.
Google may find alternates without annotations, but explicit ones are usually better. Translated pages count as duplicates only when their main content is not translated.
The three methods
| Method | Notes per Google |
|---|---|
| HTML link tags in head | Each variant carries the same set of links, including one to itself |
| HTTP Link header | Useful for non-HTML files such as PDFs; identical across all versions |
| XML sitemap | Each url entry lists all variants with xhtml:link; declare the xhtml namespace |
Google treats them as equivalent; using more than one gives no search benefit and makes maintenance harder. See sitemaps.
Rules for all methods
<link rel="alternate" hreflang="en" href="https://example.com/en/"> <link rel="alternate" hreflang="de" href="https://example.com/de/">
The snippet is an illustration of the pattern: both pages carry both lines.
Language and region codes
| Item | Rule |
|---|---|
| Language | Two-letter ISO 639-1 required |
| Region | Optional ISO 3166-1 Alpha-2 after a dash, such as en-GB |
| Scripts | ISO 15924 supported, such as zh-Hant |
| Region only | Invalid; Google does not infer language from a country |
| Reserved codes | EU, UN, UK ignored; GB is correct for the United Kingdom |
| Case | Case-insensitive |
x-default
It marks the fallback page for users whose language settings match none of your versions. It takes no language code, is designed for language selector pages but can be used on any page, and is added as one more link alongside the others. When several locales share a language, provide a generic page for that language.
Implement step by step
Map equivalent pages
One row per page, per language.
Choose valid codes
Language plus optional region.
Pick one method
HTML, header or sitemap.
List all versions
Including itself.
Add x-default
For a selector or home.
Validate
Check return links.
What Google does with hreflang
- It uses annotations to understand pages are variants of the same content and picks the variant based on browser language settings.
- It does not rely on hreflang or the HTML lang attribute to detect a page’s language.
- It ignores non-reciprocal tags and invalid or reserved codes, but still processes the valid parts.
- Canonical pages should match the language, or the closest substitute (canonicals).
Notes for WordPress sites
- Multilingual plugins often output hreflang automatically; check the page source (my own note).
- One method only: avoid plugin tags plus sitemap duplicates.
- Language switcher links should be real anchors (crawlable links).
- Translations: translate main content, not just templates.
Troubleshooting
| Symptom | Likely cause (my own diagnosis) | Action |
|---|---|---|
| Wrong version shown | Missing return links or bad codes | Validate set |
| Tags ignored | Not reciprocal | Add return links |
| UK version not matching | Used UK, not GB | Use en-GB |
| Canonical conflicts | Canonical points to another language | Self-canonical per version |
Checklist
Set
- Self-reference
- All versions listed
- Return links
- Absolute URLs
Codes
- ISO 639-1 language
- Valid region
- No UK or EU
- x-default decided
Method
- One method
- Consistent output
- Sitemap namespace
- Header for PDFs
Test
- Spot-check pages
- Canonicals match
- Tool validation
- Recheck after changes
What Google’s page does not say
It does not say whether hreflang directly affects rankings or only which variant is shown, any maximum number of alternates, how errors are reported in Search Console, how long changes take, trailing slash normalisation effects, or how conflicting entries are handled. Third-party validators exist but Google does not maintain or verify them.
Key terms
- hreflang
- Language and region annotation.
- x-default
- Fallback version.
- Reciprocal
- Pages link back to each other.
- ISO 639-1
- Two-letter language codes.
Common mistakes
Missing return links
Tags ignored.
Region-only codes
Invalid.
Using UK
Reserved, ignored.
Relative URLs
Not acceptable.
Multiple methods
No benefit, harder upkeep.
Untranslated pages
Count as duplicates.
Related guides
Hreflang questions
Do I need hreflang?
Google may find alternates anyway, but explicit annotations are usually better.
Which method is best?
Google treats all three as equivalent.
Must pages link back?
Yes; otherwise Google ignores the tags.
Can I use a country code alone?
No; the language is required.
Is es-419 supported?
Google says non-standard codes like es-419 are not supported.
What is x-default?
The fallback page for users matching no version.
Does hreflang boost rankings?
Google’s page does not say.
Does Google use the lang attribute?
No, it uses its own algorithms to detect language.
Methods, rules, codes, x-default and mistakes come from Google’s page. The step plan, WordPress notes, troubleshooting and checklists are my own.