BCP 47 validated · Canadian defaults
Hreflang Tag Generator
Generate valid hreflang tags for bilingual and multi-region sites. Built with the Canadian use case in mind: en-CA + fr-CA + x-default by default, with optional en-US for cross-border. Output as <link> tags, HTTP Link header, or XML sitemap.
Locale alternates
Each variant of this page in another language or region. Always include x-default.
Output
Three equivalent formats — pick whichever matches how you ship pages.
<link> tags (in <head>)
<link rel="alternate" hreflang="en-ca" href="https://example.com/" />
<link rel="alternate" hreflang="fr-ca" href="https://example.com/fr/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />HTTP Link header (for non-HTML)
<https://example.com/>; rel="alternate"; hreflang="en-ca", <https://example.com/fr/>; rel="alternate"; hreflang="fr-ca", <https://example.com/>; rel="alternate"; hreflang="x-default"XML sitemap excerpt
<?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/</loc>
<xhtml:link rel="alternate" hreflang="en-ca" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="fr-ca" href="https://example.com/fr/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>
<url>
<loc>https://example.com/fr/</loc>
<xhtml:link rel="alternate" hreflang="en-ca" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="fr-ca" href="https://example.com/fr/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>
<url>
<loc>https://example.com/</loc>
<xhtml:link rel="alternate" hreflang="en-ca" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="fr-ca" href="https://example.com/fr/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>
</urlset>Three rules that catch 90% of hreflang errors
- Hreflang must be reciprocal — if /en/ links to /fr/, /fr/ must link back to /en/.
- Use absolute URLs, not relative — Google's processor will silently drop relative refs.
- Always include x-default for the unmatched-locale fallback.