Hreflang Tag Generator
How to Use This Hreflang Generator
- Add each language version — enter the URL and select the ISO 639-1 language code (e.g.,
en,de,fr). - Add a region if needed — optionally pair the language with an ISO 3166-1 Alpha-2 country code (e.g.,
en-GB,de-AT). - Include the page itself — every version must reference its own URL in the set. The generator enforces this.
- Designate an x-default — point the fallback at your main version or a language selector page.
- Copy the generated tags into the
<head>of every version, or use the sitemap output if you manage many locales.
What Hreflang Tags Do (and What They Don't)
Hreflang is an HTML attribute that tells Google and Yandex which language and, optionally, which region a page is intended for[reference:2][reference:3]. When a user searches in German from Austria, hreflang is the signal that routes them to the de-AT version rather than the de-DE one. It does not boost rankings directly; it routes the right page to the right audience[reference:4].
Bing treats hreflang as a weak signal and relies more on the content-language meta tag and the HTML lang attribute[reference:5][reference:6]. For sites targeting Bing, implement hreflang and the content-language declaration. Among AI search systems, only those built on Google's or Bing's index consistently return the correct language version; ChatGPT, Perplexity, and Claude often default to US English[reference:7].
The stakes are not theoretical. Only 9.6% of sites use hreflang on desktop and 8.9% on mobile, yet an Ahrefs study of 374,756 domains found that 67% had at least one hreflang issue[reference:8][reference:9]. Getting the tags right is rarer than getting them wrong.
The Three Non-Negotiable Rules
A set of hreflang tags is treated as a single cluster. If any one rule is broken, Google can ignore the entire set[reference:10][reference:11].
1. Self-Reference
Every page in the cluster must include an annotation pointing to itself. Omitting the self-reference makes the cluster incomplete. This is the #1 error found by Semrush audits of large sites[reference:12]. Your Austrian page must list de-AT (itself), de-DE, and de-CH — not just the other versions.
2. Bidirectional Return Tags
If page A links to page B, page B must link back to page A. A one-sided reference is ignored[reference:13]. If the Austrian page points to the German page but the German page does not point back, the entire annotation for that pair is discarded. The generator produces the full mirrored set for every version, because you cannot fix reciprocity one tag at a time.
3. Absolute URLs with Protocol
All href values must be fully qualified, including the protocol: https://example.com/de/, not /de/ or //example.com/de/[reference:14]. Relative paths are silently dropped by Google.
x-default: The Fallback You Cannot Skip
The x-default annotation designates the page shown to users whose language or region matches no declared variant[reference:15]. It usually points to your main language version or a language selector page. Only one URL per group should carry it.
This is the most frequently forgotten element. According to Ahrefs, 56.3% of domains using hreflang were missing x-default entirely[reference:16]. Google treats it as recommended rather than mandatory, but sites that implement it consistently show better international routing[reference:17]. The generator adds it as a required field so it cannot be omitted by accident.
Common Hreflang Errors (and How to Avoid Them)
Beyond the three core rules, these are the mistakes that invalidate otherwise correct implementations:
- Invalid language codes.
en-UKis wrong —UKis the language code for Ukrainian. Useen-GB[reference:18]. A study found 8.9% of sites using hreflang contain invalid language codes[reference:19]. - Underscores instead of hyphens.
en_USfails; the separator is a hyphen:en-US[reference:20]. - Canonical conflicts. If a French page canonicalizes to the English page, Google treats the French URL as a duplicate and ignores its hreflang annotation. Each locale must self-canonicalize[reference:21].
- Hreflang only on the homepage. Every page with locale variants needs its own complete set — a homepage-only implementation leaves every inner page misrouted[reference:22].
If a canonical conflict is suspected, verify the affected URL's canonical tag with our Meta Tag Analyzer before regenerating the hreflang set.
Implementation Methods: Which One to Choose
Google treats three delivery methods as equivalent and combines signals from them, but if the same language-region pair points to different URLs across methods, Google drops that pair rather than guessing[reference:23]. Pick one primary method and stay consistent.
| Method | Best For | Trade-off |
|---|---|---|
HTML <link> in <head> |
Small to medium sites, easy to audit | With 20+ locales, adds ~1.5 KB per page for no user benefit[reference:24] |
XML sitemap <xhtml:link> |
Large or programmatic sites | Zero runtime performance impact; child elements do not count toward the 50,000 URL limit[reference:25] |
HTTP Link header |
Non-HTML files like PDFs | Invisible in page source; harder to debug |
For most sites the HTML method is the right default. If you are managing dozens of locales, switch to sitemap-based hreflang. John Mueller's guidance is to focus hreflang on the pages that actually receive wrong-language traffic rather than attempting every page on the site[reference:26].
How to Validate Your Hreflang Setup
Google Search Console does not have a dedicated hreflang error report, but you can diagnose problems indirectly[reference:27]:
- URL Inspection — paste a translated URL into GSC's URL Inspection tool and check the detected hreflang annotations for that page.
- International Targeting report — GSC → Settings → International Targeting shows the detected language/region configuration.
- Site crawler — Screaming Frog or Ahrefs Site Audit provides dedicated validation for missing return tags, self-reference gaps, and canonical conflicts[reference:28].
- Source check — view the page source and confirm every version contains the full mirrored set, including itself.
After fixing hreflang, confirm the affected pages are actually indexed with our Google Indexed Checker — a valid hreflang set does nothing if the page itself is not in the index.
Frequently Asked Questions
Is this hreflang generator free?
Yes. The generator is completely free, requires no sign-up, and runs in your browser. The URL sets you build are not stored on a server.
What happens if one hreflang tag is missing?
If a page omits its self-reference, the cluster is incomplete. If a return tag is missing, the one-sided annotation is ignored. In severe cases Google discards the entire set for that page[reference:29]. Hreflang is unforgiving: one broken tag can invalidate a correct implementation.
Do I need hreflang for a single-language site?
No. Hreflang is only relevant when you serve the same content in multiple languages or regional variants. A monolingual site has nothing to annotate.
Does hreflang improve rankings?
Not directly. Hreflang routes the correct version to the correct audience; it does not add ranking weight. Its value is preventing the wrong language from appearing in search results and reducing duplicate-content confusion between locale variants[reference:30].
What is the difference between de and de-AT?
de targets all German speakers globally. de-AT targets German speakers in Austria specifically. Adding a region narrows the audience; omitting it broadens it. Both are valid, but they serve different purposes[reference:31].
Related International & Technical SEO Tools
Use these free tools to validate the pages your hreflang set points to:
- Meta Tag Analyzer — confirm canonicals are correct before pairing them with hreflang.
- Google Indexed Checker — verify each locale version is actually indexed.
- Broken Link Checker — find dead hreflang targets that silently break the set.
- SEO Site Score Generator — assess whether international pages are held back by technical debt.
- Google Page Speed Checker — slow locale pages are crawled less consistently, weakening hreflang signals.