tigtools

Hreflang Tag Generator

List each language or regional version of a page with its URL, add an x-default, and copy the hreflang code in the format you need.

Runs in your browser No sign-up

Language versions
  1. For example en, en-GB, pt-BR, zh-Hant

  2. For example en, en-GB, pt-BR, zh-Hant

The page for users whose language or region is not listed, often a language picker or the main version.

Output format

Add at least two language versions with valid URLs to generate code.

Every page in the set must carry the same complete list, including a link to itself. If page A links to page B but B does not link back to A, the annotation may be ignored.

How to use it

  1. Add one row per language or regional version: the code (such as de or de-AT) and the full https:// URL of that version.
  2. Optionally add an x-default URL for visitors whose language is not covered.
  3. Fix any errors shown next to the rows, then choose HTML tags, XML sitemap entries or an HTTP header.
  4. Copy the code and add the same set to every listed page, so each page lists all versions including itself.

How it works

hreflang tells search engines which URLs are language or regional versions of the same content, so that, for example, a searcher in Austria can be shown the de-AT page instead of the de-DE page. The value is an ISO 639-1 language code, optionally followed by an ISO 3166-1 alpha-2 region code; a region alone (such as “GB”) is not valid. Common mistakes the tool catches are en-UK (the correct code is en-GB), regions that are not countries such as EU, and duplicated codes. Codes are checked against the language and region data built into your browser.

The annotations must be bidirectional and self-referencing: every page in the set lists every version, including itself. If the German page points to the French page but the French page does not point back, search engines can ignore the pair. x-default marks the fallback page for everyone else. Use absolute URLs, and point each hreflang to the canonical version of that page, not to a redirect or a page with a noindex tag.

There are three equivalent ways to publish the annotations: link elements in the HTML head, xhtml:link entries in an XML sitemap, or an HTTP Link header. Pick one method per page set; using more is not needed. hreflang is a hint for choosing between versions, not a ranking boost.

Examples

English and German site

Rows en → https://example.com/ and de → https://example.com/de/ plus x-default → https://example.com/ produce three link tags. Both the English and the German page must include all three.

Spanish for Spain and Mexico

Use es-ES and es-MX for the two regional versions, and add a plain es version (or point es to one of them) so Spanish speakers in other countries are covered too.

Fixing a common error

en-UK is flagged: UK is not the ISO 3166-1 code for the United Kingdom. Change it to en-GB.

Frequently asked questions

Do I need x-default?

It is optional but recommended. It tells search engines which page to show when none of the listed languages or regions match the user, for example a global English page or a language selector.

Can I use a region without a language, such as hreflang="us"?

No. The language is required; the region is optional. “us” is not a language code. Use en-US instead.

Should I use HTML tags or the sitemap?

Either works. HTML tags are simplest for small sites. Sitemaps keep the page HTML small and are easier to manage for many languages. HTTP headers are mainly for PDFs and other non-HTML files.

Can two language codes point to the same URL?

Yes. For example en-GB and en-IE can both point to one British English page. What is not allowed is the same code pointing to two different URLs.

Privacy

Codes and URLs are checked and formatted in your browser. Nothing is sent or stored.