hreflang Tag Generator
Create hreflang tags, HTTP headers, or an XML sitemap for one page or thousands, with every code and URL checked against Google's rules.
- Free
- No sign-up
- Runs in your browser
- Updated
Reads the page's existing hreflang tags and its canonical URL, so you can check and fix them. Nothing is uploaded.
Language versions
List every version of the same page, including the one you're on. Each one gets the same set of tags.
Shown to people whose language or country doesn't match any version. Often the main English page or a language selector.
Pages from a spreadsheet
Put one hreflang code in each column heading and one set of pages in each row. Leave a cell empty when a page has no version in that language.
Your hreflang tags
Checks
How to use the hreflang Tag Generator
-
Add each version
Enter a language code such as
deoren-GBand the full URL for every version of the page. -
Choose a default page
Pick the version, or another URL, to use as
x-defaultfor everyone else. -
Fix flagged codes
Invalid codes and URLs are marked on each version. Select the suggested fix to correct them.
-
Choose a format
Switch between HTML tags, HTTP header, and XML sitemap.
-
Add the tags to every version
Paste the same tags into every page in the set, or add the sitemap entries and submit the sitemap in Search Console.
Example: hreflang tags for a three-language site
A store with US English, UK English, and German pages, using the US page as the default for everyone else.
en-US https://www.example.com/
en-GB https://www.example.com/uk/
de https://www.example.com/de/
x-default Version 1 (en-US)
<link rel="alternate" hreflang="en-US" href="https://www.example.com/" />
<link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/" />
<link rel="alternate" hreflang="de" href="https://www.example.com/de/" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/" />
The German page uses de without a country, so it covers German speakers everywhere. The generator would flag en-UK and suggest en-GB.
This hreflang tag generator builds the annotations that tell Google which language or regional version of a page to show each searcher. Enter the versions of a page, or paste hundreds of sets from a spreadsheet, and you get hreflang tags as HTML, an HTTP header, or an XML sitemap. Every code and URL is checked against Google’s rules as you type, with one-click fixes for common mistakes such as en-UK or en_US. Everything runs in your browser.
How to generate hreflang tags
- Add each version of the page. Enter a language code, such as
deoren-GB, and the page’s full URL. Suggestions appear as you type, with the language and country spelled out. - Choose a default page. Pick the version, or another URL, that people should see when no version matches.
- Fix anything flagged. Invalid codes and relative URLs are marked on the version, with the corrected value one click away.
- Copy the format you need: HTML tags for the page’s head, an HTTP header for PDFs and other files, or XML sitemap entries.

Already have hreflang tags? Use Import from page HTML to paste a page’s source. The tool reads its tags and canonical URL, then tells you whether the page lists itself and which codes need fixing.
What hreflang tags do
hreflang tags link equivalent pages in different languages or for different regions, so Google can show the version that fits each searcher: the German page in Germany, the UK page in the United Kingdom. They don’t make Google detect a page’s language: Google says it determines the language with its own algorithms and ignores the HTML lang attribute for that. They also don’t stop translated pages being seen as duplicates, because Google only treats localized pages as duplicates when the main content is untranslated.
Bing treats hreflang as a much weaker signal than the content-language meta tag, according to a 2020 statement from Bing, so multilingual sites often add both. Yandex supports hreflang in HTML but no longer reads it from sitemaps.
hreflang code format
An hreflang value is a language code from ISO 639-1, optionally followed by a region code from ISO 3166-1 alpha-2. You can also add an ISO 15924 script, such as Traditional Chinese. Codes aren’t case-sensitive, but the convention is lowercase language and uppercase region.
| Code | Valid? | Why |
|---|---|---|
en, de, ja | Yes | Language only: matches speakers in any country. |
en-GB, es-MX, pt-BR | Yes | Language and country. |
zh-Hant, zh-Hant-TW | Yes | Language with a script, optionally a country. |
en-UK | No | The United Kingdom’s code is GB. Google ignores UK, EU, and UN. |
es-419 | No | Numeric regions such as Latin America aren’t supported by Google. |
en_US | No | Use a hyphen, not an underscore. |
gb, jp, cn | No | These are countries. Use en-GB, ja, and zh. |
Watch out for valid codes that mean something unexpected: se is Northern Sami, not Swedish (sv), and kr is Kanuri, not Korean (ko). The generator warns about these lookalikes.
Example: hreflang tags for three versions
A store with a US English page, a UK English page, and a German page would put this block in the head of all three pages:
<link rel="alternate" hreflang="en-US" href="https://www.example.com/" />
<link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/" />
<link rel="alternate" hreflang="de" href="https://www.example.com/de/" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/" />
The German page uses de without a country, so it covers German speakers in Germany, Austria, and Switzerland. The US page doubles as the x-default for everyone else. This is exactly what the hreflang tag generator produces when you load its example and fix the en-UK code.
x-default hreflang
The x-default value names the page to show when no other version matches the searcher’s language or country. Google recommends it, and it was designed for language selector pages, but it can also point to your main version, often the English page. It doesn’t need a language code, and it should appear in the tags on every page in the set.
Return links and self-references
Every page in a set must list itself and every other version. If page A links to page B, page B must link back to A, or Google may ignore the annotations. That’s why the generator gives you one block of tags for the whole set: paste the same block into every page. One page can serve several codes, such as a single English page for both en-GB and en-IE, but each code should point to only one URL.
HTML tags, HTTP headers, or a sitemap
Google treats the three methods the same, and there’s no benefit in using more than one:
- HTML tags go in the page’s
<head>. They’re the easiest to check, but every page needs updating when you add a language. - HTTP Link headers work for files without HTML, such as PDFs. The header is the same on every version.
- An XML hreflang sitemap keeps everything in one file, which suits large sites. Every
<url>entry lists all versions, including itself.

For many pages at once, the hreflang generator has a spreadsheet mode: switch to Many pages and paste from Excel or Google Sheets: one hreflang code per column heading, one set per row, empty cells where a page has no translation. You can download the full sitemap or a CSV with the tags for every URL. A sitemap can hold 50,000 URLs and 50 MB. The alternate links don’t count toward the URL limit, but they add to the file size, and the generator tells you when to split.
hreflang and canonical tags
Each URL in your hreflang set should be the canonical version of that page: indexable, returning a 200 status, and not redirecting. Google says that when you use hreflang, the canonical should point to a page in the same language, or the closest substitute if there isn’t one. A common mistake is giving every language version a canonical tag that points to the English page, which tells Google to ignore the translations. Google also tends to prefer URLs that are part of an hreflang cluster. To check a live page, paste its source into Import from page HTML: the tool compares its canonical URL with its hreflang set.
Common hreflang mistakes
- Missing return links, usually because a new language was added to some pages but not others.
- Wrong codes:
en-UK,en_US, a country on its own, or a three-letter code such aseng. - Relative URLs. hreflang URLs must be absolute, including https://.
- Tracking parameters or #fragments in URLs, instead of the canonical URL.
- Pointing hreflang at redirecting, broken, or noindexed pages.
- Combining hreflang with a
mediaattribute in the same link tag, which Google says not to do.
hreflang in WordPress and Shopify
Most multilingual plugins, such as WPML, Polylang, and Weglot, add hreflang tags automatically, and Shopify adds them for its languages and markets. In that case, use the importer to check the tags they output rather than adding a second set. Search Console’s International Targeting report has been retired, so checking the live HTML is the most direct test.
Once your hreflang tags are in place, check how each version appears in search with the SERP Snippet Preview, make sure no language folder is blocked with the robots.txt Tester, and review each page’s outline with the Heading Structure Checker.
hreflang Tag Generator FAQ
What is an hreflang tag?
A link tag that tells Google which language or regional version of a page to show each searcher, for example the German page in Germany.
Is it en-UK or en-GB?
en-GB. GB is the ISO code for the United Kingdom, and Google ignores UK, EU, and UN in hreflang values.
What does x-default mean?
It names the page to show when no other version matches the searcher's language or country, such as a language selector or your main page.
Do hreflang tags need return links?
Yes. Every page must list itself and every other version. If page B doesn't link back to page A, Google may ignore the tags.
Should I use HTML tags or a sitemap?
Either works for Google, and there's no benefit in using both. Sitemaps are easier on large sites; HTML tags are easier to check, and Yandex reads only HTML.
Does Google support es-419 for Latin America?
No. Google supports only ISO 639-1 languages and ISO 3166-1 alpha-2 countries. Use es, or one code per country.
Related tools
robots.txt Tester
Test any URL against your robots.txt for Googlebot, Bingbot, AI crawlers, and more, with the exact line that decides each result.
SERP Snippet Preview
See your title and meta description as Google shows them on desktop and mobile, with pixel-accurate cut-offs and title checks.
Heading Structure Checker
Check a page's H1–H6 outline from HTML or a pasted document: skipped levels, missing or empty headings, and keyword use.
Open Graph & Twitter Card Generator
Create Open Graph and Twitter card tags with live previews for 4 platforms, OG image size checks, and crop guides.
JSON-LD Validator
Validate JSON-LD against schema.org and Google's rich result rules, find exact syntax errors, and auto-fix common mistakes.
Breadcrumb Schema Generator
Build BreadcrumbList JSON-LD from a URL or your page's HTML, with multiple trails, Google checks, and matching breadcrumb HTML.