Free Tool
Hreflang Tag Checker
Validate hreflang tags for multilingual sites. Check for return tags, correct language-region codes, x-default usage, and common implementation errors.
What is hreflang?
Hreflang is an HTML attribute (rel="alternate" hreflang="x") that helps search engines understand which localized version of a page is intended for users in particular languages or regions. It tells search engines that multiple versions of a page exist and which one to serve to which audience.
For example, if you have an English page, a French page, and a German page for the same content, hreflang annotations help Google show the French version to French-speaking users and the German version to German-speaking users. Learn more about international SEO and how hreflang fits into your broader technical SEO strategy.
When should you use hreflang?
Use hreflang when you have multiple localized versions of a page for different languages or regions. Legitimate use cases include:
- Multilingual websites — Sites with the same content translated into multiple languages.
- Regional variations — Sites with different versions for users in different countries, even if the language is the same (e.g., en-US and en-GB).
- Country-specific versions — Sites with tailored content, pricing, or availability for specific countries.
Not every multilingual-looking site automatically needs hreflang. It is most useful when you have substantially equivalent pages tailored for different locales. If your site simply links to translated pages without regional targeting, hreflang may not be necessary.
How does hreflang work?
Each localized page includes hreflang annotations pointing to all other localized versions, including itself. The annotation specifies a language code (and optionally a region code) and the corresponding URL:
<link rel="alternate"
hreflang="en-us"
href="https://example.com/us/page/" />
<link rel="alternate"
hreflang="fr"
href="https://example.com/fr/page/" />
<link rel="alternate"
hreflang="x-default"
href="https://example.com/page/" />Search engines use these annotations to understand the relationship between the pages and serve the appropriate version to users based on their language and region preferences.
Language and region codes
Hreflang uses standardized codes for language and region targeting:
- en — English (language only)
- en-US — English for United States (language + region)
- en-GB — English for United Kingdom
- fr — French
- de — German
- es — Spanish
- es-ES — Spanish for Spain
- x-default — Default page for unmatched locales
Language codes follow ISO 639-1 and region codes follow ISO 3166-1 alpha-2. Do not invent arbitrary codes — use the standardized formats so search engines can interpret them correctly.
What is x-default?
x-default is a special hreflang value that specifies the default page for users whose locale does not match any of your other hreflang annotations. It is not a country code or a language code — it is a catch-all for unmatched locales.
For example, if you have hreflang annotations for en-US, en-GB, and fr, a user from Japan would not match any of those. The x-default annotation tells search engines to show that user the default version of the page.
Reciprocal implementation (return tags)
Every hreflang annotation must have a reciprocal annotation on the target page. If the English page points to the French page, the French page must point back to the English page. These are called return references.
<!-- English page -->
<link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page/" />
<!-- French page -->
<link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page/" />Missing return references are one of the most common hreflang errors and can cause search engines to ignore your entire hreflang implementation.
Common hreflang mistakes
- Missing return references — If page A points to page B, page B must point back to page A.
- Invalid language or region codes — Use standardized ISO codes, not invented values.
- Incorrect URLs — Hreflang URLs must be accurate and accessible.
- Non-canonical URLs — Hreflang should point to the canonical URL of each localized version, not to redirected or duplicate URLs.
- Redirected or broken URLs — Do not point hreflang to URLs that redirect or return errors.
- Missing self-reference — Each page should include an hreflang annotation pointing to itself.
- Mismatched localized pages — Hreflang annotations should connect pages that are genuinely localized versions of the same content.
- Conflicting implementation — If hreflang is specified in both HTML and HTTP headers, ensure they are consistent.
- Incorrect x-default usage — x-default is a catch-all for unmatched locales, not another country or language code.
Hreflang vs canonical
Hreflang and canonical tags serve different purposes and can coexist on the same page:
- Canonical identifies the preferred URL for duplicate or substantially similar content. It consolidates indexing to one URL.
- Hreflang identifies alternate localized versions of a page for different languages or regions. It tells search engines which version to show which audience.
A page can have both a self-referencing canonical tag and hreflang annotations pointing to its localized counterparts. The canonical confirms the page is its own preferred version; the hreflang annotations tell search engines about the other language versions. They do not conflict — they address different problems.
Check your canonical implementation with the Canonical Tag Checker.
Hreflang and AI search visibility
Clear international URL relationships and consistent technical signals can reduce ambiguity for search systems, including AI search engines. When hreflang is correctly implemented, it helps systems understand the relationship between localized versions, which contributes to a cleaner site architecture.
However, hreflang does not directly guarantee inclusion in AI-generated answers. It is part of the technical foundation that helps search engines understand your site's international structure. Learn how SEO audits can help identify hreflang issues across your site.
Why this matters
Hreflang annotations help search engines understand which localized version of a page to show users in specific languages or regions. Incorrect or incomplete hreflang implementation can cause users to see the wrong language version, reduce international search visibility, and create confusion about which URLs should rank for which audiences.
Related glossary terms
Frequently Asked Questions
Hreflang is an HTML attribute (rel="alternate" hreflang="x") that tells search engines which language and regional version of a page to serve to users in specific locales. It helps search engines understand the relationship between localized versions of the same content.
Use hreflang when you have multiple localized versions of a page for different languages or regions — for example, an English page, a French page, and a German page for the same content. Not every multilingual-looking site needs hreflang. It is most useful when you have substantially equivalent pages tailored for different locales.
Use ISO 639-1 language codes and optionally ISO 3166-1 alpha-2 country codes. For example: en (English), en-US (English for United States), en-GB (English for United Kingdom), es-ES (Spanish for Spain), x-default (default for unspecified locales). Do not invent arbitrary codes — use the standardized formats.
If page A points to page B via hreflang, page B must point back to page A with a reciprocal hreflang annotation. These are return tags. Missing return tags are one of the most common hreflang errors and can cause search engines to ignore your hreflang implementation entirely.
x-default is a special hreflang value that specifies the default page for users whose locale does not match any of your other hreflang annotations. It is not a country code or language code — it is a catch-all for unmatched locales. Use it to ensure users from unspecified regions see an appropriate default version.
Canonical tags identify the preferred URL for duplicate or substantially similar content — they consolidate indexing to one URL. Hreflang tags identify alternate localized versions of a page for different languages or regions. They serve different purposes and can coexist: a page can have both a self-referencing canonical and hreflang annotations pointing to its localized counterparts.
Common mistakes include missing return references, invalid language or region codes, pointing to non-canonical or redirected URLs, broken hreflang target URLs, missing self-references, mismatched localized pages, conflicting implementation between HTML and HTTP headers, and incorrect x-default usage.
Clear international URL relationships and consistent technical signals can reduce ambiguity for search systems. However, hreflang does not directly guarantee inclusion in AI-generated answers. It is part of the technical foundation that helps search engines understand your site's international structure.
Related articles
Related tools
Let's talk
Your next customer might not click a blue link — they'll ask an AI. Be the answer.
Book a free strategy call and I'll audit your visibility across Google, AI Overviews, ChatGPT, and Perplexity — then map out exactly what it takes to be found and cited.