By SitemapFixer Team
Updated April 2026

Hreflang in Your Sitemap: International SEO Done Right

Validate your international sitemap freeCheck My Sitemap

Hreflang is an HTML attribute that tells Google which language and regional audience a page is intended for. If your site has content in multiple languages or targets different countries with the same language (like US English vs UK English), hreflang prevents the wrong version from appearing in search results for users in each region.

Three Ways to Implement Hreflang

You can implement hreflang in three places: in the HTML head of each page, in the HTTP headers, or in your XML sitemap. The sitemap approach is often easiest for large sites since you manage it in one place rather than on every page. All three methods work equally well - choose one and be consistent.

Hreflang in Your XML Sitemap

Add xhtml:link tags inside each url entry. Every language version of a page must include hreflang entries for all other language versions, including itself:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://yoursite.com/en/page</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://yoursite.com/en/page"/>
<xhtml:link rel="alternate" hreflang="de" href="https://yoursite.com/de/page"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://yoursite.com/en/page"/>
</url>
<url>
<loc>https://yoursite.com/de/page</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://yoursite.com/en/page"/>
<xhtml:link rel="alternate" hreflang="de" href="https://yoursite.com/de/page"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://yoursite.com/en/page"/>
</url>
</urlset>

The x-default Tag

The x-default hreflang value specifies the fallback page for users who do not match any of your specific language or region targets. Point it to your most general version - usually your English homepage or a language selection page. Every set of hreflang annotations should include x-default.

Common Hreflang Mistakes

Missing return tags: If your English page points to your German page but your German page does not point back to the English page, Google ignores the entire hreflang setup. Every page in a group must reference every other page in the group.

Wrong language codes: Use ISO 639-1 language codes (en, de, fr, es) and ISO 3166-1 Alpha-2 region codes (US, GB, DE). The format is language-REGION, for example en-US or en-GB. Using incorrect codes means Google silently ignores your annotations.

Pages returning non-200: If a page referenced in hreflang redirects or returns an error, Google may ignore the entire hreflang group for that page. All hreflang URLs must return 200 status codes.

Check your international sitemap setup
Free analysis in 60 seconds
Analyze My Sitemap Free

Related Guides