SEO guide

Hreflang and multilingual SEO guide: link your language and region versions correctly

If you publish the same content in different languages or for different countries, hreflang is what lets search engines show each user the right version. In this guide you'll find language and region codes, x-default, the reciprocity rule, the three ways to declare hreflang, how it relates to canonical, choosing a URL structure and how to audit hreflang step by step.

11 min readUpdated: November 6, 2026

In short

  • hreflang links the language and region versions of the same content to each other and helps Google show the URL that matches the user's language and country in search results.
  • A code is made of an ISO 639-1 language code and an optional ISO 3166-1 alpha-2 region code: tr, en-GB, de-AT. A region code can't be used on its own.
  • Every version must list itself and all the other versions; Google ignores links that aren't returned.
  • Choosing one of the HTML link tag, the HTTP Link header or the sitemap is enough.
  • The canonical URL of each language version must be itself; a canonical pointing to another language invalidates hreflang.

What does hreflang do?

hreflang is a signal that tells search engines about a page's versions in other languages or regions. Picture a product page with Turkish, English and German versions: without hreflang, Google evaluates the three pages separately and may show the Turkish version to a user in Germany. With hreflang you say that the three are versions of the same content, and Google shows the user the most suitable URL in search results.

hreflang doesn't determine the language of a page. According to Google's documentation, a page's language is understood from the content itself, not from hreflang or the lang attribute. hreflang exists not to boost rankings but to show the right URL to the right person; each version still has to be a good page in its own right.

When do you need it?

  • If you publish the same content in more than one language.
  • If you have pages in the same language aimed at different countries: UK and US pages with different prices, currencies or shipping details, for example. Even if these pages are nearly identical, hreflang lets you say which country each one belongs to.
  • If only the template, such as the menu and footer, is translated and the main content stays in one language. Forums made up of user comments are an example; Google considers this case suitable for hreflang too.

If your site is in one language and aimed at one country, you don't need hreflang.

How do you write language and region codes?

An hreflang value starts with a language code and can optionally take a region code separated by a hyphen:

  • Language: the two-letter ISO 639-1 code. Turkish tr, English en, German de, Arabic ar, Japanese ja.
  • Region: the two-letter ISO 3166-1 alpha-2 country code: TR, DE, GB, US. en-GB means English-speaking users in the United Kingdom.
  • Script: if the same language is written in different alphabets, an ISO 15924 code can be added: zh-Hans for Simplified Chinese, zh-Hant for Traditional Chinese.

A region code can't be used on its own; Google doesn't derive the language from a country code. You can write de-TR for German-speaking users in Turkey, but TR alone is invalid. According to the language tag standard BCP 47, case doesn't matter; the usual convention is a lowercase language code and an uppercase region code.

Commonly confused codes

  • en-UK is wrong, en-GB is right: the ISO code for the United Kingdom is GB.
  • jp isn't a language code; Japanese is ja, while Japan is written JP as a region code.
  • se is a valid language code, but it means Northern Sami, not Swedish; Swedish is sv.
  • Danish is written da, Greek el and Ukrainian uk; DK, GR and UA are country codes and invalid as language codes.
  • Underscored forms such as en_US are invalid; use a hyphen.
  • Numeric region codes such as es-419, used for Latin America, and EU for the European Union aren't ISO 3166-1 alpha-2 country codes. List the countries one by one or use only the language code.

A generic language and regional versions together

You can use a generic language code together with regional codes in the same set. For example, with en-GB, en-US and en, users in the UK and the US see their own versions, while English speakers in Australia or India see the generic version. Google also recommends that, if you have several regional versions in the same language, you provide a generic language version like this for users whose region doesn't match.

Example: a store selling to Turkey and Germany

magaza-ornek.com sells in Turkish lira in Turkey and in euros in Germany, and has set up a separate page for Turkish-speaking customers in Germany. Because prices and shipping details differ, there are three regional versions; English has a single generic version:

<link rel="alternate" hreflang="tr-TR" href="https://magaza-ornek.com/tr/canta">
<link rel="alternate" hreflang="tr" href="https://magaza-ornek.com/tr/canta">
<link rel="alternate" hreflang="tr-DE" href="https://magaza-ornek.com/de-tr/canta">
<link rel="alternate" hreflang="de-DE" href="https://magaza-ornek.com/de/tasche">
<link rel="alternate" hreflang="de" href="https://magaza-ornek.com/de/tasche">
<link rel="alternate" hreflang="en" href="https://magaza-ornek.com/en/bag">
<link rel="alternate" hreflang="x-default" href="https://magaza-ornek.com/en/bag">

There's no regional version that exactly matches a Turkish speaker in the Netherlands or a German speaker in Austria. That's why the Turkey and Germany pages are also listed with the generic tr and de codes; listing the same URL with two codes is valid. This block is the set of four pages, not seven URLs, and appears unchanged on all four pages.

What is x-default for?

hreflang="x-default" is the URL to show when the user's language or country doesn't match any version in the set. It's usually one of two options: a landing page where users choose their language, or the site's main version. On a site with Turkish, English and German versions, a French-speaking user is shown the x-default URL; the version most useful to them is probably English.

x-default isn't mandatory but is recommended. It can point to a language version: listing the same URL as both en and x-default is valid. Like the other codes, x-default follows the reciprocity rule; every version must list the same x-default URL.

Reciprocity: every version must point to all versions

This is the hreflang rule that breaks most often. If page A lists B as its alternate, B must list A too; Google ignores links that aren't returned. According to Google, this rule prevents another site from presenting itself as a version of your page.

The most robust approach is to put the same list on every page in the set. The list contains all versions, including the page itself and x-default. All three versions of a product page with Turkish, English and German versions contain this block:

<link rel="alternate" hreflang="tr" href="https://ornek-site.com/urunler/deri-canta">
<link rel="alternate" hreflang="en" href="https://ornek-site.com/en/products/leather-bag">
<link rel="alternate" hreflang="de" href="https://ornek-site.com/de/produkte/ledertasche">
<link rel="alternate" hreflang="x-default" href="https://ornek-site.com/en/products/leather-bag">

The hreflang="tr" line on the Turkish page may look unnecessary, but Google requires every version to list itself as well. URLs must be fully qualified with the protocol and domain; relative URLs such as /en/ aren't in the form Google asks for. The versions don't need to be on the same domain.

Whenever you add or remove a version, you have to update all versions. That's why generating the list from a template or from the translation relationships in your content management system prevents mistakes, rather than writing it by hand. If a page has no translation, remove that language only from that page's set; hreflang works at the page level, not the site level.

Three ways to declare hreflang

Google supports all three methods; choose the one that best suits how your site is built. Using more than one brings no benefit but increases the risk of conflicting information.

1. Link tags in the HTML

This is the most common method: the tags go in the page's <head> section, as in the example above. It's easy to check, but it adds as many lines to each page as there are versions.

Make sure the tags really stay inside the <head>. When Google meets an invalid element in this section (for example an <img> placed there by mistake), it assumes the section has ended and doesn't read what follows; hreflang lines after that point are ignored.

2. HTTP Link header

Non-HTML files such as PDFs have no <head> section; you declare the alternates in the server's response header, separated by commas:

Link: <https://ornek-site.com/katalog.pdf>; rel="alternate"; hreflang="tr", <https://ornek-site.com/en/catalog.pdf>; rel="alternate"; hreflang="en"

In Nginx you can add the header with add_header in the file's location block:

location = /katalog.pdf {
    add_header Link '<https://ornek-site.com/katalog.pdf>; rel="alternate"; hreflang="tr", <https://ornek-site.com/en/catalog.pdf>; rel="alternate"; hreflang="en"';
}

You can confirm that the header really appears in the response with the HTTP header checker.

3. XML sitemap

This is the tidiest method for large, multilingual sites, because you don't touch the pages' HTML. The xhtml namespace is added to the root element, and each <url> entry lists all versions, including itself, with xhtml:link elements:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://ornek-site.com/urunler/deri-canta</loc>
    <xhtml:link rel="alternate" hreflang="tr" href="https://ornek-site.com/urunler/deri-canta"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://ornek-site.com/en/products/leather-bag"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://ornek-site.com/en/products/leather-bag"/>
  </url>
  <url>
    <loc>https://ornek-site.com/en/products/leather-bag</loc>
    <xhtml:link rel="alternate" hreflang="tr" href="https://ornek-site.com/urunler/deri-canta"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://ornek-site.com/en/products/leather-bag"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://ornek-site.com/en/products/leather-bag"/>
  </url>
</urlset>

Each version must appear as a separate <url> entry, and all of them must carry the same list; listing alternates only in the entries of the Turkish URLs isn't enough. Hreflang in the sitemap is easy to overlook because it doesn't appear in the page source: regenerate the sitemap with every new version.

How do hreflang and canonical work together?

The rule is simple: the canonical URL of each language version is itself. If the English page's canonical points to the Turkish page, Google may treat the English page as a duplicate of the Turkish one, may not index it, and the hreflang set breaks.

  • hreflang should point only to canonical URLs, not to URLs with parameters, a different trailing slash or a redirect.
  • A URL with filter or tracking parameters declares the main page in its own language as canonical, not a page in another language.
  • A noindex page shouldn't be in the set; Google ignores the hreflang tags of a page that isn't indexed.
  • Regional versions in the same language (en-GB, en-US) each declare themselves as canonical even if they're nearly identical. Google may group these pages as duplicates; hreflang still helps the right URL appear in each country.

If you've changed the URL of a language version, redirect the old URL to the new one with a 301 and write the new URL in every hreflang list; details are in the redirect guide.

URL structure for a multilingual site: domain, subdomain or subfolder?

hreflang works with any structure; the choice depends on the needs of your business and team. Google's documentation on multi-regional and multilingual sites compares the options like this:

StructureExampleProsCons
Country-code domainornek-site.deClear country targeting that users recognize from the URL; the sites are easy to separate.A separate domain and registration rules for each country; more infrastructure and maintenance. Links build up separately on each domain.
Subdomainde.ornek-site.comEasy to set up; versions can be hosted on different servers.Users may not understand the country targeting from the URL alone.
Subfolderornek-site.com/de/Easy to set up and maintain; one domain, one certificate, one server.Hard to split versions across separate infrastructure; users may not understand the country targeting from the URL.
Parameterornek-site.com/?lang=de—Not recommended by Google; it's hard to separate versions by URL.

If you target languages rather than countries, a subfolder is the structure that needs the least maintenance. Röntgen works this way too: Turkish pages are at the root, other languages in folders such as /en/ and /de/.

Automatic redirects and cookies

Whatever structure you choose, don't redirect visitors automatically based on their IP address or browser language. According to Google's documentation, Googlebot mostly crawls from IP addresses in the US and without sending an Accept-Language header; a site that redirects automatically may prevent the bot from seeing the other versions. For the same reason, don't change the content's language based on a cookie: each language should have its own URL. Instead, show a language switcher made of normal links and, optionally, a suggestion banner.

Common hreflang mistakes

  • Missing return link. A new language was added but the lists on the older versions weren't updated. Generate the list from a single place.
  • Invalid code. Codes such as en-UK, en_US and jp are ignored. Fix them according to the rules above.
  • Relative URL. Write the full URL with the protocol and domain.
  • Redirected or failing target. The URL in hreflang redirects elsewhere with a 301 or returns 404. Write the final URL and remove deleted versions from all lists.
  • noindex version. A page given noindex because its translation isn't finished was left in the set. Finish the translation or remove the page from the set.
  • Canonical pointing to another language. All versions' canonicals point to the main language. Change each version's canonical to itself.
  • Same code on two URLs. Two different pages are listed with the same code; each code must point to a single URL.
  • Language and content don't match. The page is marked as German but the content is still Turkish, or the lang attribute states another language. Keep the signals consistent with the content.
  • Tags only on the homepage. All pages are linked to the homepage's versions. Each page must point to its own translation.

See a page's hreflang codes, the status of its alternate pages and its return links in one report.

Hreflang checker

Audit hreflang step by step

  1. Write down the set. List all versions of the page you're auditing and the codes you expect: which URL is for which language and region, and which one is x-default.
  2. Open one version with the Hreflang checker. The Hreflang checker reads the link tags in the page's HTML and the HTTP Link header, and checks each code against the ISO rules. It then downloads up to 15 alternate pages and checks their status code, noindex, canonical URL and whether they link back to this page.
  3. Look at the summary boxes. Invalid codes should be zero, every checked page should have a return link, and x-default should be defined.
  4. Read the reciprocity matrix. Each row is an alternate page, and the columns are the codes that page should list. A cell marked “None” shows a version missing from that page's list; you make the fix on that page.
  5. Use the suggested markup. The tool suggests a set with the codes fixed and redirected URLs changed to their final URLs. Put this set on all versions.
  6. Test the other versions too. Check reciprocity once from each version; the most recently added language may have been forgotten in the older versions' lists.
  7. Check the sitemap. If you declare hreflang in the sitemap, the Hreflang checker doesn't see it. The Sitemap validator counts the hreflang links in the sitemap and checks whether the xhtml namespace is declared and the status of random URLs. Check reciprocity in the sitemap file itself, by looking at whether each version's entry carries the same list.
  8. Monitor Search Console. Filter the Performance report by country and check that the version you expect is shown in each country. The URL Inspection tool shows the canonical URL Google has chosen; if Google has chosen another language for a language version, the set is broken.

Checklist

  • All codes are in the ISO 639-1 language format with an optional ISO 3166-1 alpha-2 region.
  • Every version points to itself and all the other versions with the same list.
  • URLs are fully qualified, return 200 and don't redirect.
  • Each version's canonical URL is itself; no version is noindex.
  • x-default is defined and is the same on every version.
  • A single declaration method was chosen, or the methods don't conflict with each other.
  • Visitors aren't redirected automatically; the language switcher is made of normal links.

Frequently asked questions

Does hreflang affect rankings?

Not directly. Hreflang links the versions of the same content to each other and helps Google show each user the URL in their own language or country. Fewer visitors land on a page in the wrong language and bounce straight back, but each version still has to be a good page in its own right.

Which hreflang method should I choose?

If you have few pages, link tags in the HTML are the easiest. On large sites, a sitemap keeps the whole set in one file without bloating the HTML. For non-HTML files such as PDFs, use the HTTP Link header. Choosing one is enough.

Do two country versions in the same language count as duplicate content?

Google may group these pages as duplicates, but when you mark them up with hreflang it shows users in each country the right URL. Country-specific details such as prices, currency, shipping and contact information set the versions apart.

Is a region code mandatory in hreflang?

No. A language code alone (tr, en, de) is enough and covers everyone who speaks that language. Add a region code only if you have different pages per country in the same language; a region code can't be used on its own.

Should I redirect visitors automatically based on their language?

It's not recommended. Googlebot mostly crawls from the US and without sending a language preference; automatic redirects may hide the other versions from it. Show users a language suggestion and leave the choice to them.

How do I find hreflang errors?

Use the Hreflang checker to check a page's codes, the status of its alternate pages and its return links; for hreflang declared in a sitemap, use the Sitemap validator. In Search Console, filter the Performance report by country to monitor which version is shown.

Related guides and tools