Shiklo Tools
PDF40
Image20
Calculators & Converters25
Text & Writing13
Developer26
Video14
Audio14
Document14
Data & Spreadsheet12
Web & SEO9
OCR & Scanning5
Archive & File12
Security & Privacy23
Health & Medical29
QR & Barcode5

Hreflang Generator

Generate hreflang tags for multilingual and multi-region sites — HTML, XML sitemap or HTTP header — with language and country codes checked.

When a website has versions of the same page in different languages or for different countries, hreflang annotations tell search engines which version to show to which searcher — the German page to German speakers, the UK English page to people in Britain, and a default page to everyone else. Without them, the wrong version can rank, or the versions can compete with each other.

Add each version with its language code (and optional country) and address, and this generator produces the annotations in the form you need: link tags for the page's HTML head, entries for an XML sitemap, or an HTTP Link header for PDFs and other non-HTML files. Every code is checked against the ISO standards — including the common mistake of writing UK instead of GB — along with each address, duplicates and a missing x-default. Nothing is sent anywhere.

How to use Hreflang Generator

  1. Add a row for each language or regional version of the page, or press Sample.
  2. Enter its hreflang code (such as en, en-GB or x-default) and full address.
  3. Choose HTML tags, XML sitemap or HTTP header.
  4. Fix any problems shown, then copy the code into every version of the page.

Features

  • HTML link tags, XML sitemap entries or an HTTP Link header.
  • Language codes checked against ISO 639-1.
  • Country codes checked against ISO 3166-1 (and UK flagged).
  • Script subtags such as zh-Hant supported.
  • Warnings for duplicates, a missing x-default and missing fallbacks.
  • Up to 50 versions per page.
  • Runs in your browser; nothing is sent anywhere.

Hreflang codes

A code is a language, optionally followed by a country. The language uses ISO 639-1 two-letter codes; the country uses ISO 3166-1 two-letter codes. A script can be added between them for languages written in more than one script. The special value x-default marks the page for everyone whose language is not listed.

CodeMeans
enEnglish, anywhere
en-GBEnglish for the United Kingdom (not en-UK)
de-CHGerman for Switzerland
es-419Not supported by search engines — use es or es-MX
zh-Hant-TWChinese, traditional script, for Taiwan
x-defaultDefault page for all other visitors

The rules search engines apply

Every version must list all versions, including itself — if the French page links to the English page, the English page must link back, or the annotations are ignored. Use full absolute addresses including https. Each address should return the page directly, not a redirect, and should be the canonical version of that page. The country alone is never enough: hreflang always starts with a language. And a language with country versions benefits from a plain language version too, so a German speaker in Austria still gets German when only de-DE and de-CH exist.

HTML, sitemap or header?

All three methods are equivalent; choose one per page and do not mix them. HTML link tags in the head are the simplest for small sites. XML sitemaps keep the annotations out of the pages, which is easier for large sites with many languages — each URL entry repeats the full list of alternates. The HTTP Link header is the only option for non-HTML files such as PDFs. The sitemap output includes the required xhtml namespace and one entry per language version.

Checking your work

After adding the annotations, check them in Google Search Console and with a crawler, and look for return-link errors. Make sure each language version's content really is in that language. Language codes are validated here with your browser's built-in list of ISO codes, so very new or rare codes may depend on how up to date your browser is. Use the Sitemap Validator to check a sitemap after adding hreflang entries.

Frequently asked questions

What is hreflang?

An annotation that tells search engines which language or regional version of a page to show to which users.

Is it en-UK or en-GB?

en-GB. GB is the ISO 3166-1 code for the United Kingdom; UK is not valid.

Do I need x-default?

It is recommended, for users whose language or region you do not target — often your main page or a language picker.

Where do I put hreflang tags?

In the head of every version of the page, in your XML sitemap, or in an HTTP header — one method per page.

Do all pages need to link to each other?

Yes. Each version must list every version, including itself.

Is my data sent anywhere?

No. Everything happens in your browser.

Related tools