The hreflang tag is markup that tells Google, when the same content exists in different language or regional versions, "which version should be shown to which user". On a site with separate Turkish and English versions, showing the Turkish page to an English-speaking visitor, or the English page to someone searching in Turkish, loses both the user and you. A correctly implemented hreflang reduces this confusion. When it is implemented incorrectly, Google may ignore the tags altogether. In this article we go through the setup, the code, and the most common mistakes step by step.
What is the hreflang tag?
Hreflang is a rel="alternate" link that lists a page's "alternative versions". Each version shows all
the other versions as well as itself, along with a language code. When Google sees this set, it shows the address
that best matches the language and region of the person searching in the results.
An important distinction: hreflang is not a ranking booster. It does not determine what position your page will rank at; it only helps choose the right version among versions that are already in the results. Google treats it as a hint rather than a strict directive. For details on canonical versions, see our canonical tag guide.
Consider a simple example: on a site where the same product is sold to both Turkey and Germany, showing a Turkish product page to a user in Germany who searches for "Schuhe kaufen" loses the sale. Here hreflang acts as a redirect signal to Google saying "the German version is more suitable for this user". If the page content and pricing are not suited to that region, the tag alone is not enough; translation and localization (currency, measurement units, delivery information) are equally important.
When is it needed, and when is it not?
Consider hreflang in these situations:
- If the same page has translated versions in several languages (such as tr, en, de).
- If the same language has regional versions (for example
en-gbanden-uspages where prices, currency and shipping information differ). - If you have store or service pages that differ by country.
It is not needed in these cases: your site is monolingual, your versions carry completely different content from each other, or you are considering marking pages that were never translated into a language version (pages still in Turkish). Assigning a different language code to an untranslated page gives wrong information to both users and Google. Also review machine-translated versions with human eyes before publishing; poor-quality, unchecked translation causes problems regardless of hreflang.
Three ways to add hreflang
Google considers the three methods equivalent. Whichever you choose, sticking to one method and staying consistent is the safest approach.
| Method | Where it lives | When it is suitable |
|---|---|---|
HTML <link> | In the <head> section of each page | Small and medium-sized sites, pages generated from a template |
| HTTP header | In the server response header (Link:) | Non-HTML files, such as PDFs |
| XML sitemap | xhtml:link elements in the sitemap file | Large sites with many pages and languages; does not bloat each page's HTML |
On large sites the sitemap method makes maintenance easier, because all the matches live in one place. For the general rules of sitemaps, take a look at our XML sitemap guide.
Code example: a trilingual site
On the home page of a site that has Turkish, English and German versions, the following lines are added to the
<head> section. Exactly the same lines must be present on all three versions:
<link rel="alternate" hreflang="tr" href="https://ornek.com/tr/" />
<link rel="alternate" hreflang="en" href="https://ornek.com/en/" />
<link rel="alternate" hreflang="de" href="https://ornek.com/de/" />
<link rel="alternate" hreflang="x-default" href="https://ornek.com/" />
Points to watch:
- Addresses must be complete (absolute); they must include the domain name starting with https.
- Each page must also list itself (self-reference).
x-defaultshows your language selector page, or your default page for users whose language does not match any version. It is optional, but useful on multilingual sites.- The canonical tag of each language version must point to itself. Giving canonical for all languages to a single version makes hreflang ineffective.
Reciprocity is essential: If the Turkish page points to the English page, the English page must also point back to the Turkish page (the "return tag"). Markup without a counterpart may be ignored. The vast majority of hreflang errors stem from this rule.
Language and region codes
The language code is the two-letter code from the ISO 639-1 standard (tr, en, de).
If you wish, a region code from the ISO 3166-1 Alpha-2 standard can be appended (en-gb,
de-at). The rule is simple: language first, then an optional region.
| Correct | Incorrect | Why it is wrong |
|---|---|---|
en-gb | en-uk | The ISO region code for the United Kingdom is GB, not UK |
en or en-us | us | A region code alone cannot be used; the language is mandatory |
tr | turkish | The standard code must be written, not the language name |
pt-br | pt_BR | A hyphen is used, not an underscore |
Use a region code only if the same language has versions that genuinely differ by region. If you serve only Turkish
content, writing tr-tr is unnecessary; tr is enough.
URL structure for a multilingual site
Hreflang works regardless of which URL structure you choose, but the structure does affect maintenance and measurement:
- Subfolder (
ornek.com/en/): management is easy under a single domain, and it is tracked as one property in Search Console. It is the practical choice for most sites. - Subdomain (
en.ornek.com): useful when separate servers or teams are needed, but you may have to track it as a separate property. - Country domain (
ornek.de): shows the country target most clearly, but you build the authority of each domain separately and costs increase.
Pages that change language only through a cookie, an IP address or browser settings, while their URL stays the same, are not counted by Google as separate versions. Each language version must have its own, linkable address. Avoid automatically redirecting users to another version based on their location; search bots usually come from a single location and may never see the other versions. Instead, offer a visible language selector.
Implementation plan: step by step
When adding hreflang to an existing site, following this order reduces the risk of errors:
- Extract a page inventory. Write in a table which page has a real counterpart in which languages. Let rows be pages and columns be languages; an empty cell means "there is no counterpart in this language".
- Choose the method. For up to a few hundred pages, HTML
<link>is usually more convenient; for larger sites, the sitemap method is usually easier. - Define the codes. Decide whether only the language or both the language and region are needed, then fix the list; changing it later means reorganizing all pages.
- Automate it in the template. Have your CMS or theme generate the counterparts for each page automatically. Hand-written tags break over time.
- Try it on a small section first. For example, start with a single category, check it with a crawling tool, and then expand.
- Then monitor. When a new page is added or a language version is deleted, the matches must be updated; old tags pointing to a deleted page turn into errors.
If you remove a language version, remember to also remove the line for that language from the other versions. Such leftovers, if overlooked, become the source that produces the most errors over time.
The most common mistakes
| Mistake | Result | Solution |
|---|---|---|
| No return tag | The markup is ignored | Every version must list all versions |
| Hreflang address redirects or returns 404 | The match cannot be established | Only list final addresses that return 200 |
| Page referenced in hreflang is noindex | Useless, since that version does not enter the index | Remove the noindex or take that address off the list |
| Canonical points to another language version | Google sees conflicting signals | Each version should carry its own canonical |
Wrong code (such as en-uk) | The tag is considered invalid | Check the ISO codes |
| Set up only on the home page | Internal pages get mixed up | Each page must show its own counterpart |
Another common situation: if there is no one-to-one match between versions (an English product page exists but no German one), do not add a German line for that page. Hreflang works only with counterparts that actually exist.
Validation and testing
- Source code check: Right-click the page, view the source, and search for
hreflang. If it is added with JavaScript, use the URL Inspection tool in Search Console to view the HTML Google sees. - Crawling tool: A desktop crawling tool shows the hreflang columns in a single table and catches missing return tags and invalid codes in bulk.
- Sitemap: If you use the sitemap method, make sure every
urlentry contains all language counterparts. - Real searches: On a device in the target country or with a different search language setting, check whether the correct version appears in the results.
To review hreflang alongside other items in general technical checks, you can use our technical SEO checklist. For Google's official explanation, see its documentation on multilingual and multi-regional sites.
Frequently asked questions
Does hreflang raise rankings?
No. It does not directly affect rankings; it only helps show users the correct language or regional version.
Is hreflang needed on a monolingual site?
No. You do not need to use it on sites that serve content in only one language and one region.
Can hreflang and canonical be used together?
Yes, they work together. Each version points its canonical to its own address, and hreflang links the versions to one another.
I added the tags but the results did not change immediately. Why?
It takes time for Google to recrawl all the versions. It may take days to see the effect, and weeks on large sites.
Conclusion
Hreflang is a small but meticulous task that ensures the right page reaches the right user on a multilingual site. The golden rules are short: every version should list all versions including itself, the codes should be standard, the addresses should return 200, and nothing should conflict with canonical. After setup, check once with a crawling tool, and then recheck after major changes. If you are considering producing multilingual content, first conduct keyword research and evaluate each language's search habits separately; word-for-word translation is often not enough.