Skip to content

← All tools

Free webmaster tool

hreflang tag generator

List each language or regional version of a page with its address and get the hreflang markup in three forms: HTML link tags, sitemap entries and an HTTP Link header. Language and country codes are checked against the ISO lists, so mistakes like en-UK or zh_CN are caught before Google sees them.

Examples: en-US https://example.com/ · fr https://example.com/fr/ · zh-Hans https://example.com/zh/. Separate with a space, comma or =.

The page for visitors whose language you do not list, often a language picker or the English page.

Check one code

en-UK: not a known ISO 3166-1 country code. Did you mean GB?

Checks

No problems found.

Reminder: hreflang only works when pages point at each other. Every version needs the same full set of links.

Put these lines in the <head> of EVERY language version. Each page must list all versions, including itself.

How it works

  • •Write one version per line: a code (en, en-GB, fr-CA, zh-Hans) then the full address. Add an optional x-default address for visitors whose language you do not cover.
  • •Read the checks. Unknown languages, wrong country codes, repeated codes, relative addresses and a missing x-default are all flagged, with a suggested fix where there is an obvious one.
  • •Pick a form. Paste link tags into the head of every version, or use the sitemap or header version if you cannot edit pages. Every version must carry the complete set.

What it does and what it cannot do

  • •It writes the markup. It cannot crawl your pages to confirm that every version links back to the others, which Google requires.
  • •Language codes are checked against ISO 639-1 (two letters) and country codes against ISO 3166-1. Three-letter languages and script subtags are accepted with a note.
  • •hreflang is a hint. Google may still show another version, and Bing mostly uses the content-language header and the page language instead.
  • •Use one form per page set. Mixing HTML tags, sitemap and headers is allowed but makes mistakes harder to find.

Questions

What is hreflang for?
It tells Google which language or regional version of a page to show to which searcher, so a French visitor sees your French page and a UK visitor sees the UK page instead of the US one.
What is x-default?
It names the fallback page for visitors who match none of your listed languages, usually your language picker or main English page. It is optional but recommended.
Why must every page link to all the others?
hreflang is only trusted when both pages confirm each other. If page A points to B but B does not point back to A, Google may ignore the pair. Each page must list every version, including itself.
Is it en-UK or en-GB?
en-GB. UK is not an official ISO 3166-1 country code, so en-UK is invalid. The tool flags it and suggests GB.
Can I use a country without a language?
No. hreflang needs a language, with an optional region after it. A value like US alone is invalid; use en-US.
Which form should I use?
HTML link tags are the easiest to check. Sitemaps are best for large sites with many versions, and HTTP headers are the only option for non-HTML files such as PDFs.

Related tools