Hreflang Tag Generator

Generate correct hreflang tags for multilingual and multi-regional websites. Add your language versions below, choose HTML or XML sitemap format, and copy the output straight into your site.

Quick presets:

Language Versions

The x-default URL is shown to users whose language/region does not match any hreflang tag.

Output Format

Warnings

  • x-default is enabled but no URL is set.
  • 2 row(s) have empty URLs.

Add URLs above to generate hreflang tags...

How Hreflang Tags Work

The hreflang attribute tells search engines which language and regional version of a page to show to users. It prevents duplicate content issues across multilingual sites and ensures the right version appears in local search results.

Tag syntax

Each tag uses an ISO 639-1 language code (e.g. en), optionally followed by an ISO 3166-1 Alpha-2 region code (e.g. en-GB). Language-only tags target all regions for that language; language + region tags target a specific country.

x-default

The x-default value designates the fallback page shown when no other hreflang matches the user's language or region. Google strongly recommends including it.

Self-referencing tags

Every page in the set must include hreflang tags pointing to all versions, including itself. This is the most common mistake — forgetting the self-referencing tag causes search engines to ignore the entire hreflang set.

Reciprocal confirmation

Hreflang tags must be reciprocal. If page A links to page B with hreflang, page B must link back to page A. Non-reciprocal tags are treated as errors and ignored.

Implementation methods

  • HTML <link> tags — placed in the <head> of each page. Best for smaller sites.
  • XML Sitemap — hreflang annotations added inside each <url> element. Better for large sites with many language versions.
  • HTTP headers — useful for non-HTML files (PDFs). Not generated by this tool.

Common mistakes to avoid

  • Missing self-referencing tags on each page.
  • Non-reciprocal tags between page pairs.
  • Using country codes alone (e.g. "GB") without a language prefix.
  • Pointing hreflang tags to redirected or non-canonical URLs.
  • Mixing implementation methods (use one consistently).
  • Forgetting the x-default fallback.