What Is Hreflang?
Hreflang is an HTML attribute that tells search engines which language and regional version of a page should be served to users in specific locations. Introduced by Google in 2011, the hreflang attribute is placed within <link> elements and creates a signal that helps search engines understand the relationship between pages that share the same content but target different languages or regions.
The attribute follows a simple format: hreflang="en" for English, hreflang="es" for Spanish, or hreflang="en-GB" for English specifically targeting users in the United Kingdom. When implemented correctly, hreflang ensures that a French-speaking user in Canada sees the fr-CA version of your page in search results rather than the English version or the France-targeted French version.
Without hreflang, search engines must guess which version of your content to show to which audience. That guessing leads to the wrong pages appearing in search results, duplicate content signals diluting your rankings, and frustrated users who land on content in a language they do not read.
Why Hreflang Matters for International SEO
International SEO is the practice of optimizing your website so that search engines can identify which countries and languages your content targets. Hreflang is the primary mechanism for communicating this targeting to Google and Yandex. Bing uses a different approach (the content-language meta tag), but hreflang remains the dominant standard.
There are three key reasons hreflang is essential for any multilingual or multi-regional website:
-
Preventing duplicate content issues. When you have the same content in multiple languages, search engines may treat those pages as duplicates. Hreflang tells search engines that these pages are intentional language variants, not copies. This preserves the ranking equity of each version.
-
Serving the right page to the right audience. Hreflang directly influences which URL appears in search results for users in different regions. A user searching from Germany will see the German version, while a user searching from Brazil sees the Portuguese version. This increases click-through rates because users see results in their language.
-
Consolidating ranking signals across locales. Rather than treating your English, Spanish, and German pages as competitors, hreflang tells search engines they are part of a single multilingual entity. The authority and links earned by any one version can benefit the entire set.
Language Codes vs Region Codes
Hreflang values follow the ISO 639-1 standard for language codes and the optional ISO 3166-1 Alpha-2 standard for region codes.
Language-only codes target speakers of a language regardless of location:
en-- English speakers worldwidees-- Spanish speakers worldwidede-- German speakers worldwidefr-- French speakers worldwide
Language-region codes target speakers of a language in a specific country:
en-US-- English speakers in the United Statesen-GB-- English speakers in the United Kingdomes-MX-- Spanish speakers in Mexicopt-BR-- Portuguese speakers in Brazilfr-CA-- French speakers in Canadazh-TW-- Chinese speakers in Taiwan
The region code is always optional. If you only have one English version, use en. If you have separate versions for the US and UK, use en-US and en-GB. Never use a region code alone without a language prefix -- hreflang="US" is invalid and will be ignored by search engines.
A common mistake is using incorrect codes. For example, uk is the ISO 639-1 code for Ukrainian, not for the United Kingdom. The correct code for British English is en-GB. Similarly, jp is not valid; the correct language code for Japanese is ja, and the country code for Japan is JP, making the combined code ja-JP.
Understanding x-default
The x-default value is a special hreflang attribute that designates a fallback page. When a search engine cannot match a user's language or region to any of the available hreflang values, it serves the x-default page instead.
<link rel="alternate" hreflang="x-default" href="https://example.com/en/" />
You should set x-default to the page that provides the best experience for users whose language is not explicitly covered. This is typically your English version or a language selector page. The key rules for x-default are:
- Every hreflang set should include exactly one
x-defaultentry - The
x-defaultURL must also appear as one of the regular hreflang entries (e.g., if your English page is x-default, it should also havehreflang="en") - Do not use
x-defaultas a catch-all for multiple pages -- it points to one URL only
Without an x-default, search engines have no guidance on what to show users from unsupported regions. This can result in unpredictable behavior where Google picks whichever version it considers most relevant, which may not be the experience you intend.
How Search Engines Use Hreflang
Google processes hreflang as a signal, not a directive. This distinction is important: unlike noindex (which Google generally obeys), hreflang is a suggestion that Google weighs alongside other signals such as the user's location, search language settings, the page's actual content language, and internal linking patterns.
Here is what Google does when it encounters hreflang:
- Crawls and discovers all pages listed in the hreflang set
- Validates reciprocity -- checks that page A pointing to page B also has page B pointing back to page A
- Checks URL accessibility -- confirms all linked URLs are crawlable and return 200 status codes
- Evaluates consistency -- compares hreflang signals with canonical tags, sitemap entries, and on-page content
- Applies the signal at query time to swap search results to the most relevant locale for the user
If any of these validation steps fail, Google may ignore the hreflang entirely for the affected pages. This is why correct implementation matters so much -- a single broken link in the chain can invalidate the entire set.
Yandex follows a similar process but is less documented. Bing does not officially support hreflang, relying instead on the content-language meta tag and the lang attribute on the <html> element, though reports suggest Bing does partially process hreflang signals.
Implementation Methods
There are three ways to implement hreflang. You should use only one method per page to avoid conflicting signals. If you use multiple methods and they disagree, search engines will not know which one to trust.
Method 1: HTML Link Elements in the Head
Place <link rel="alternate"> tags in the <head> section of every page in the set.
<head>
<link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/page/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/page/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/page/" />
</head>
When to use this method: Best for sites with a small to medium number of pages (under a few hundred) where you have direct control over the HTML head. This is the most common approach and the easiest to debug because the tags are visible in the page source.
Advantage: Straightforward to implement, easy to inspect, works with any hosting setup.
Drawback: Adds to page weight. A site with 20 language versions adds 21 <link> tags (20 locales + x-default) to every page, which can be significant for performance-sensitive pages.
Method 2: HTTP Headers
Use Link headers in the HTTP response. This is particularly useful for non-HTML resources like PDFs.
Link: <https://example.com/en/page/>; rel="alternate"; hreflang="en",
<https://example.com/es/page/>; rel="alternate"; hreflang="es",
<https://example.com/de/page/>; rel="alternate"; hreflang="de",
<https://example.com/en/page/>; rel="alternate"; hreflang="x-default"
When to use this method: Required for non-HTML documents (PDFs, images) that have language variants. Also useful when you cannot modify the HTML head (e.g., some CMS setups).
Advantage: Works for any content type, not just HTML.
Drawback: Harder to audit because headers are not visible in the rendered page source. Requires server-level configuration.
Method 3: XML Sitemap
Add hreflang annotations inside your XML sitemap using the xhtml:link element within each <url> entry.
<?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://example.com/en/page/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/page/" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/page/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/page/" />
</url>
<url>
<loc>https://example.com/es/page/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/page/" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/page/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/page/" />
</url>
</urlset>
When to use this method: Ideal for large sites with thousands of pages. The hreflang data lives in the sitemap rather than on each page, making it easier to manage programmatically and keeping page weight minimal.
Advantage: Scales well, keeps HTML clean, can be generated by build tools or CMS plugins.
Drawback: Google must crawl and process the sitemap before the hreflang takes effect. Changes may take longer to propagate than in-page tags.
When Should You Use Hreflang?
You need hreflang when your site has any of the following:
- Multiple language versions of the same content (e.g., English and Spanish versions of a product page)
- Regional variations of the same language (e.g., British English and American English, or European Portuguese and Brazilian Portuguese)
- A language selector or geo-redirect that serves different content based on the user's location
- Country-specific storefronts with different pricing, currencies, or product availability but substantially similar content
You do not need hreflang when:
- Your site exists in only one language with no regional variants
- You use a machine translation widget (like a browser translation bar) rather than maintaining separate translated pages
- Your content is completely different across regions (e.g., your US site and UK site share no overlapping content)
Common Misconceptions About Hreflang
Misconception: Hreflang boosts rankings directly. Reality: Hreflang does not increase your rankings. It tells search engines which version to show in which market. Your rankings still depend on content quality, backlinks, and other traditional SEO signals.
Misconception: You only need hreflang on the homepage.
Reality: Hreflang must be implemented on every page that has a language or regional equivalent. If your /en/about/ page has a Spanish version at /es/about/, both pages need hreflang tags pointing to each other and to themselves.
Misconception: Google will figure it out without hreflang.
Reality: While Google uses signals like the lang attribute and on-page content language to detect language, these are weaker signals. Without explicit hreflang, Google frequently shows the wrong language version in search results, especially for sites with similar URL structures across locales.
Misconception: Hreflang replaces the canonical tag. Reality: Hreflang and canonical serve different purposes and must be used together. The canonical tag tells search engines which URL is the master copy for indexing purposes. Hreflang tells search engines about language and regional alternatives. Each locale should have a self-referencing canonical that points to itself, not to another locale. See our guide on hreflang vs canonical for a detailed explanation.
Misconception: You can use hreflang with relative URLs.
Reality: All URLs in hreflang attributes must be absolute (starting with https://). Relative URLs are silently ignored by search engines, which means your hreflang implementation will simply not work.
Next Steps
Now that you understand what hreflang is and how it works, you can:
- Use our Hreflang Tag Generator to build correct hreflang tags for your pages
- Read about common hreflang mistakes to avoid implementation errors
- Learn how hreflang and canonical tags interact to prevent conflicts between the two