Free SEO tool

Hreflang Tag Generator

Enter one line per language version, in the form code | URL. The tool checks the codes and creates hreflang tags for the head and for your sitemap.

What is hreflang tag generator?

Hreflang tags tell search engines which language or regional version of a page to show to which user. They prevent your English page from competing with your French or Spanish page.

The tool validates your language codes and writes both the HTML link tags and the sitemap version.

How to use the hreflang tag generator

  1. List every language version with its code and URL.
  2. Include an x default line for the fallback page.
  3. Copy the tags into the head of every version.

How the hreflang tag generator works

Each line is checked for a valid code, such as en, en-us or x-default, and a full URL. Then a link element with rel alternate, hreflang and href is created for each version. A sitemap version using xhtml:link is created too.

Worked example

Versions for en-us, fr-fr and x-default create three link tags that every page in the set must include.

Common uses of the hreflang tag generator

  • Sites in English and Spanish.
  • Regional shops with different currencies.
  • Global blogs.
  • Government and travel sites.
  • Fixing wrong language results.

Tips and common mistakes

Every version must link to all the others and to itself.

Use language codes in lower case and region codes after a hyphen.

Background: what to know before you rely on it

Hreflang is one of the easiest international SEO features to get wrong, because of its two way rule: if page A points to page B, page B must point back to A. Missing return links cause search engines to ignore the tags. Codes must be valid ISO values, so uk is Ukrainian, not the United Kingdom, which is gb. Use the same method everywhere, either head tags, HTTP headers or the sitemap, to avoid conflicts. Check the International Targeting report in Search Console.

Private, free and fast

This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all seo tools, or browse the full list of tools.

Frequently asked questions

What is x default?

The fallback page for users whose language does not match any version.

Where do the tags go?

In the head of every page version, or in the sitemap.

Are hreflang tags a ranking factor?

No. They help serve the correct version.

Can I mix language and region?

Yes, for example en-gb and en-us.

Related tools

Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Validate markup with search engine testing tools before publishing.