Hreflang Tag Generator - Build a Valid Language Cluster With x-default

Create hreflang tags for international and multi-language SEO.

Fallback URL when no specific language match is found

About hreflang tags

  • Hreflang tags tell search engines which language/region version to serve to users
  • Place these tags in the <head> section of your HTML
  • Use language codes (en, es) or language-region codes (en-US, es-MX)
  • Each language version should include hreflang tags pointing to all other versions
  • The x-default tag specifies a fallback page when no match is found

Implementation tips

  • Use ISO 639-1 language codes (2 letters) and ISO 3166-1 Alpha 2 country codes
  • Hreflang tags must be bidirectional (each page must link to all others)
  • URLs should be absolute, including protocol (https://)
  • Self-referencing hreflang is required on each page
  • Alternative: Use HTTP headers or XML sitemaps for hreflang
Table of Contents

Enter each language version of a page with its URL and language code, and this tool returns the hreflang block to place on every URL in the set. Hreflang is the annotation that tells Google which translation of a page to show which audience. It is for anyone running the same content in more than one language.

Hreflang must be reciprocal. If the English page points to the Korean one, the Korean page must point back to the English one, and both must list themselves. A cluster where one page is missing a return link is not partially valid - Google discards the unconfirmed annotation entirely. That is why the tool outputs one block containing every URL, meant to be pasted unchanged onto all of them.

A page in English and Korean, with English as the fallback for everyone else:

<link rel="alternate" hreflang="en" href="https://example.com/pyeong-to-square-meters" />
<link rel="alternate" hreflang="ko" href="https://example.com/ko/pyeong-to-square-meters" />
<link rel="alternate" hreflang="x-default" href="https://example.com/pyeong-to-square-meters" />

All three lines go on both URLs, unchanged. The x-default value is not a language - it marks the page to serve when no listed language matches the user, which is why it usually points at the English or the language-selector page.

The language part is an ISO 639-1 code such as en, ko or ja. You may add an ISO 3166-1 Alpha 2 region after a hyphen, as in en-GB or pt-BR. Region alone is invalid: hreflang="GB" is not a thing. Use a region only when the content genuinely differs by country, such as pricing or shipping.

Hreflang is a signal about which version to show, not about whether to show you at all. It does not lift rankings, and it will not rescue a page that is not indexed - if the Korean version is blocked from crawling or noindexed, the annotation cannot help it. Get the pages indexable first, then annotate them.

Confirm the alternates are indexed with check Google indexing, review the head block with the meta tags analyzer, generate the surrounding tags with the meta tag generator, and add structured data with the schema markup generator. More in SEO tools.

Frequently asked questions

What does x-default do in hreflang?
It names the page to serve when none of the listed languages matches the user's settings. It is not a language code. Most sites point it at the English version or at a language-selector page. It is optional, but without it users outside your listed locales get whichever version Google picks.
Do hreflang tags have to point back at each other?
Yes. Every page in a cluster must list every other page and itself. Google discards annotations it cannot confirm from the other side, so a missing return link invalidates that pairing rather than degrading it. Paste the same block on every URL in the set.
Can I use hreflang for a country without a language?
No. The language code is required and the region is optional, so hreflang="en-GB" is valid and hreflang="GB" is not. Use a region only when the content actually differs by country, such as currency or shipping terms, rather than for every market you sell in.
Where should hreflang tags go?
Any of three places: link elements in the head, HTTP headers, or a dedicated XML sitemap. Pick one and use it consistently. Head tags are simplest for small sites; sitemap annotations scale better for large ones and keep the head lighter.
Does hreflang improve rankings?
No. It affects which version of a page is shown to which audience, not how well any version ranks. The benefit is fewer users landing on the wrong language and bouncing, which is a user experience gain rather than a direct ranking one.