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
// language versions
// 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:
- 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.
- 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.
- 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). Soen-US, neveren-usoren-UK(the code for the UK isGB). This tool blocks invalid codes before you ship them. - Use absolute URLs and add x-default. Every
hrefshould be a fullhttps://URL, not a relative path. Add anx-defaultentry 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:
- 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. - 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.
- 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.
AI readiness
Make sure the engines can reach, parse & cite you.On-page & technical
Tighten the signals on every page and across markets.Planning
Make the business case before you spend.// questions
FAQ
What is hreflang? +
How do I add hreflang tags? +
Where do hreflang tags go? +
Is hreflang worth it? +
What causes most hreflang errors? +
What is x-default for? +
// 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.