What is hreflang tag generator?
Hreflang tags tell search engines which language or regional version of a page to show to which user. They prevent your English page from competing with your French or Spanish page.
The tool validates your language codes and writes both the HTML link tags and the sitemap version.
How to use the hreflang tag generator
- List every language version with its code and URL.
- Include an x default line for the fallback page.
- Copy the tags into the head of every version.
How the hreflang tag generator works
Each line is checked for a valid code, such as en, en-us or x-default, and a full URL. Then a link element with rel alternate, hreflang and href is created for each version. A sitemap version using xhtml:link is created too.
Worked example
Common uses of the hreflang tag generator
- Sites in English and Spanish.
- Regional shops with different currencies.
- Global blogs.
- Government and travel sites.
- Fixing wrong language results.
Tips and common mistakes
Every version must link to all the others and to itself.
Use language codes in lower case and region codes after a hyphen.
Background: what to know before you rely on it
Hreflang is one of the easiest international SEO features to get wrong, because of its two way rule: if page A points to page B, page B must point back to A. Missing return links cause search engines to ignore the tags. Codes must be valid ISO values, so uk is Ukrainian, not the United Kingdom, which is gb. Use the same method everywhere, either head tags, HTTP headers or the sitemap, to avoid conflicts. Check the International Targeting report in Search Console.
Private, free and fast
This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all seo tools, or browse the full list of tools.
Frequently asked questions
What is x default?
The fallback page for users whose language does not match any version.
Where do the tags go?
In the head of every page version, or in the sitemap.
Are hreflang tags a ranking factor?
No. They help serve the correct version.
Can I mix language and region?
Yes, for example en-gb and en-us.
Related tools
Sitemap XML Generator
Paste one URL per line and the generator builds a valid sitemap.xml you can upload to your site and...
SEO ToolsMeta Tag Generator
Enter your page title, description and URL and the generator writes the HTML meta tags, including Open...
SEO ToolsRobots Meta Tag Generator
Tick the directives you need and the tool writes the meta robots tag and the matching X Robots Tag HTTP...
AI ToolsAI Translator
Paste your text, choose the target language and a tone. The AI translates it with natural phrasing and...
SEO ToolsRobots.txt Generator
Enter the paths you want to block, add your sitemap and download a ready robots.txt for the root of your...
SEO ToolsUTM Link Builder
Enter your URL with a source and medium, plus optional campaign details. The tool returns a tagged link...
Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Validate markup with search engine testing tools before publishing.