- Home
- Free tools
- Hreflang Generator
Free tool · No signup
Hreflang Generator
Turn a list of URL and language pairs into valid, reciprocal hreflang tags — plus x-default and sitemap output.
HTML <link> tags
<link rel="alternate" hreflang="en-US" href="https://example.com/" /> <link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />
HTTP Link header
Link: <https://example.com/>; rel="alternate"; hreflang="en-US", <https://example.com/fr/>; rel="alternate"; hreflang="fr-FR", <https://example.com/>; rel="alternate"; hreflang="x-default"
XML sitemap fragment
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/</loc>
<xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>
<url>
<loc>https://example.com/fr/</loc>
<xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>
</urlset>In short
A hreflang generator takes a set of URLs paired with language and region codes and produces the reciprocal <link rel="alternate" hreflang="x"> tags that each page in the set must carry, including an x-default fallback. Hreflang only works when every URL in the set references every other URL, including itself, using valid ISO 639-1 language and ISO 3166-1 region codes. Enter your URL and locale pairs below to generate ready-to-paste tags, an HTTP header version for non-HTML files, and an XML sitemap variant.
Worked example
What the output looks like
- Input
- example.com/ (en-US), example.co.uk/ (en-GB), example.fr/ (fr-FR)
- Output
- <link rel="alternate" hreflang="en-us" href="https://example.com/" /> <link rel="alternate" hreflang="en-gb" href="https://example.co.uk/" /> <link rel="alternate" hreflang="fr-fr" href="https://example.fr/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />
- How to read it
- Each page must carry all four tags, including a self-referencing one. The x-default points to the US site as the fallback for languages and regions not explicitly listed, which is the usual choice for a global root domain.
How it works
Add each URL with its language and optional region
List every localised version of the page — for example en, en-GB, fr, de — with the full URL for each. Region codes are optional but recommended when the same language serves multiple markets with different content or currency.
Generator builds the full reciprocal set
Hreflang requires every page to list itself and every alternate. The tool builds the complete cross-referenced block automatically, so you don't have to copy the same list onto every page by hand and risk a mismatch.
Choose HTML, HTTP header or sitemap output
Use <link> tags in the <head> for HTML pages, HTTP Link headers for PDFs or other non-HTML files, or a single sitemap.xml block if you're managing hreflang centrally instead of per-page.
What this tool does
- Generates reciprocal <link rel="alternate"> tags for every URL in the set
- Validates ISO 639-1 language and ISO 3166-1 region codes as you type
- Adds an x-default tag for the language-selector or international homepage
- Exports as HTML head tags, HTTP Link headers, or a sitemap.xml hreflang block
Questions
Frequently asked
More free SEO tools
- Slug Generator/free-tools/slug-generator
- Canonical Tag Checker/free-tools/canonical-tag-checker
- XML Sitemap Validator/free-tools/sitemap-validator
Learn the concept
Manage hreflang across your entire international site
LemRank tracks rankings, backlinks, and AI-search visibility in one dashboard. 14-day free Pro trial. No credit card.