Hreflang Tag Generator
Build a complete, reciprocal hreflang set for a multilingual page and export it as link tags, an HTTP header block or XML sitemap entries. Validates language and region codes and adds x-default automatically.

<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/pricing" /> <link rel="alternate" hreflang="en-US" href="https://example.com/en-us/pricing" /> <link rel="alternate" hreflang="de" href="https://example.com/de/preise" /> <link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />
Hreflang fails silently. A missing return link or an invented region code produces no error anywhere — the annotation is simply ignored. Enter your language versions and this generator produces a complete reciprocal set in whichever of the three valid formats you need.
What this tool does
Add each language or regional version of a page with its URL, and the generator produces the full annotation set. Because hreflang must be reciprocal — every page in the group has to reference every other page including itself — the output is a complete block you place on all of them, not a per-page fragment.
You get three output formats: <link rel="alternate"> tags for the head, Link: HTTP headers for non-HTML files such as PDFs, and <xhtml:link> entries for an XML sitemap. Codes are validated as you type, and x-default is offered for the fallback version.
A worked example
A page exists in British English, US English, French and Spanish, with a language selector at the root.
You enter five rows: en-GB, en-US, fr, es, and the root as x-default. The generator returns a five-line block. That exact block goes on all five pages, unchanged. If the French page carries only its own tag, or omits en-GB, the whole group is invalid and Google ignores it — which is the single most common hreflang failure.
Which format to use where
| Format | Use when |
|---|---|
<link> tags in head |
Standard HTML pages, small numbers of variants |
Link: HTTP header |
Non-HTML files, or when you cannot edit the head |
| Sitemap XML | Many variants, or head bloat is a concern |
Pick one. Google's localised versions documentation is explicit that mixing methods for the same page group causes conflicts.
Where people go wrong
Non-reciprocal tags. If page A points to page B, page B must point back to page A. Anything less and the annotation is discarded. This is the failure that generates the most "hreflang not working" support threads.
Region codes used as language codes. en-UK is not valid. The country is GB under ISO 3166-1 Alpha 2, so it is en-GB. Likewise the language for Japan is ja, not jp. The tool rejects both.
Region without language. hreflang="gb" is meaningless. The language subtag is compulsory; the region is optional and comes second.
Relative URLs. Every href must be absolute, including the scheme. Relative paths are ignored.
Pointing at non-canonical URLs. Each hreflang target should be that version's canonical URL, and each page's own canonical should point to itself. A canonical that points at the English version while hreflang points at the French one gives Google contradictory instructions, and the canonical wins. Google's guidance on consolidating duplicate URLs covers how the two interact.
Forgetting x-default. Not compulsory, but without it a visitor whose language matches nothing in your set gets whichever version Google guesses. Point x-default at your language selector or your most general version.
FAQ
Do I need hreflang if my site is in one language?
No. It exists solely to tell search engines which of several equivalent pages to show a given user. One language, one region, no hreflang.
Does hreflang stop duplicate content penalties?
There is no duplicate content penalty to stop. What hreflang does is prevent your German page being shown to a British searcher and vice versa, which is a targeting problem rather than a penalty problem.
Can two versions share a language code?
Only with different regions. en-GB and en-US are fine. Two entries both reading en are a conflict, and Google will ignore the set.
Do I put the tags on every page or just the homepage?
Every page in the group, on every version, referencing every member including itself. Hreflang is annotated per page, not per site.
Is Bing the same?
Bing supports hreflang but leans more heavily on the content-language meta tag and on server geolocation. If Bing traffic matters to you, add both rather than choosing.
Next steps
Once the annotations are in place, make sure every variant is actually in your sitemap using the Sitemap Generator, and confirm the canonical tags agree with the canonical tag generator. The On-Page SEO Auditor will flag pages where the head is incomplete.
If you are managing content across markets by hand, API Automation for Businesses covers syncing the systems that hold it.
International rollout stalling on technical detail? Book a discovery call.

Want this built against your real numbers?
A 30-minute call to scope the workflow, agent, or automation you actually need.
More seo tools
All tools301 Redirect Rule Generator
Turn a list of old and new URLs into redirect rules for Apache htaccess, Nginx, Cloudflare or Netlify. Detects redirect chains and loops before you deploy them, and handles bulk migrations from a pasted list.
Canonical Tag Generator
Generate a correct rel=canonical tag from any URL. Normalises the scheme, strips tracking parameters, resolves trailing slash and case issues, and warns about the canonical mistakes that quietly deindex pages.
Content Brief Generator
Generate a complete SEO content brief from any keyword — ready to hand to a writer
Google SERP Preview Tool
See how your page will look in Google results on desktop and mobile before you publish. Renders the title link, breadcrumb URL and snippet with realistic truncation, and highlights query terms the way Google bolds them.
Keyword Clustering Tool
Group any keyword list by search intent and topic — ready for content planning
Keyword Density Checker
Analyse the word and phrase frequency of any piece of content, with one, two and three-word groupings, stop words filtered out, and a flag on anything repeated often enough to read as keyword stuffing.
Have a workflow that's burning hours every week?
Bring me one real bottleneck. I'll tell you whether it's worth automating, and what it would take.