Hreflang Tag Generator
List your language versions and copy hreflang link tags, a Link header or sitemap entries, with checks for the mistakes that make Google ignore them.
Last checked
Language versions
English
English (United Kingdom)
German
Fallback for unmatched languages
hreflang code
<link rel="alternate" hreflang="en" href="https://example.com/" /> <link rel="alternate" hreflang="en-GB" href="https://example.com/uk/" /> <link rel="alternate" hreflang="de" href="https://example.com/de/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />
- Checkhttps://example.com/ is used for both en and x-default.
- OKPut the same full set on every version, including a link to the page itself (return links).
Many pages
Pattern: example.com/uk/page
<!-- https://example.com/ --> <link rel="alternate" hreflang="en" href="https://example.com/" /> <link rel="alternate" hreflang="uk" href="https://example.com/uk/" /> <link rel="alternate" hreflang="de" href="https://example.com/de/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" /> <!-- https://example.com/pricing --> <link rel="alternate" hreflang="en" href="https://example.com/pricing" /> <link rel="alternate" hreflang="uk" href="https://example.com/uk/pricing" /> <link rel="alternate" hreflang="de" href="https://example.com/de/pricing" /> <link rel="alternate" hreflang="x-default" href="https://example.com/pricing" /> <!-- https://example.com/blog/first-post --> <link rel="alternate" hreflang="en" href="https://example.com/blog/first-post" /> <link rel="alternate" hreflang="uk" href="https://example.com/uk/blog/first-post" /> <link rel="alternate" hreflang="de" href="https://example.com/de/blog/first-post" /> <link rel="alternate" hreflang="x-default" href="https://example.com/blog/first-post" />
- OK3 pages: every version lists itself and the same set of alternates, so the return links match.
Check existing hreflang
For each language version, enter its URL and paste its <head> (or just the link tags). The checker matches self-references and return links between the pages you paste.
- Paste two or more versions of the same page
- Missing self-references and return links are flagged
- A canonical pointing elsewhere is flagged too
How to use it
- Enter one row per language version: a code such as en, en-GB or de, and the full URL of that version.
- Add an x-default row for the page you want people to land on when no version matches their language.
- Pick HTML, HTTP header or sitemap, fix anything the checks flag, and copy the same set onto every version of the page.
- To audit what a site already has, open Check existing hreflang, add each version's URL and paste its head HTML (view source, copy the head), or paste the sitemap. Fix every Fix line, then re-check.
- For a whole site, open Many pages: pick a URL pattern and list your paths, or paste a CSV with a header row of codes and one page per row, then copy the per-page tags or download sitemap.xml.
What it checks and why
hreflang tells Google which URLs are language or regional versions of the same page, so a searcher in Germany gets the German page and one in the UK gets the British one. Google reads it from link tags in the head, from an HTTP Link header (useful for PDFs), or from xhtml:link entries in a sitemap. Use one method; they do the same job.
The value is a language code from ISO 639-1, optionally followed by a region from ISO 3166-1 alpha-2, such as en-GB. A region on its own is not valid, so de means German everywhere, not Germany. The usual slips are en-UK (the code for the United Kingdom is GB), underscores instead of hyphens, and relative URLs.
Every version has to list all the others and itself. Google's documentation says that if page A links to page B, B must link back to A, or the annotations may be ignored. x-default marks the fallback page, often a language picker or the main version.
Google's guidance on multi-regional sites describes the common URL structures: country domains, subdomains, subdirectories and URL parameters, and advises against parameters. The pattern templates build the alternates for each of these, so a path such as /pricing becomes the full set of language URLs in one step.
In a sitemap, each language URL gets its own url entry, and every entry repeats the full list of alternates, itself included. The bulk checks look for a URL that two page rows both claim, which would give those versions different alternate lists and break the return links.
Specs and sources
Limits
- Codes are checked with your browser's Intl data, so a very new or rare code may be reported differently in another browser.
- It does not fetch your pages. Return links and canonicals are checked only for the versions you paste; it cannot see whether a URL redirects or returns an error.
- The single-page sitemap output covers one set of alternates; use Many pages for a full sitemap.
- Pattern templates assume every page exists in every listed language; drop missing versions by using the CSV input with empty cells instead.
- Bulk checks only see the set you enter: they cannot tell whether a URL resolves, redirects or carries a different canonical.
- The sitemap is not split; the sitemaps protocol caps one file at 50,000 URLs and 50 MB uncompressed.
Questions
- What is the hreflang code for the UK?
- en-GB. The ISO 3166-1 code for the United Kingdom is GB, so en-UK is not a valid region and uk on its own means the Ukrainian language.
- Do I need x-default?
- It is optional. Google recommends it for the page to show when no other version matches the searcher's language, such as a language picker or your main version.
- Should hreflang include the page itself?
- Yes. Each version lists every version, including itself, and the set should be the same on every page.
- HTML tags or sitemap: which is better?
- Google treats them the same. Tags in the head are simplest for a few versions; a sitemap keeps big sets out of every page; the HTTP header works for files that are not HTML.
- Can I use a country code without a language?
- No. The first part must be a language. To target a country, add the region after the language, such as de-AT or fr-CA.
- How do I add hreflang for a whole site?
- Use Many pages. Either choose your URL pattern (subfolder, subdomain, country domain or query parameter) and list the paths, or paste a CSV with one row per page and one column per language. You get tags for each page and a sitemap.xml with all alternates.
- Is es-419 a valid hreflang code?
- It is a valid language tag, but Google's hreflang docs support only ISO 3166-1 alpha-2 region codes, and 419 (Latin America) is a UN M.49 area code. Use plain es, or one tag per country such as es-MX and es-AR.
- Should each hreflang page have a self-referencing canonical?
- Yes. Each version in the set should be the canonical of itself. A canonical that points to another language version tells Google to index that URL instead, which works against the hreflang set.
- Do I need hreflang for the same language in different countries?
- Only if the pages differ, for example prices, spelling or shipping for en-US, en-GB and en-IE. Google's docs cover this case: list each regional version with its own language-region code, plus a plain en version if you have one.
- What does a hreflang return link error mean?
- Page A lists page B as an alternate, but B does not list A back, or lists a different set. Google's docs say that if two pages do not both point to each other, the tags are ignored. Paste both pages into Check existing hreflang to see which link is missing.