Hreflang Link Element
Last reviewed:
Add inside <head> on every page in the language/region set — one <link rel="alternate" hreflang="…"> per variant, plus a self-reference. Every page in the set must reference every other page, including itself, and the relationship is bidirectional: if /en/ points to /fr/, /fr/ must point back to /en/. Google ignores unconfirmed (non-bidirectional) hreflang declarations rather than partially honoring them.
HTML link element
<!-- In <head> of EVERY page in the hreflang set, including this page -->
<link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/en-gb/page/" />
<link rel="alternate" hreflang="en-us" href="https://example.com/en-us/page/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/page/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
HTTP header variant
Use for non-HTML files (PDFs, documents) or when you control HTTP response headers directly. Return the same Link: header from every URL in the set.
Link: <https://example.com/en/page/>; rel="alternate"; hreflang="en",
<https://example.com/de/page/>; rel="alternate"; hreflang="de",
<https://example.com/fr/page/>; rel="alternate"; hreflang="fr",
<https://example.com/>; rel="alternate"; hreflang="x-default"
XML sitemap variant
Preferred for CMS environments where editing <head> on every page is impractical. Each <url> block must include <xhtml:link> entries for every variant, including itself.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/en/page/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/page/" />
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/page/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>
<url>
<loc>https://example.com/de/page/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/page/" />
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/page/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>
</urlset>
Field notes
- Engine support: Google, Bing (since March 2019), and Yandex honor hreflang.
- Every page must self-reference and point to all others — a broken or missing back-link invalidates the entire set for the pages involved.
x-defaultmatches users whose language doesn’t match any explicit hreflang value; typically the language selector or the primary version.- Language code: ISO 639-1 (
en,de). Region code: ISO 3166-1 Alpha 2 (US,GB). A country code alone (hreflang="US") is invalid — the first value must be language. - All URLs must be fully-qualified including scheme.
- Pick one implementation method (HTML tag, HTTP header, or XML sitemap) and use it consistently — using all three triples the maintenance burden for no benefit.
- Missing self-reference is the most common failure mode. Incorrect region codes (
EU,UK) are silently ignored by Google.