HREFLANG // international SEO

Hreflang generator

A free hreflang generator that builds valid hreflang tags in seconds — language and region codes validated, x-default included. Use the output as a quick hreflang checker too: if your codes are wrong, the generator won't accept them.

$ runs in your browser · nothing stored · no signup

Hreflang Generator — runs in your browser

// language versions

LangRegionURL

// output

 

What hreflang actually does

The hreflang attribute is one line of HTML that tells Google a page has versions in other languages or countries, and which URL serves each one. If you run the same content in more than one market, this is how you point each audience at its own version. Get it wrong and Google may rank your English page in France, or treat your localized URLs as duplicate content. Get it right and each market sees the version built for it.

It is not a ranking boost. It is a routing instruction. Single-market sites don't need it at all — it only earns its keep once you have two or more language or regional versions of the same page.

The strict rules that trip people up

Hreflang is unforgiving. Most broken setups fail on one of these four rules — and the first two are where almost everyone slips:

  1. Self-referencing is required. Every page must include a self-referencing hreflang tag — a link pointing to its own URL. A 3-language set means all 3 pages carry the same 3 hreflang links, each listing itself. Miss the self-reference and Google ignores the whole cluster.
  2. Return tags must be reciprocal. If page A links to page B, page B has to link back to A. One-way (missing return-tag) declarations are the single most common hreflang error in Search Console.
  3. Codes are strict. Language is a lowercase ISO 639-1 code (en, fr, de); the optional region is an uppercase ISO 3166-1 alpha-2 code (US, GB). So en-US, never en-us or en-UK (the code for the UK is GB). This tool blocks invalid codes before you ship them.
  4. Use absolute URLs and add x-default. Every href should be a full https:// URL, not a relative path. Add an x-default entry as the fallback for users no language version matches.

Where to put hreflang tags

You have three valid places to declare hreflang. Pick one per page — do not mix methods on the same URL:

  1. In the <head>. The most common method: <link rel="alternate" hreflang="..." href="..."> tags in the <head> of every page. That's what this generator outputs.
  2. In the XML sitemap. Useful for large sites — you declare every alternate once per URL in the sitemap instead of editing thousands of page heads. Heavier to maintain but keeps the markup out of your templates.
  3. In the HTTP header. The only option for non-HTML files like PDFs, since they have no <head> to host the tags.

On most sites &-encoded query parameters and crawl rules have nothing to do with hreflang — keep the two concerns separate.

Generator vs. checker vs. validator

People search for an hreflang generator, an hreflang checker, and an hreflang validator as if they were three tools. They're really two jobs. A generator builds the tags — that's what you're using above. A checker or validator inspects existing tags for the errors listed earlier: missing self-references, broken return tags, bad codes. Because this generator enforces valid codes and writes the full reciprocal set for you, the output is correct by construction — so you can treat it as a build-and-validate pass in one step. If you've inherited a messy international setup and want every error found across the whole site rather than one page set, that's a job for a free AI SEO audit or our AI SEO services.

// use them together

The rest of the toolbox

Every tool does one job. Run them together and you cover AI readiness, on-page signals and the business case — the whole loop, in your browser, no signup.

Planning

Make the business case before you spend.

// questions

FAQ

What is hreflang? +
Hreflang is an HTML attribute that tells Google a page has versions in other languages or regions, and which URL serves each one. It stops the wrong-language page from ranking in a given country and keeps Google from treating your localized URLs as duplicate content.
How do I add hreflang tags? +
Generate the tags here, then paste the full set into the <head> of every page in the group. Each page needs one rel="alternate" hreflang link per version, including a link back to itself. Alternatively you can serve the same set in an XML sitemap or HTTP header.
Where do hreflang tags go? +
In the <head> of every page in the set is the most common spot. You can instead put them in an XML sitemap or, for non-HTML files like PDFs, in the HTTP response header. Pick one method per page — do not mix them, and never put hreflang in the <body>.
Is hreflang worth it? +
Only if you serve the same content in more than one language or country. For a single-market site it does nothing. If you target multiple regions, it is the cleanest way to send each market its own version instead of letting Google guess — so yes, it matters.
What causes most hreflang errors? +
Two things: a missing self-referencing tag (every page must link to itself) and missing return tags (if page A links to B, B must link back to A). Bad language/region codes are the third. This generator enforces valid codes and self-references so two of those never happen.
What is x-default for? +
x-default is the fallback — the page Google serves when no other language or region version matches the user, usually your main or language-selector page. It is optional but recommended for international sites.

// your move

Want this done
for you?

Founder-led AI SEO — brand signals, citations, real organic growth. We’ll tell you straight whether it fits.

// or send a message

Tell us
about your site.

Drop your URL and we’ll give you an honest read — no pitch, no obligation. Prefer to talk live? Book a call →

// 30 min · intro, founder-to-founder

Book a call