Hreflang tag attributes are HTML annotations used to tell Google that multiple URLs are alternate language or regional versions of the same page. A hreflang implementation can target a language such as en, a language and region such as en-US, a script such as zh-Hant, or provide an x-default fallback when no specified language or region matches the user. Google supports 3 main implementation methods: HTML <link> tags, HTTP headers and XML sitemaps. Correct hreflang implementation requires every localized page to reference itself and its corresponding alternatives, use valid language and region codes, and provide reciprocal links between alternate pages. Hreflang works with canonicalization but performs a different function: canonicalization identifies the representative URL, while hreflang identifies which localized URL is intended for a particular language or region.
What Are Hreflang Tag Attributes?
Hreflang tag attributes are annotations that identify the language and optionally the geographic region of alternate versions of a webpage.
For example, an international SEO website can have:
https://example.com/us/product/ → English for United States users
https://example.com/gb/product/ → English for United Kingdom users
https://example.com/de/product/ → German users
Hreflang tells Google that these URLs belong to the same localized content group and which URL is intended for which audience.
Google recommends hreflang when a website has pages with fully translated content, similar content customized for different countries, or pages where the main content stays in one language but surrounding elements are localized. Google states that hreflang helps Search point users toward the most appropriate page version according to language or region.
Hreflang does not translate a page.
It describes relationships between already existing URLs.
The basic relationship is:
Page A → Alternate language/region Page B
and:
Page B → Alternate language/region Page A
Both pages must normally point back to each other for Google to recognize the relationship correctly.
What Does The Hreflang Attribute Look Like?
The hreflang attribute looks like a <link> element containing rel="alternate", hreflang, and href.
For example:
<link rel="alternate" hreflang="en-US" href="https://example.com/us/page/" />
The 3 important parts are:
| Part | Meaning |
|---|---|
rel="alternate" |
Tells Google that the URL is an alternate version |
hreflang="en-US" |
Defines English language content for the United States |
href="https://example.com/us/page/" |
Defines the full alternate URL |
A multilingual page group can look like:
<link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<link rel="alternate" hreflang="en-US" href="https://example.com/us/page/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/page/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/page/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/page/" />
For HTML implementation, Google requires the <link> elements to appear inside a properly formed <head> section. Each localized page should contain the same hreflang set, including an entry pointing to itself.
How To Implement Hreflang Tags
To implement hreflang tags, create separate URLs for each language or regional version, identify the correct language and region codes, connect every equivalent URL with hreflang annotations, include self-referencing annotations, add reciprocal return links and test that every destination URL is crawlable and correct.
For example, suppose one product has 3 versions:
- English:
https://example.com/en/shoes/ - English United States:
https://example.com/us/shoes/ - German:
https://example.com/de/schuhe/
The English page can contain:
<link rel="alternate" hreflang="en" href="https://example.com/en/shoes/" />
<link rel="alternate" hreflang="en-US" href="https://example.com/us/shoes/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/schuhe/" />
The US and German pages should contain the same 3 relationships.
That produces:
English ↔ US English ↔ German
Google specifically states that each language version must list itself and the alternate language versions. Google also requires alternate URLs to be fully qualified, meaning the URL should contain the protocol and full hostname, such as https://example.com/page/, rather than /page/.
For users whose language or region does not match a specified version, an x-default URL can be added:
<link rel="alternate" hreflang="x-default" href="https://example.com/language-selector/" />
Google designed x-default particularly for fallback or language-selector pages.
How Many Implementation Methods Of Hreflang Tag?
There are 3 hreflang implementation methods supported by Google: HTML tags, HTTP headers and XML sitemaps. Google considers the 3 methods equivalent for Search and states that using all 3 together provides no Search advantage.
| Implementation Method | Best Used For | Location |
|---|---|---|
HTML <link> |
Normal HTML webpages | <head> section |
| HTTP Header | PDFs and non-HTML documents | HTTP response |
| XML Sitemap | Large multilingual websites | XML sitemap |
1. HTML Hreflang Implementation
HTML implementation places hreflang elements inside the <head> of every alternate webpage.
<head>
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
</head>
HTML implementation is straightforward for websites with a manageable number of language versions.
2. HTTP Header Hreflang Implementation
HTTP-header implementation places hreflang information in the server response rather than inside HTML.
For example:
Link: <https://example.com/file.pdf>; rel="alternate"; hreflang="en",
<https://example.com/de/file.pdf>; rel="alternate"; hreflang="de"
Google specifically recommends the HTTP-header option as useful for non-HTML files such as PDF documents. Every version must include the complete alternate set.
3. XML Sitemap Hreflang Implementation
XML sitemap implementation places alternate URLs inside the sitemap using xhtml:link.
For example:
<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="de"
href="https://example.com/de/page/" />
</url>
Each localized URL receives its own <url> entry and each entry lists all corresponding alternatives, including itself. If one page exists in 3 language versions, Google states that the sitemap contains 3 URL entries and every entry contains the same 3 alternate relationships.
Large international websites often find sitemap implementation easier to maintain because hundreds or thousands of hreflang relationships can be managed centrally rather than inserted into every HTML document.
How Many Hreflang Tag Attribute Variations?
There are 5 practical hreflang value patterns used to identify language, region, script or fallback targeting: language-only, language-region, language-script, language-script-region and x-default.
| Variation | Example | Target |
|---|---|---|
| Language only | en |
English speakers regardless of country |
| Language + region | en-US |
English speakers in United States |
| Language + script | zh-Hant |
Traditional Chinese |
| Language + script + region | zh-Hans-US |
Simplified Chinese for United States users |
| Default fallback | x-default |
Users with no matching hreflang target |
Google uses ISO 639-1 language codes such as en, de and fr, with optional ISO 3166-1 Alpha-2 region codes such as US, GB and CA. Script values can use ISO 15924 identifiers such as Hant and Hans.
For example:
en = English
en-US = English for United States
en-GB = English for United Kingdom
fr-CA = French for Canada
zh-Hant = Traditional Chinese
x-default = fallback version
A country code cannot be used alone.
For example:
US = Invalid hreflang targeting
en-US = Valid
The first value must identify a language. Google also warns that UK is not the valid region code for United Kingdom hreflang targeting; GB is the ISO code used in en-GB.
What Is The Purpose Of Hreflang Tag?
The purpose of hreflang tag is to tell Google which URLs are equivalent localized versions of a page and which language or regional audience each URL targets.
For example:
example.com/en-us/phone/ → United States English
example.com/en-gb/phone/ → United Kingdom English
Both pages may discuss the same phone, but one page can show dollars, US shipping information and US terminology while another shows pounds, UK delivery information and UK terminology.
Hreflang establishes that localization relationship.
Google can discover alternate language pages without hreflang, but Google explicitly recommends identifying localized versions because it helps Search return the appropriate URL for the user’s language or region.
Hreflang therefore performs 3 practical jobs:
- Connects localized versions of equivalent content.
- Identifies their language or regional targeting.
- Helps Google select an appropriate localized URL for search users.
Google does not use hreflang itself to detect the language of a page. Google says page language is determined algorithmically from page content.
The Difference Between Hreflang And Canonicalization
The difference between hreflang and canonicalization is that hreflang identifies alternate language or regional versions of a page, while canonicalization identifies the representative URL among duplicate or substantially similar URLs.
| Feature | Hreflang | Canonicalization |
|---|---|---|
| Main purpose | Identify localized alternate pages | Identify representative URL |
| Main attribute | hreflang |
rel="canonical" |
| Works across languages | Yes | Can, but not for replacing hreflang |
| Works across regions | Yes | Yes |
| Identifies audience | Yes | No |
| Handles duplicate URL selection | No | Yes |
| Example | US page ↔ UK page | Duplicate URL → preferred canonical URL |
Canonicalization can be represented as:
Duplicate URL A + Duplicate URL B → Canonical URL A
Hreflang can be represented as:
English URL ↔ German URL ↔ French URL
Google defines canonicalization as the process of selecting a representative URL from duplicate or very similar pages. Hreflang instead tells Google that several URLs are localized variations.
The 2 systems can work together.
For example, if a business has US and UK pages containing substantially similar English content, Google recommends using both canonicalization and hreflang so Search can understand duplicate relationships and regional targeting.
A common implementation is for each genuine localized page to use a canonical pointing to its own preferred URL while hreflang connects that page to the corresponding localized URLs.
For example:
US page:
<link rel="canonical" href="https://example.com/us/page/" />
<link rel="alternate" hreflang="en-US" href="https://example.com/us/page/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/gb/page/" />
UK page:
<link rel="canonical" href="https://example.com/gb/page/" />
<link rel="alternate" hreflang="en-US" href="https://example.com/us/page/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/gb/page/" />
Canonicalization and hreflang therefore solve related but different SEO problems.
What Are The Benefits Of Using Hreflang Tags?
The benefits of using hreflang tags are better language targeting, better regional targeting, clearer relationships between international pages, more appropriate URLs in search results and improved management of similar regional content.
Better Language Targeting
Hreflang tells Google which page belongs to which language audience.
For example:
es → Spanish
fr → French
de → German
A French-language search user can therefore be matched with the French version instead of an equivalent English URL.
Better Regional Targeting
Hreflang can distinguish between pages that use the same language but target different countries.
For example:
en-US → United States
en-GB → United Kingdom
en-CA → Canada
en-AU → Australia
Google specifically recommends regional hreflang when similar content exists in one language for different geographic markets.
Clearer International Site Structure
Hreflang creates explicit relationships between localized URLs.
Instead of requiring Google to infer:
Page A seems related to Page B
the site states:
Page A and Page B are localized equivalents.
More Appropriate Search URLs
Google states that identifying localized variations helps Search point users toward the most appropriate version by language or region.
A user in the UK can therefore be served the URL containing UK prices, shipping information and terminology rather than a US-specific page when Google understands the relationship.
Better Handling Of Similar Regional Content
US, UK, Canadian and Australian pages can contain large amounts of similar English text.
Google specifically recognizes regional variants as a common duplicate-content situation and recommends canonicalization together with hreflang where appropriate.
What Is The Use Of An Hreflang Tag?
The use of an hreflang tag is to connect alternate URLs when the same subject or page is available for different languages, countries or language-country combinations.
Hreflang is commonly used on:
International ecommerce product pages
Multilingual service pages
Country-specific landing pages
Translated blog articles
International homepages
Localized software pages
Regional pricing pages
Country-specific shipping pages
For example, an SEO agency can publish:
/us/seo-services/ → en-US
/uk/seo-services/ → en-GB
/de/seo-agentur/ → de-DE
The hreflang set tells Google that these pages represent corresponding versions of the same service for different audiences.
Google recommends separate URLs for separate language versions instead of changing page content only according to cookies or browser language. Google warns that dynamically changing content according to location or language can make some versions difficult for Googlebot to discover and crawl.
Why Does Hreflang Matter For SEO?
Hreflang matters for SEO because international websites need search engines to distinguish between pages intended for different languages and regions.
Without hreflang, Google can still detect page language and find alternate pages, but the website gives Google less explicit information about how equivalent international URLs relate to one another.
For example:
example.com/us/software/
example.com/uk/software/
Both pages may contain nearly identical English content.
Their important differences may only be:
US dollars vs British pounds
US shipping vs UK shipping
US spelling vs UK spelling
US legal terms vs UK legal terms
Hreflang tells Google that these are intentional regional variations rather than unrelated duplicate-looking URLs.
Google states that using hreflang helps Search point users to the appropriate variation by language or region.
Hreflang also matters because Googlebot does not simply browse every site as users from every possible language and country. Google says its crawlers commonly operate without sending an Accept-Language request header and warns that locale-adaptive pages may not all be crawled, indexed or ranked. Google therefore recommends separate locale URLs with hreflang annotations.
The SEO value is therefore correct international URL interpretation and targeting, not simply adding another HTML tag.
5 Common Mistakes With Hreflang Tags
The 5 common mistakes with hreflang tags are missing return links, incorrect language or region codes, missing self-referencing annotations, incomplete or relative URLs and malformed HTML implementation.
1. Missing Return Links
A missing return link happens when Page A identifies Page B as an alternate but Page B does not identify Page A.
Wrong relationship:
Page A → Page B
Correct relationship:
Page A ↔ Page B
Google states that if 2 pages do not point back to each other, the hreflang annotations can be ignored. Reciprocal links protect the system from unrelated websites claiming another URL as an alternate version.
2. Incorrect Language Or Region Codes
Incorrect codes include placing a country first, using a country without a language, or using a non-supported region identifier.
For example:
US → Incorrect
en-US → Correct
en-UK → Incorrect region identifier
en-GB → Correct
Google requires supported language codes based on ISO 639-1 and supported region codes based on ISO 3166-1 Alpha-2.
3. Missing Self-Referencing Hreflang
Every localized page should identify itself as part of its own hreflang cluster.
For 3 versions:
English page → English + German + French
German page → English + German + French
French page → English + German + French
Google’s hreflang guidelines explicitly state that each language version must list itself and the other language versions.
4. Using Incomplete URLs
Hreflang alternate URLs should be fully qualified.
Incorrect:
href="/de/page/"
Correct:
href="https://example.com/de/page/"
Google requires alternate URLs to contain the complete protocol and hostname.
5. Incorrect HTML Placement Or Combined Link Tags
HTML hreflang tags should appear inside a valid <head> section.
Google also warns against combining hreflang alternate annotations with other alternate-document attributes such as media inside a single <link> tag. Google’s Search documentation was specifically clarified to document this implementation requirement.
Correct:
<link rel="alternate" hreflang="en-US" href="https://example.com/us/" />
Keep each alternate annotation as its own valid <link> element.
Why Is Hreflang Relevant For SEO?
Hreflang is relevant for SEO because language and geographic relevance can determine which version of an international website is most appropriate for a search user.
Consider one product available through 4 URLs:
US English
UK English
German
French
Without explicit international annotations, Google must rely more heavily on its own signals to understand the relationships among those URLs.
With hreflang:
US English ↔ UK English ↔ German ↔ French
the publisher explicitly describes the localized set.
This becomes especially relevant when multiple pages use the same language.
A German translation and an English page look obviously different from their text, but en-US and en-GB pages may contain almost identical content. Hreflang supplies the regional distinction that visible language alone cannot communicate.
Google also recommends giving users separate URLs for different language versions and marking those pages appropriately.
Hreflang is therefore relevant to international SEO when a website has:
Multiple languages
Multiple countries
Multiple regions using the same language
Localized currencies or shipping information
International ecommerce stores
Regional service pages
Translated content
A single-language, single-market website normally has no need for hreflang because it has no alternate language or regional URLs to map.
How Is The Hreflang Tag Structured?
The hreflang tag is structured with a <link> element, the alternate relationship, the hreflang language/region value and the complete destination URL.
The standard HTML structure is:
<link rel="alternate" hreflang="language-region" href="complete-URL" />
For example:
<link rel="alternate" hreflang="en-US" href="https://example.com/us/page/" />
The structure contains 4 main parts:
| Structure | Function |
|---|---|
<link> |
Creates the link relationship element |
rel="alternate" |
Identifies an alternate version |
hreflang="en-US" |
Defines intended language and region |
href="https://..." |
Defines the alternate page URL |
The hreflang value itself can be structured as:
Language only
en
Language + region
en-US
Language + script
zh-Hant
Language + script + region
zh-Hans-US
Fallback
x-default
Google states that the language comes first, followed by an optional region, while script identifiers can also be supplied when needed. The country cannot replace the language code.
For a complete international page group, the individual tag structure is simple, but the relationship structure is more important:
Page 1 → Itself + Page 2 + Page 3
Page 2 → Page 1 + Itself + Page 3
Page 3 → Page 1 + Page 2 + Itself
Muhammad Saad