Hreflang
Hreflang is an HTML attribute used to tell search engines which language and geographical region a specific webpage is intended for. It’s an essential part of international SEO, helping websites deliver the correct language or regional version of a page to users in different locations.
If you operate a website with multiple versions for different languages or countries (e.g., English for the UK, Spanish for Mexico), the hreflang attribute signals to Google which version to show based on the user's language preferences or geographic location.
What does hreflang look like?
Hreflang tags are usually placed in the <head>
section of the HTML or included in the sitemap. Here's an example for English (US) and Spanish (Spain) versions of the same page:
<link rel="alternate" hreflang="en-us" href="https://example.com/us/" />
<link rel="alternate" hreflang="es-es" href="https://example.com/es/" />
You can also use a default version as a fallback:
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
Why hreflang matters for SEO
- Improves user experience by showing content in the user’s language or relevant region.
- Reduces bounce rates by preventing users from landing on a page in the wrong language.
- Prevents duplicate content issues by telling search engines that similar pages are intended for different audiences.
- Boosts visibility in local search results, helping each version rank in its target market.
Without hreflang tags, search engines might not know which version to show, leading to lower rankings, poor targeting, or incorrect content being served.
Common hreflang values
Language | Region | Hreflang Code |
---|---|---|
English (Global) | – | en |
English (United States) | US | en-us |
French (France) | FR | fr-fr |
Spanish (Mexico) | MX | es-mx |
German (Germany) | DE | de-de |
A full list of codes can be found in Google’s hreflang documentation.
Best practices for hreflang implementation
- Always include a self-referencing hreflang tag for each page.
- Use hreflang consistently across all alternate versions.
- Avoid using hreflang with redirects or canonical tags pointing to different URLs.
- Validate your hreflang setup using tools like Google Search Console’s International Targeting report or Ahrefs Site Audit.
- Use
x-default
for generic landing pages that don’t target a specific language or region.
In summary, hreflang is a powerful SEO attribute that ensures search engines serve the right version of your content to users based on language and location. It’s a must-have for websites targeting multilingual or international audiences, helping improve user experience and maximize search visibility across markets.