Hreflang
Definition
An HTML attribute that tells search engines which language and region a page targets. Essential for websites serving multiple countries or languages.
What is Hreflang?
Hreflang is an HTML attribute that tells search engines which language and geographic region a page is intended for. It helps Google show the right version of your page to users based on their language settings and location.
If you have an English page for the UK and another for the US, hreflang ensures British searchers see the UK version and American searchers see the US version.
Hreflang Syntax
<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 format combines a language code (en, de, fr) with an optional region code (gb, us, de).
Common Hreflang Values
| Code | Target |
|---|---|
| en | English (any region) |
| en-gb | English (UK) |
| en-us | English (US) |
| de | German |
| fr-fr | French (France) |
| fr-ca | French (Canada) |
| x-default | Fallback/default version |
Why Hreflang Matters
Correct Localisation
Users see content in their preferred language and regional format (currency, spelling, etc.).
Avoiding Duplicate Content
Without hreflang, Google might see UK and US English pages as duplicates. Hreflang signals they're intentional variants.
Better User Experience
Visitors immediately get relevant content rather than being redirected or seeing the wrong version.
Implementation Methods
- HTML link elements in the page head
- HTTP headers (for PDFs and non-HTML files)
- XML sitemap entries
All page variants must reference each other – missing or inconsistent tags cause errors.