Paste lang|url pairs, get hreflang link tags, HTTP Link header and sitemap XML with x-default and code validation, browser-only
- Runs locally
- Category Developer & DevOps
- Best for Formatting, validating, shrinking, or inspecting code-adjacent text.
Format: en-US|https://example.com/en · zh-CN|https://example.com/zh
hreflang must be bidirectional: every page in the set has to list ALL versions including itself, or Google ignores the whole cluster.
<link rel="alternate" hreflang="en-US" href="https://example.com/en" /> <link rel="alternate" hreflang="zh-CN" href="https://example.com/zh" /> <link rel="alternate" hreflang="es-ES" href="https://example.com/es" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />
Link: <https://example.com/en>; rel="alternate"; hreflang="en-US", <https://example.com/zh>; rel="alternate"; hreflang="zh-CN", <https://example.com/es>; rel="alternate"; hreflang="es-ES", <https://example.com/>; rel="alternate"; hreflang="x-default"
<url> <loc>https://example.com/en</loc> <xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/en" /> <xhtml:link rel="alternate" hreflang="zh-CN" href="https://example.com/zh" /> <xhtml:link rel="alternate" hreflang="es-ES" href="https://example.com/es" /> <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" /> </url>
What this tool does
A free hreflang generator for multilingual and multi-region SEO. Enter one `lang|url` pair per line, for example `en-US|https://example.com/en` and `zh-CN|https://example.com/zh`, and the tool emits the three forms Google accepts: ready-to-paste `<link rel="alternate" hreflang="...">` tags for the page head, an HTTP `Link:` response header for non-HTML files like PDFs, and the `<xhtml:link>` block for an XML sitemap. It validates every language code against the ISO 639 language plus optional ISO 3166 region shape, flags duplicates, HTML-escapes ampersands and quotes in URLs so a query string never breaks the markup, and can append an x-default row pointing at your fallback page. The tool spells out the rule that trips up most sites: hreflang must be bidirectional, so every page in the language set has to list all versions including itself or Google drops the whole cluster. One-click copy on each output, and a shareable URL that reproduces your exact list. 100% client-side, no upload, no API.
Tool details
- Input
- Files + Text
- The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
- Output
- Live result + Copy
- The result area focuses on usable output, with copy, download, or preview actions when supported.
- Privacy
- Browser-side processing
- The main tool logic does not call an external API, so inputs normally stay in the current tab.
- Save / share
- Shareable URL state
- Key settings are encoded in the URL so another person can reopen the same setup.
- Performance budget
- Initial JS <= 9 KB
- No WASM budget is declared, keeping the tool quick to open on mobile.
- Best fit
- Developer & DevOps · Marketer
- Category and role tags drive related tools, internal links, and quick fit checks.
How to use
-
1. Input
Paste or drop your content into the tool panel.
-
2. Process
Click the button. All processing is local in your browser.
-
3. Copy / Download
Copy the result or download to disk in one click.
How Hreflang Tag Generator fits into your work
Use it in the small gaps between coding, reviewing, debugging, and shipping.
Developer jobs
- Formatting, validating, shrinking, or inspecting code-adjacent text.
- Preparing snippets for documentation, tickets, commits, or handoff.
- Checking a small payload quickly without switching tools.
Developer checks
- Run irreversible transforms like minify or obfuscate on a copy.
- Keep secrets out of pasted snippets unless the tool explicitly stays local.
- Use your normal tests or linter before shipping transformed code.
Good next steps
These links move the current task into a more complete workflow.
- 1 Unit Converter Convert between length, weight, temperature, area, volume, speed, time — instant, browser-only Open
- 2 Percentage Calculator 5 common percentage calculations — "x% of y", "x is what% of y", percentage change, increase/decrease — instant, browser-only Open
- 3 Meta Tag Generator Generate SEO meta tags — title, description, Open Graph, Twitter Card, Schema.org. Open
Real-world use cases
Launch a localized site without losing rankings
You just shipped French, German and Japanese versions of an existing English site. Paste all four `lang|url` lines, turn on x-default pointing at a language picker, and copy the link block into every page's head. Google now maps each searcher to their language instead of guessing, so the new locales inherit relevance instead of competing with the English page as duplicates.
Fix a cluster Google is ignoring
Search Console shows your hreflang annotations as "no return tags." That almost always means the references are not bidirectional. List every URL in the set here, including the page you are editing, and paste the identical block onto each one so every page points to every other plus itself. The validator also catches a mistyped code that quietly broke the whole cluster.
Add hreflang to PDFs and other non-HTML files
A multilingual whitepaper exists as separate French and English PDFs. You cannot add a link tag to a PDF, so copy the HTTP Link header output and set it on the file's response in your server config or CDN. Both PDFs now declare each other as language alternates, which is the only supported way to annotate non-HTML resources.
Maintain hreflang at scale from one sitemap
A thousand-page catalog in five languages would be painful to annotate page by page. Generate the `<xhtml:link>` block here, wire it into your sitemap generator so each `<url>` carries the full set of alternates, and remember to declare the xhtml namespace on the root. One file now holds the entire language map.
Common pitfalls
Forgetting the self-reference. Each page must list itself among the alternates. A French page that lists English and Spanish but not French breaks the cluster, because Google needs every page to confirm it belongs to the set.
Using a region code where a language code belongs. An hreflang value starts with a language, so en-US is valid but US alone is not, and UK is never a valid language or region at all (the country code for the United Kingdom is GB). The validator here flags these before they reach production.
Mixing placement methods on the same page. Putting hreflang in both the head and the sitemap with different values sends conflicting signals. Choose one method per page and keep the URLs absolute, with the protocol and host, never relative paths.
Privacy
Every step runs as plain JavaScript in your browser tab: parsing the lines, validating the codes, escaping the URLs and building the three output formats. No URL, language map or domain ever leaves the page, and nothing is logged. The one caveat: the shareable link encodes your entry list in the query string, so a "share link" pasted into chat records those URLs in the recipient server's access log. For an unreleased site map, use the copy button and paste the text instead of sharing the URL.
FAQ
Tool combos
Folks in your role tend to reach for these alongside this tool.
- Age Calculator Calculate your exact age — years, months, days, hours. Compare two dates or count to a future date.
- AI Model Comparison AI model comparison — 20+ models (GPT / Claude / Gemini / Llama / Qwen) across price, context, speed, capabilities (2026).
- Annuity Calculator Annuity & retirement calculator — see monthly income from your savings, accumulation + payout phases, multiple scenarios.
- Avatar Generator Generate avatars from initials, identicons, or random shapes. Download PNG/SVG.