hreflang tag generator
Show your Turkish page to people searching in Turkish and your English page to those searching in English. Enter the language versions; the block of tags is ready below.
Result
3 lines are ready. Put the same block in the <head> of every page on the list.
Formula
- <link rel="alternate" hreflang="language-REGION" href="full address" />
- language: ISO 639-1 code (tr, en, de) · region optional: ISO 3166-1 alpha-2 code (TR, GB, DE)
- x-default: the version shown when no language matches
One line is written for each language version, and the same block goes in the <head> of every version, the page itself included. Addresses must be full ones starting with https://.
Worked example
Your Turkish page is at https://www.example.com/ and its English counterpart at https://www.example.com/en/. You write tr for Turkish and en for English; to show the English version to people searching in other languages, you give the English address as x-default.
The tool produces three lines: tr, en and x-default. The same three lines sit in the <head> of both the Turkish and the English page, so the two pages point to each other.
How to read the result
- The tool checks the format of the codes; it does not visit your pages. Check separately that the addresses open, do not redirect and can be indexed.
- The tags have to be reciprocal: if page A points to B but page B does not point back to A, search engines may ignore the pairing.
- hreflang is a signal; in the end the search engine decides which version to show. The content of the page has to be in that language, too.
- On sites with many pages, giving the same information in the XML sitemap instead of the <head> makes upkeep easier.
Questions
The questions that come up most about this calculation. If yours is not here, write to us and we will answer within one working day.
What is an hreflang tag?
hreflang is a tag that tells search engines about the versions of a page in other languages or for other countries. With it, a search engine can show the Turkish page to someone searching in Turkish and the English page to someone searching in English. The tag can go in the page’s <head>, in an HTTP header or in the XML sitemap.
What is x-default for?
x-default names the page to show when the user’s language or country matches none of the listed versions. It is not required, but it is recommended. On most sites it is either a language-selection page or the version that suits international readers best, usually the English page.
Why is en-UK wrong?
Region codes come from the ISO 3166-1 alpha-2 list, and the code for the United Kingdom on that list is GB; the correct value is en-GB. A similar mistake is writing the region on its own: hreflang="TR" is invalid, because the language code always comes first.
Related guides
- Technical SEO checklist: 9 steps with free toolsWith Search Console, PageSpeed Insights and a browser: auditing your site’s technical footing yourself, from indexing to hreflang.
- Website redesign SEO: how to avoid losing rankingsHow to move to a new site without leaving behind the value your old addresses have built up over the years.
- B2B SEO: what it is, how it differs, how to do itFinding the rarely searched queries made in the middle of a buying process, meeting them with the right page and measuring the result in sales.