Hreflang generator. Reciprocally validated.
How to use the Hreflang Generator
The Hreflang Generator builds the hreflang annotations for one set of translated or regional pages. You list each language or region code with its URL, and it writes the same set as HTML link tags, an XML sitemap entry or an HTTP Link header, while a validator panel flags bad codes, duplicates and a missing x-default. It is for site owners and developers adding a new language or country version of a site.
Step by step
-
Start from a preset
Press US + UK + CA + AU, Europe 5 (EN/DE/FR/ES/IT), India (en-IN + hi-IN) or Global + x-default to load a ready set of rows. The page opens on US + UK + CA + AU, and it remembers the last preset you picked.
-
Enter your own codes and URLs
In each row, type the language code in hreflang, such as en, en-gb or de-de, and the full address in URL, starting with https://. Use x-default for the fallback page. Rows without both a code and an http or https address are left out of the output.
-
Add or remove rows
Press + Add locale row for another language or region. The new row starts filled in as en-us and https://yourdomain.com/new/, so change both. Press the cross at the end of a row to remove it.
-
Check the validator panel
The reciprocal validator lists every row with a tick, or a warning such as bad-code or duplicate, and says when x-default is missing. Fix the warnings until the line above the output reads Valid.
-
Pick an output format
Choose HTML tags for link elements in the page head, Sitemap for xhtml:link lines inside a sitemap url entry, or HTTP header for a single Link header, which suits PDFs and other files that have no HTML head.
-
Copy or download it
Press Copy to put the output on your clipboard, or Download to save it as hreflang.html, hreflang.xml or hreflang.txt depending on the format.
Reading the result
- With the default preset the line above the output reads Valid. 5 locales, reciprocity checked, and the HTML tags tab shows five link tags, one each for en-us, en-gb, en-ca, en-au and x-default.
- A warning line such as 1 issue flagged. See validator panel means a row needs attention. bad-code means the code is not two letters, optionally followed by a dash and two or three letters. duplicate means the same code appears twice.
- x-default missing appears when you have two or more rows and none of them is x-default.
- The Sitemap output is one url entry whose loc is the first row's URL. In your sitemap, repeat the same xhtml:link lines in the entry for every URL in the set, and add the xhtml namespace to the urlset tag as the comment says.
Tips and common mistakes
- Put the same full block on every page in the set, each page included. Hreflang only works when the pages point to each other, and this tool cannot see your live pages to confirm that you did.
- Use GB, not UK, for the United Kingdom. The validator only checks the shape of a code, so en-uk is not flagged here even though UK is not a country code.
- Duplicates are matched exactly as typed, so en-US and en-us are not caught as the same code. Keep one style of letter case throughout.
- Use full absolute URLs. Relative paths such as /uk/ are dropped from the output because they do not start with http or https.
- Pick one method per page, tags, sitemap or headers, and keep it. Two methods that disagree make the set harder to audit.
Privacy and limits
Everything is built in your browser and nothing you type is sent anywhere. Only the name of the last preset you picked is saved in this browser's local storage; your rows are not saved, so copy or download the output before you leave the page.
Hreflang tells search engines which page to serve where.
Hreflang is a markup attribute that declares to search engines the relationship between different language or regional variants of the same page. Without it, Google guesses based on ccTLD, server location, or content language, and guesses badly: a US shopper searching a product name might land on the UK page (different currency, different shipping), and bounce. With hreflang implemented correctly, Google swaps in the right regional URL at the SERP level before the user clicks. It is the single highest-impact international-SEO signal on a multi-market site.
Three output formats are equally valid: HTML link tags in the document head, XML sitemap xhtml:link annotations, and HTTP Link headers. The generator above outputs all three so you can pick the right one for your stack. Use HTML tags on CMS-driven sites with under 20 locales, sitemap annotations at scale (50+ locales, where per-page tag drift becomes a maintenance problem), and HTTP headers only for non-HTML resources like PDFs or downloadable catalogs. Mixing methods on the same page is allowed but risky; conflicts silently break the cluster.
The reciprocal-link rule is the failure point most teams miss. Every locale variant must point to every other variant, including itself. A 5-locale cluster produces 25 hreflang declarations per page (5 × 5 reciprocal grid). If even one return link is missing, Google discards the entire cluster for that URL and falls back to ccTLD guessing. The validator panel renders the reciprocal matrix in real time and flags gaps in amber before you paste the output into production. On large sites with 50+ locales we recommend sitemap-based hreflang specifically to centralize the 2500-cell reciprocal graph and make audits tractable.
Tools in the same cluster: XML sitemap generator with built-in hreflang support. robots.txt generator for crawl-policy setup. Schema markup generator for structured data.
Six answers.
Should I use HTML tags, XML sitemap, or HTTP headers?
All three work. Pick one method per page and stick to it. HTML link tags are the easiest to ship and audit visually but bloat the page head as locale count grows (20 locales = 20 link tags in every page's head). XML sitemap annotations centralize the reciprocal graph in one file, which scales best above 20 locales and avoids per-page tag drift. HTTP headers are required for non-HTML resources (PDFs, downloadable catalogs) and are rarely used on regular pages. Mixing implementations on the same URL is not forbidden but creates conflicts when tags disagree; the generator outputs all three side by side so you can pick and ship consistently.
What is x-default and when do I need it?
x-default tells search engines which URL to serve when no language or region match is found for the user. It is the fallback. Use it on sites where: the default URL is a language selector or global landing page that redirects; your coverage is uneven (you have en-US and de-DE but not ja-JP, so Japanese users need a default); or you operate on a non-ccTLD and want Google to serve the international URL rather than guess. If every user's locale is covered by a specific hreflang, x-default is optional but recommended; Google treats it as a soft canonical for unmatched locales. The generator adds x-default as an optional row by default.
What is the reciprocal-link rule and why does it matter?
Every hreflang pair must be bidirectional. If the US page links to the UK page, the UK page must link back to the US page, AND both pages must list themselves. Non-reciprocal hreflang is the single most common international-SEO mistake; Google ignores the entire hreflang cluster on that URL when it detects non-reciprocity. The validator panel in the generator shows a grid of every locale pair and flags missing return links in red. Fix before shipping. On sites with 50+ locales, the reciprocal matrix becomes a 2500-cell problem that the sitemap-based output handles more reliably than per-page HTML tags.
Should I use language-only codes (en) or language-region (en-US)?
Use language-only (en) when the content is the same across all English-speaking regions (US, UK, AU, CA all read the same page). Use language-region (en-US, en-GB, en-AU) when currency, date format, regional spelling, shipping options, or pricing differ. Shopify Markets and WooCommerce Multilingual both ship region-specific variants that warrant en-US vs en-GB differentiation. Never mix: do not put en and en-US on the same page; Google treats en-US as a subset of en and will de-duplicate incorrectly. The generator validates against ISO 639-1 language codes and ISO 3166-1 region codes.
Does Google still honor hreflang in 2026?
Yes. Hreflang is the primary signal Google uses to serve region-appropriate pages in localized SERPs. John Mueller confirmed in 2024 that hreflang remains the recommended approach for international SEO, and Google's documentation continues to treat it as authoritative. What has changed is enforcement: Google is stricter about reciprocal validation now, and non-reciprocal clusters are silently ignored rather than partially honored. Bing honors hreflang. ChatGPT and Perplexity read hreflang when deciding which regional URL to cite in AI answers. Ship it correctly; the SEO benefit compounds across search and AI surfaces.
Does this tool save my URL list?
No. Every URL and locale you enter lives in memory for this browser tab only. Nothing is transmitted to a server, stored in a database, or synced. The Copy buttons put text on your clipboard; the Download buttons write local files. Close the tab and the data is gone. The tool uses localStorage to remember your last locale preset, which you can clear by wiping browser data.
One page. Not enough.
Our SEO engagements ship complete international architecture: hreflang clusters per template, sitemap-based reciprocal graphs for 50+ locale sites, ccTLD vs subdirectory strategy, currency + pricing localization, and post-launch reciprocity audits monthly. Written plan in 2 weeks.
Published · Last updated .