Hreflang Tags: How to Set Up Multi-Language SEO Without Wrecking Your Rankings

·7 min read

Google serves content in 100+ languages across 190+ countries. If your site has pages in multiple languages — or even the same language targeting different regions — hreflang tags tell Google which version to show which audience.

Get them wrong and Google picks the wrong page, or worse, treats your translations as duplicate content and tanks both versions.

What Hreflang Tags Actually Do

Hreflang is an HTML attribute that tells search engines: "This page has an equivalent version in another language or region. Here's where to find it."

It looks like this in your <head>:

<link rel="alternate" hreflang="en" href="https://example.com/about" />
<link rel="alternate" hreflang="es" href="https://example.com/es/about" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/about" />

Each tag points to a specific language version of the same page. Google uses these signals to serve the Spanish version to Spanish-speaking searchers, the French version to French speakers, and so on.

Without hreflang tags, Google has to guess. And Google's guesses are often wrong — especially for sites where English and Spanish pages share similar URL structures or where the same language targets different countries (US English vs UK English vs Australian English).

When You Actually Need Hreflang Tags

Not every multilingual site needs them. Here's when they matter:

You definitely need hreflang if:

  • You have the same content translated into multiple languages on different URLs
  • You have region-specific versions (e.g., example.com for the US and example.co.uk for the UK, both in English)
  • Google is showing the wrong language version in search results for a given country
  • Your translated pages are being flagged as duplicate content in Search Console

You probably don't need hreflang if:

  • You use a single language across your entire site
  • You use a translation widget (like Google Translate) that dynamically swaps text — there are no separate URLs for Google to index
  • Your different-language pages cover completely different topics (hreflang connects equivalent content, not just any page in another language)

The Format: Language Codes and Region Codes

Hreflang uses ISO 639-1 language codes, optionally paired with ISO 3166-1 Alpha-2 country codes:

| Code | Meaning | |------|---------| | en | English (any region) | | en-US | English for the United States | | en-GB | English for the United Kingdom | | es | Spanish (any region) | | es-MX | Spanish for Mexico | | es-AR | Spanish for Argentina | | fr-CA | French for Canada | | pt-BR | Portuguese for Brazil |

Common mistake: Using en-UK instead of en-GB. The UK's country code is GB (Great Britain), not UK. This one trips up a lot of people and silently breaks the tag — Google just ignores invalid codes without telling you.

Another mistake: using three-letter codes like eng or spa. Hreflang only accepts two-letter ISO 639-1 codes.

Our Hreflang Tag Generator handles the code validation automatically so you don't have to memorize the ISO standards.

The x-default Tag

Every hreflang implementation should include an x-default tag:

<link rel="alternate" hreflang="x-default" href="https://example.com/about" />

This tells Google: "If the user's language doesn't match any of my specific hreflang tags, show them this page." It's your fallback — usually your English version or a language-selection page.

Skip this tag and Google picks the fallback on its own. Sometimes it picks well. Sometimes it serves your Japanese page to German users. Add the x-default.

Three Ways to Implement Hreflang

1. HTML <link> Tags (Most Common)

Add <link> tags in the <head> of every language version:

<!-- On https://example.com/about (English) -->
<link rel="alternate" hreflang="en" href="https://example.com/about" />
<link rel="alternate" hreflang="es" href="https://example.com/es/about" />
<link rel="alternate" hreflang="x-default" href="https://example.com/about" />

<!-- On https://example.com/es/about (Spanish) -->
<link rel="alternate" hreflang="en" href="https://example.com/about" />
<link rel="alternate" hreflang="es" href="https://example.com/es/about" />
<link rel="alternate" hreflang="x-default" href="https://example.com/about" />

Critical rule: Every page must reference all its alternates AND itself. If the English page points to the Spanish page, the Spanish page must point back to the English page. This bidirectional linking is required — one-way hreflang tags get ignored.

Best for: Sites with fewer than 20-30 language/region combos. Beyond that, the <head> gets bloated.

2. HTTP Headers

For PDFs, non-HTML files, or when you can't modify the <head>:

Link: <https://example.com/about>; rel="alternate"; hreflang="en",
      <https://example.com/es/about>; rel="alternate"; hreflang="es",
      <https://example.com/about>; rel="alternate"; hreflang="x-default"

Same bidirectional rules apply. Configure this in your server config (nginx, Apache) or CDN edge rules.

3. XML Sitemap

For large sites with many language variants, sitemap-based hreflang scales better:

<url>
  <loc>https://example.com/about</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/about" />
  <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/about" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/about" />
</url>
<url>
  <loc>https://example.com/es/about</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/about" />
  <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/about" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/about" />
</url>

Best for: Sites with 50+ language/page combinations. Keeps the HTML clean and centralizes management. You can validate your sitemap structure with our XML Sitemap Validator.

Pick one method and stick with it. Mixing methods (HTML tags on some pages, sitemap for others) creates confusion. Google can handle it, but debugging becomes painful.

The 5 Mistakes That Break Hreflang

1. Missing Return Links

If page A declares page B as an alternate but page B doesn't declare page A back, Google ignores both tags. Every relationship must be bidirectional. Audit all your pages — even one missing return link in a chain breaks the whole set.

2. Hreflang Pointing to Redirected URLs

If your hreflang tag points to https://example.com/es/about but that URL 301-redirects to https://example.com/es/sobre-nosotros, Google may ignore the tag. Always use the final, canonical URL. Run your hreflang URLs through a Redirect Chain Checker to catch these.

3. Hreflang Conflicting with Canonical Tags

If your Spanish page's canonical tag points to the English page, you've told Google "the Spanish page is a duplicate of the English page" — which directly contradicts your hreflang saying "these are language alternates." The canonical must point to itself (or be omitted) on each language version.

4. Missing Self-Reference

Each page must include a hreflang tag pointing to itself. The English page needs hreflang="en" pointing to its own URL. This feels redundant but Google requires it. Without it, the entire hreflang set for that page becomes unreliable.

5. Invalid Language or Country Codes

en-UK (should be en-GB), zh-CN vs zh-Hans confusion, three-letter codes — any invalid code means Google silently ignores that specific tag. No error in Search Console, no warning. It just doesn't work.

How to Verify Your Hreflang Tags

After implementation, check three things:

  1. Google Search Console → International Targeting report: Shows hreflang errors Google detected. Not exhaustive, but catches the obvious ones.

  2. Manual spot-check: View source on 5-10 pages across languages. Confirm bidirectional links, valid codes, self-references, and x-default presence.

  3. Site audit tools: For deeper analysis across hundreds of pages, tools like Semrush or Ahrefs crawl your site and flag hreflang issues at scale — mismatched return tags, invalid codes, conflicting canonicals.

Generate your tags correctly the first time with our Hreflang Tag Generator — it handles code validation, self-references, and x-default automatically. Then validate your meta tags and structured data to make sure the rest of your international SEO is tight.

Quick Reference Checklist

  • Every page references all alternates AND itself
  • x-default tag points to your fallback page
  • All language/country codes are valid ISO standards
  • Hreflang URLs match canonical URLs exactly (no redirects)
  • Canonical tags on each page point to themselves, not cross-language
  • One implementation method used consistently (HTML, headers, or sitemap)
  • Return links verified — every relationship is bidirectional

Ready to try it?

Generate hreflang tags for multilingual websites. Tell search engines which language version to show users based on their location and language preferences.

🌐 Hreflang Tag Generator — Free Online Tool

Get notified about new SEO tools

More free tools coming soon — keyword research, sitemap generator, and more.