Hreflang Tags Generator

Generate hreflang tags for a multilingual or multi-regional site from a list of languages and URLs. The hreflang generator checks every code and gives you HTML tags, an HTTP header, or sitemap entries.

Updated
Built in your browser. Your URLs are not uploaded or stored.
Language versions

Language: ISO 639-1, like en or de. Region (optional): ISO 3166-1, like GB or US. Use full URLs.

The page for everyone else, often a language picker or your main version.

Paste into the <head> of every page in the set.

How to use the Hreflang Tags Generator

  1. Add one row per version of the page under Language versions: a Language code, an optional Region, and the full URL. Press Add language for more rows.
  2. Enter an x-default URL for visitors who match none of the languages, and fix anything listed in red.
  3. Pick HTML tags, HTTP header, or XML sitemap, then copy or download the result. Use the same set on every page it lists.

How it works

Each row becomes an hreflang value: the language alone (de), or language and region joined by a hyphen (es-MX). Checks run before anything is output:

  • The language must be an ISO 639-1 code and the region an ISO 3166-1 alpha-2 code. Frequent slips get a suggestion: en-UK → en-GB, jp → ja, cn → zh, cz → cs.
  • URLs must be absolute (https://...). Google ignores relative hreflang URLs.
  • Each code may appear once. Two codes pointing to the same URL get a warning.

The three outputs carry the same set. HTML tags go in the <head>; the HTTP Link header suits PDFs and other files; the sitemap version repeats the full set inside every <url> entry. Every page must list all the others and itself, or search engines may ignore the set.

Examples

English, British English, and German versions with an x-default:

<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/" />
  • A row with language en and region UK is rejected with the fix: use GB.
  • Region 419 (Latin America) is rejected, because Google does not support it. List es-MX, es-AR, and so on, or use plain es.

Limitations

  • The tool can't check that each URL loads, returns 200, and carries the same tags. Test a few pages after you publish.
  • Script subtags such as zh-Hant are not supported. Use regions instead: zh-TW and zh-HK for Traditional Chinese, zh-CN for Simplified.
  • Use one method per page: HTML tags, headers, or the sitemap. Mixing them makes errors harder to find.

Frequently asked questions

What is hreflang?

An annotation that tells search engines which language or country each version of a page is for, so a visitor in Germany sees the German page in results and a visitor in the UK sees the en-GB one.

Is it en-GB or en-UK?

en-GB. The region part is an ISO 3166-1 country code, and the code for the United Kingdom is GB. en-UK is invalid and gets ignored.

What does x-default mean?

The page to show when no hreflang value matches the visitor's language or country. It is usually a language picker or your main international page.

Does every page need to list itself?

Yes. Each page in the set must include tags for all the versions, its own included. Links that are not returned from the other page are ignored.

Often used together with the Hreflang Tags Generator.