Hreflang Generator
Generate hreflang tags for your language and country versions as HTML link tags, XML sitemap entries or an HTTP Link header, with every code validated as you type.
Runs in your browser · Nothing uploaded · No sign-up
Something not working, or missing a feature? Send feedback
About the Hreflang Generator
The Hreflang Generator builds the hreflang annotations for a page that exists in several languages or countries. Add one row per version (language code, optional country, URL) plus x-default, and copy the result in the format you need: link tags for the HTML head, url entries with xhtml:link alternates for an XML sitemap, or an HTTP Link header for PDFs and other files. Codes are validated as you type.
Files and tags are generated in your browser; nothing you enter, including unpublished URLs and titles, is sent to a server.
How to use the Hreflang Generator
- Add a row for each language or country version with its full URL.
- Add x-default for visitors whose language is not listed.
- Pick HTML, XML sitemap or HTTP header, and copy the output.
- Put the same set on every version, then confirm with the Hreflang Checker.
Works well with the Hreflang Generator
- Hreflang Checker: check the tags on the live pages.
- XML Sitemap Generator: build the sitemap the alternates go into.
- Canonical & Noindex Checker: confirm each version is its own canonical.
Frequently asked questions
HTML tags, sitemap or header: which should I use?
All three work equally for Google; pick the one that is easiest to keep correct. HTML tags suit small sites, the sitemap suits large sites with many versions (it keeps the HTML light), and the HTTP header is the only option for non-HTML files such as PDFs.
Do I need a separate tag for every country?
Only if the content differs. A language code alone (es) covers all Spanish speakers. Add regions (es-ES, es-MX) when prices, spelling or offers differ by country.
Related tools
Robots.txt Checker
Validate a live or pasted robots.txt the way Google reads it: syntax errors, blocked pages and resources, sitemaps, 21 search and AI crawlers, and a URL tester.
Googlebot Simulator
See a page as Googlebot, Bingbot or GPTBot and as a visitor, side by side: status, redirects, title, canonical, noindex and text, to catch cloaking.
Robots.txt Generator
Create a robots.txt file with rules per crawler, sitemap links and presets for WordPress or blocking AI bots, then test any URL against it in your browser.
Canonical & Noindex Checker
Check a URL's canonical tag and Link header, robots meta, X-Robots-Tag and robots.txt, and whether the canonical target itself works, with a clear indexing verdict.
Hreflang Checker
Validate a page's hreflang tags: language and region codes, self-reference, x-default, relative URLs and canonical conflicts, and whether every alternate links back.
Sitemap Finder
Find the XML sitemap of any website: from robots.txt, the home page and the default paths of WordPress, Yoast, Rank Math, Shopify and Wix, with URL counts.