<link rel="alternate" hreflang="x-default" href="https://example.com/" /> <link rel="alternate" hreflang="en-US" href="https://example.com/us/" /> <link rel="alternate" hreflang="en-GB" href="https://example.com/uk/" /> <link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/" /> <link rel="alternate" hreflang="de-DE" href="https://example.com/de/" />
| hreflang | URL | Status |
|---|---|---|
| x-default | https://example.com/ | Valid |
| en-US | https://example.com/us/ | Valid |
| en-GB | https://example.com/uk/ | Valid |
| fr-FR | https://example.com/fr/ | Valid |
| de-DE | https://example.com/de/ | Valid |
What is the Hreflang Generator?

The Hreflang Generator builds the hreflang annotations that tell Google which language and regional version of a page to show each user. You enter one row per version - a language/region code like en-US, fr-FR, or es-419 and the matching URL - and this hreflang tag generator outputs valid markup in whichever of the three formats Google accepts: HTML <link rel="alternate"> tags for the page <head>, xhtml:link entries for an XML sitemap, or an HTTP Link response header for non-HTML files like PDFs. Correct hreflang is what stops a French user landing on your English page and keeps your regional pages from competing with each other in search.
Hreflang is deceptively easy to get wrong. The codes follow the ISO 639-1 language and ISO 3166-1 region standards, not intuition - the United Kingdom is GB, not UK, and Spanish for Latin America is the UN M49 code es-419. Return tags must be reciprocal: if page A points to page B, page B has to point back. And most sites forget the x-default fallback for users whose language you do not target. This generator validates every code against the expected shape, flags codes that are not recognized language or region subtags, catches duplicates, checks that each URL is absolute, and reminds you about x-default and reciprocity before the markup ever reaches your site.
Everything runs in your browser. Your URL structure - which can reveal your entire international site architecture - is never uploaded, and the tool works offline once loaded. Pick a format, fill in your language versions, and copy the generated tags straight into your templates, sitemap, or server config. After deploying, check a few pages with the URL Inspection tool in Google Search Console or a site crawler that reports hreflang errors.
A short run shows what this hreflang tags generator catches. Enter x-default for https://example.com/, en-us for https://example.com/us/, en-UK for https://example.com/uk/ and fr-FR for /fr/. The output has three link tags: en-us is rewritten as en-US, en-UK is kept but flagged because UK is not a common ISO 3166-1 region code (the United Kingdom is GB), and fr-FR is dropped with the error that the URL must be an absolute http(s) URL. Fix those two rows and the set is ready to copy.
How to use the Hreflang Generator?
Add your language versions
Enter one row per version: a language/region code (en, en-US, fr-CA, zh-Hant…) and the full URL of that version. Use the quick-pick codes if you are unsure of the format.
Include an x-default
Add an x-default row pointing to your fallback URL (often a language selector or your main homepage) for visitors whose language you do not explicitly target.
Choose an output format
Switch between HTML link tags for the <head>, xhtml:link entries for an XML sitemap, or an HTTP Link header. The tool validates codes and URLs and warns about duplicates and missing x-default.
Copy and deploy reciprocally
Copy the tags and add the same complete set to every URL in the group so the annotations are reciprocal. Spot-check the live pages with URL Inspection in Google Search Console or a crawler that reports hreflang errors.
Key Features
Three Output Formats
HTML <link> tags for the page head, xhtml:link entries for an XML sitemap, and an HTTP Link header - every method Google supports
Language & Region Validation
Checks each code against the ISO 639-1 language and ISO 3166-1 region shape and flags subtags that are not recognized standards
x-default & Reciprocity Reminders
Warns when no x-default fallback is set and reminds you that hreflang must be reciprocal across every page in the group
Duplicate & URL Checks
Catches repeated language/region codes and rejects URLs that are not absolute http(s) links before they break your setup
Frequently Asked Questions
Related Tools
Backlink Finder
Find sites in your niche that accept guest posts, using the search footprints those pages leave behind. Deduplicated by domain, with the page that matched.
htaccess Redirect Generator
Generate Apache .htaccess 301 and 302 redirect rules from a list of old-to-new URLs, plus force-HTTPS and www canonicalization directives, all in the browser.
Meta Tag Generator
Generate SEO, Open Graph, and Twitter Card meta tags for any page, with live preview and length checks
Robots.txt Generator
Build, validate, and test a robots.txt file - user-agent groups, allow/disallow rules, sitemaps, AI crawler blocking, and a live URL tester
Comments
0 comments
No comments yet. Be the first to share your thoughts!