Hreflang tag generator
This hreflang tag generator writes the link tags that tell search engines which language or regional version of a page to show each visitor. It is for sites with translated or country-specific pages.
- Runs in your browser
- Free, no account needed
- Copy or download the result
Result
The short answer
Hreflang tags tell Google which language or regional version of a page to show each user. Every version must list all the versions, including itself, and each version must link back to the others. Use a language code such as fr or a language and region such as en-GB, and x-default for the fallback page.
Formula<link rel="alternate" hreflang="language[-REGION]" href="absolute URL" />, one per version, repeated on every version
Worked exampleThe sample lists en-US, en-GB and fr pages plus an x-default pointing to https://www.example.com/, so four link tags are produced, to be pasted into the head of each of those pages.
Example
en-US, https://www.example.com/en-us/ en-GB, https://www.example.com/en-gb/ fr, https://www.example.com/fr/ x-default, https://www.example.com/
<link rel="alternate" hreflang="en-US" href="https://www.example.com/en-us/" /> <link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/" /> <link rel="alternate" hreflang="fr" href="https://www.example.com/fr/" /> <link rel="alternate" hreflang="x-default" href="https://www.example.com/" /> <!-- Put this same full set in the head of every page listed, including the page itself, or search engines may ignore the tags. -->
How to use the hreflang tag generator
- Add one Language versions row per version: a code such as fr-CA and its full URL.
- Add an x-default line for visitors who match none of the versions.
- The result updates as you type; Run also works.
- Use Copy result and add the same set of tags to every listed page.
How it works
Codes are checked for format: a 2 or 3 letter language, an optional 4 letter script and an optional 2 letter or 3 digit region, or x-default. Letter case is normalized, as in zh-Hant-TW.
The tool cannot confirm that a code is a real, assigned language or country, but it flags common mistakes such as UK instead of GB and underscores instead of hyphens.
Each code may appear only once, and every URL must be absolute.
Every page in the set must list all the alternates, including itself, or search engines may ignore the tags.
Everything runs in your browser. Your input is not uploaded or stored. If you use Copy link, what you entered is placed in the link.
Questions and answers
What is x-default in hreflang?
It marks the page to show when no listed language or region matches the visitor, often a language picker or the main site.
Is en-UK a valid hreflang code?
No. The region code for the United Kingdom is GB, so use en-GB.
Does each page need to list itself?
Yes. Every version should carry the full set of hreflang tags, including one that points to its own URL.
Last updated November 1, 2026. Maintained by SnowRock. How our tools work
All 220 SnowRock tools