The hreflang tag, also called the hreflang attribute, is a line of HTML code used to tell search engines which language and country version of a page to show. It helps Google and others link alternate versions of the same content to users in different locations, based on their language or region.
For example, a website with English, Spanish, and French product pages can use hreflang to show the right version in Spain or France. Google first introduced this tag in 2011 to solve problems on multilingual and multi-regional websites, and it is now a core part of international SEO.
Understand how the hreflang tag improves SEO
The hreflang tag is mainly used to help search engines show the right language and region version of a webpage to each user. This improves multilingual SEO by connecting people to content in their own language. For example, a user in Germany will see the German version of a page instead of the English one.
This tag also helps avoid duplicate content problems. Without hreflang, search engines may treat pages in different languages as copies and get confused about which one to show. The hreflang attribute tells them that these pages are the same in meaning but made for different users, so all versions can be indexed safely.
Even though hreflang is not a direct ranking factor, it protects a site’s visibility by making sure the right version appears for the right audience. It also improves user experience by reducing bounce rate and keeping users on the site longer, which supports stronger engagement signals.
How websites use the hreflang tag
The hreflang tag is used when websites serve content in different languages or for different countries. It helps search engines link the alternate versions together, so users see the page that matches their language or region.
Some typical uses include:
- Full translations: When a website offers the same product or service in multiple languages (such as English and Spanish), hreflang connects these versions to avoid confusion in search results.
- Regional variants: Some pages use the same language but change content based on the country. For example, an English page for India may show different prices or shipping rules than one for the UK. The hreflang tag uses regional codes to serve the correct version.
- Partially translated content: Forums and platforms with translated navigation but user posts in the original language also use hreflang. This tells search engines that the structure may vary, but the pages are related.
In all these cases, the hreflang attribute signals that each version is meant for a different audience, not duplicate or unrelated pages.
How websites use the hreflang tag
The hreflang tag can be implemented in three ways:
- using HTML link tags in the page head
- listing alternate versions in a sitemap
- setting values through HTTP headers
All three methods serve the same function. Website owners can use the one that suits their setup. There is no need to use more than one method for the same page.
HTML method
The most common way is to add link elements in the page <head>. Each alternate version gets its own line, including the page itself. The syntax is:
<link rel=”alternate” hreflang=”xx” href=”https://example.com/page-xx.html” />
- hreflang=”xx” is the language or region code
- href is the full URL of the alternate version
Examples:
<link rel=”alternate” hreflang=”en” href=”https://example.com/en/page.html” />
<link rel=”alternate” hreflang=”es” href=”https://example.com/es/pagina.html” />
<link rel=”alternate” hreflang=”fr” href=”https://example.com/fr/page.html” />
<link rel=”alternate” hreflang=”x-default” href=”https://example.com/global/page.html” />
In these examples:
- en, es, and fr stand for English, Spanish, and French
- x-default is a special case used for a general page (like a homepage or language selector) when no exact match exists
Language codes follow ISO 639-1 format (two letters like en for English). Region codes use ISO 3166 (like US for United States) and appear after a hyphen (e.g., en-US).
XML sitemap method
An XML sitemap can list all alternate URLs for a page using <xhtml:link> tags. This method is useful for large websites where all versions are managed in one place.
HTTP header method
For non-HTML files (like PDFs), HTTP headers can send hreflang data. The server adds a Link: header with language and URL pairs. This works when adding HTML code is not possible.
How to set up hreflang correctly
Correct setup of the hreflang tag is important for search engines to understand language versions. Even small errors can cause search engines to ignore the annotations. Google’s documentation outlines several best practices that help avoid this.
Use bidirectional linking
Every page should include hreflang links to all its alternate versions, including itself. For example, if an English page links to a Spanish page, the Spanish page must also link back to the English one. If a version is missing or fails to list itself, the system may not work as expected.
Always use full URLs
Each hreflang link must contain the full URL, including the domain and protocol (http or https). Short or relative paths should not be used. If different country domains are used, full links are still needed for clarity.
Use valid language and region codes
- Use two-letter language codes based on ISO 639-1, such as en for English or fr for French
- If regional targeting is needed, add a country code from ISO 3166, like en-US or fr-CA
- Use only the language code if region differences are not required
It is better to avoid overuse of country codes unless the content is actually different. For example, fr-FR should be used only if the page content is different from fr-CA.
Include a fallback with x-default
Add a hreflang=”x-default” link to cover cases where no language or region fits. This link usually points to a generic homepage or a language selector page.
Keep pages in sync
Every time a new version of a page is added, update all related pages to link to it. Although not all links are required if the list gets very long, complete linking helps search engines map the full group correctly.
Hreflang does not replace the canonical tag. If two pages in the same language exist (such as one for the US and another for Canada), choose one as canonical. Use hreflang so that users in each country still see the right version in results. When pages are in different languages, canonical tags are not needed.
Test hreflang implementation
Google used to provide the International Targeting report in Search Console, but it was removed in 2022. Now, webmasters must check their hreflang tags using browser extensions, third-party tools, or Google’s own testing services.
The hreflang attribute is mainly used by Google and is also supported by Yandex. It helps search engines choose the best language or country version of a page to show based on the user’s settings or location.
How Google uses hreflang
Google treats hreflang as a hint, not a rule. When a person searches, Google checks if a page has alternate language versions. If it finds them, it may swap the main URL for a version that fits the user’s language or region preference.
This decision depends on:
- The user’s browser or Google language settings
- The location detected by Google at the time of search
- Whether the alternate pages are indexed and clearly different
If Google sees two very similar versions—like fr-FR and fr-BE with the same text—it may pick one as the canonical version. In such cases, it might show that version to everyone, even if hreflang links are present. To avoid this, site owners are advised to include small content differences or regional details so that each version is treated as unique.
Yandex and hreflang
Yandex, the leading search engine in Russia, supports hreflang tags much like Google. In fact, Google and Yandex worked together in 2013 to define support for the x-default value, used for fallback or language selector pages. This makes hreflang effective for both Google and Yandex users in multilingual markets.
Bing and Yahoo
Bing, run by Microsoft, does not officially support hreflang tags the same way. Instead, it focuses on:
- The Content-Language meta tag
- Use of country-code top-level domains (ccTLDs)
- Geotargeting settings in webmaster tools
Although adding hreflang does not hurt, Bing treats it as a very weak or ignored signal. Since Yahoo Search is powered by Bing, it follows the same behavior. To cover Bing users, it helps to also set correct meta language tags or HTTP headers.
Role in ranking
The hreflang tag does not improve rankings. All language versions compete based on normal signals like content quality, relevance, and backlinks. What hreflang does is ensure that the correct regional version appears in search results. This creates a better user experience and makes a website feel more trustworthy and accessible.
By matching users with content in their own language, hreflang supports the goal of people-first search results. Users do not have to click around or find a language selector—they get the right page directly from the search engine.
Search engines adopted hreflang over time
Introduction by Google
Google launched the hreflang attribute in December 2011 to improve international search results. It offered webmasters a standard method to specify language and region versions of content. This solved key problems in multilingual and multi-regional websites, where the same page needed to appear in different languages or with local content changes.
Early use cases
At launch, Google supported two primary use cases:
- Translated content: The same product or article written in different languages
- Regional variants: Same-language content tailored by currency, delivery options, or units of measurement
These allowed site owners to guide users to the most suitable page version without affecting SEO performance.
Yandex support and x-default extension
In 2012, Yandex, the top search engine in Russia, started recognizing hreflang. By 2013, Google and Yandex jointly introduced the x-default value. This special tag is used to define a generic landing page not tied to a specific language or location, often a homepage or language selector.
Tooling in Google Webmaster Tools
To help with implementation, Google added the International Targeting report to Webmaster Tools (now Search Console) in 2014. This tool flagged errors such as:
- Missing return links
- Invalid hreflang codes
- Non-reciprocal references
These checks helped site owners set up hreflang properly and monitor it over time.
Growing adoption in SEO
By the late 2010s, the hreflang tag had become standard in technical SEO for global websites. Google updated its best practices and documentation regularly, warning against common issues and stressing consistency across alternate versions.
Deprecation of reporting tool
In 2022, Google removed the International Targeting report. It explained that Search Console and internal systems now handle minor hreflang inconsistencies automatically. Even without the tool, hreflang remains fully supported in search behavior.
Current role in SEO
Today, hreflang annotations are considered essential for any site that targets users in multiple countries or languages. They improve search accuracy, increase user satisfaction, and support a more people-first experience in search results.
References
- https://en.ryte.com/wiki/Hreflang/
- https://yoast.com/hreflang-ultimate-guide/
- https://localizely.com/blog/hreflang/
- https://developers.google.com/search/docs/specialty/international/localized-versions
- https://developers.google.com/search/blog/2013/04/x-default-hreflang-for-international-pages
- https://developers.google.com/search/docs/specialty/international/managing-multi-regional-sites
- https://www.searchenginejournal.com/google-reminds-that-hreflang-tags-are-hints-not-directives/546428/
- https://twitter.com/googlesearchc/status/1562369672430997504