Skip to content
BCP-47 validated · x-default · reciprocal by construction · three output formats

Hreflang Tag Generator

Build your language/region grid once and export it three ways — head link tags, HTTP headers and sitemap xhtml:link blocks — with live BCP-47 validation and the reciprocity rule handled by construction.

Locale × URL grid
3 versions
quick add:
Grid is valid — reciprocal set, absolute URLs, x-default present

Paste this exact block into the <head> of every page version listed — the set must be identical everywhere.

<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
Reciprocity is the #1 hreflang failure. Every page version must serve the same complete set of alternates — including a self-referencing entry. If the German page doesn't link back to the English one, Google ignores both annotations. The set generated here is reciprocal by construction: ship the identical block on every listed URL.
Pair with canonicals. Each language version keeps its own self-referencing canonical — never canonicalize all versions to one language, or the alternates you just declared get consolidated away.
Reference

BCP-47 tags that actually matter

TagMeaning
enEnglish, any region
en-US / en-GBEnglish for the United States / United Kingdom
de / de-ATGerman, any region / German for Austria
pt-BR / pt-PTBrazilian / European Portuguese — genuinely different content
hi-INHindi for India
zh-Hans / zh-HantSimplified / Traditional Chinese (script subtags)
x-defaultThe fallback page for users matching no listed locale — often a language picker
Field notes

How hreflang actually works (and fails)

Hreflang doesn't translate anything and doesn't boost rankings — it's a routing annotation. When several of your pages are equivalent content in different languages or for different regions, hreflang tells search engines which version to show a given user, so a searcher in Vienna gets de-AT instead of the US English page. Without it, engines guess — and usually consolidate signals into one version, starving the others. With it, each version keeps its local relevance while sharing the cluster's equity.

The syntax is strict in ways that silently fail. Language codes are ISO 639-1 (de, not ger); regions are ISO 3166-1 alpha-2 and must follow a language (de-AT is valid, a bare AT is not); scripts use four letters (zh-Hans). URLs must be absolute. One invalid tag doesn't break the others — but that version simply drops out of the cluster with no error shown anywhere, which is why this generator validates every row as you type.

Choose one delivery method and stay consistent: head <link> tags are simplest for HTML pages; the HTTP Link header is the only option for PDFs and other non-HTML files; the sitemap method keeps big sites maintainable because the whole grid lives in one generated file instead of in every template — at the cost of the easy-to-forget xmlns:xhtml namespace declaration this tool bakes in. Mixing methods with different sets is worse than any single method.

After shipping, verify the full picture: crawl the versions with SEO Audit Pro (its crawlability category checks hreflang self-reference and code validity on any page you feed it), keep the sitemap itself valid in the Sitemap Studio, and make sure each version's title and description read natively in the SERP preview.

Hreflang Generator FAQs

Have more questions? Contact us

Trusted for International Rollouts

4.8
Based on 1,680 reviews

Reciprocal-by-construction is the right mental model — one block, pasted everywhere, done. The BCP-47 validation caught a zh-CN vs zh-Hans mixup that had silently broken our Chinese cluster for months. The sitemap output with the xhtml namespace pre-wired is a small thing that saves real pain.

I
Ingrid Halvorsen
International SEO lead
June 21, 2026

We run pt-BR and pt-PT storefronts and they used to cannibalize each other constantly. Built the grid here, shipped the link-tag block via template, and Search Console's return-tag errors went to zero. The quick-add chips with URL suggestion made a 9-locale grid a two-minute job.

C
Carlos Mendes
E-commerce developer
May 30, 2026

Finally a generator that explains x-default properly instead of just adding a field. The reminder that canonicals must stay per-language saved us from a rollout plan that would have wiped the whole cluster. Clean, fast, nothing uploaded anywhere.

A
Aiko Tanaka
Localization PM
April 25, 2026

My go-to for client hreflang now — the three-format export covers whatever stack they're on. Would love CSV import for very large grids, but for the typical 5–15 locale cluster the row editor is quicker than the spreadsheet dance anyway.

P
Peter Nagy
Technical SEO consultant
March 15, 2026

Love using our calculator?

Connected instruments

More of SEO Forge

Learn More

Related Articles

Dive deeper with our expert guides and tutorials related to Hreflang Tag Generator

Loading articles...

BCP-47 validation · reciprocal by construction · x-default · link tags / HTTP header / sitemap formats · in-browser · Last reviewed: 2026-07