Home / Web tools / Hreflang & Canonical Tag Generator

Hreflang & Canonical Tag Generator

SEO

Generate valid HTML hreflang alternate tags, self-referencing canonical links, and XML sitemap xhtml:link blocks for multilingual and global websites.

Validation checks

Generated Tags


      

Remember: hreflang tags must be bidirectional (every translated page must link back to all other versions, including itself).

Why hreflang tags matter for global SEO

Hreflang tags tell Google and other search engines which language or regional version of a page to show to each searcher. Without them, search engines may rank the wrong country version or treat translated/regional pages as duplicates.

Always pair hreflang tags with a self-referencing canonical tag on each language version so every localized URL is indexed independently.

Code formatMeaningExample
x-defaultFallback page for unmatched languageshttps://example.com/
enAll English speakers globallyhttps://example.com/en/
en-GBEnglish speakers in the United Kingdomhttps://example.com/uk/
es-MXSpanish speakers in Mexicohttps://example.com/mx/

3 rules to avoid hreflang errors in Search Console

  1. Use absolute URLs (always include https://, never relative paths like /es/).
  2. Make return links bidirectional: if page A links to page B, page B must link back to page A and to itself.
  3. Use ISO 639-1 two-letter language codes and optional ISO 3166-1 Alpha-2 region codes (e.g. en-US, not en-UK).

Frequently asked questions

Should I put hreflang in HTML <head> or in my XML sitemap?

Either works equally well for Google. HTML tags are easiest for small sites, while XML sitemaps keep HTML lightweight on large multi-language sites.

What is x-default in hreflang?

x-default specifies the fallback URL shown when a user's browser language does not match any of your listed hreflang rules.

Can I point all hreflang tags to one canonical URL?

No. Each language/region URL should have a self-referencing canonical pointing to itself, not to the English version.