Hreflang: The Easy Guide for Beginners

17 MIN READ
Last updated: June 4, 2026

Understand with AI

Discuss with your preferred AI assistant

You've built a website. Maybe it's in English. Maybe it's in Spanish too, or French, and now someone told you that you need something called an "hreflang tag" - and you have absolutely no idea where to start.

Don't worry. You're not alone.

The hreflang tag is one of those SEO concepts that sounds scarier than it is. Once you understand what it does and why it exists, the whole thing clicks pretty fast.

This guide breaks it all down in plain language. No jargon overload. Just what you actually need to know to get it right.

What Is Hreflang and Why Does It Matter

Google serves billions of searches every day across dozens of languages and hundreds of countries. When you have a website with pages in multiple languages or targeting different regions, Google needs a way to figure out which version of your page to show to which user.

That's exactly what hreflang does.

The hreflang tag is a small piece of HTML code that tells search engines like Google which language and geographic region a specific page is meant for. It's a signal, not a directive - Google uses it to make better decisions about which URL to rank in which country's search results.

Think about it: if you have an English page for US readers and another English page for UK readers, you want Google to show the right one to each audience. Without the hreflang tag, Google might just pick one version and show it to everyone - or worse, it might treat your pages as duplicate content.

The Problem Hreflang Solves

Let's say your website sells software in both the United States and Australia. The pages are nearly identical - same language, just different pricing and maybe a few regional differences. Without hreflang, Google sees two very similar pages and gets confused.

Does it rank both? Does it pick one? Does it penalize you for duplicate content?

With a proper hreflang tag implementation, you're basically telling Google: "Hey, these pages are related. This one is for US readers. That one is for Australian readers. Please show each audience the right version."

The result? Better rankings in the right markets. Less cannibalization. Happier users who land on a page that actually speaks to them - literally and geographically.

Who Needs to Use Hreflang Tags

Not every website needs this. If your site is in one language and targets one country, you can skip this entirely, but you definitely need hreflang if:

  • Your site has content in more than one language
  • You target the same language in multiple countries (like English for the US and the UK)
  • You have region-specific versions of pages with different URLs
  • You're running an international e-commerce store
  • You've noticed Google is indexing the wrong language version of your pages

Sound familiar? Then keep reading.

How the Hreflang Tag Actually Works

The actual hreflang tag syntax looks like this:

< link rel="alternate" hreflang="en-us" href="https://example. com/en-us/page/" />

Let's break that down piece by piece.

  • rel="alternate" - tells search engines this is an alternate version of the page
  • hreflang="en-us" - specifies the language (en = English) and region (us = United States)
  • href="." - the full URL of the page this tag refers to

Every page that's part of your international setup needs to reference all its related versions, including itself. That's the part most beginners get wrong.

The Language and Region Codes

The language code follows the ISO 639-1 standard. The region code follows ISO 3166-1 Alpha-2. Sounds technical, but it's really just a list of two-letter codes.

Here are the most common ones you'll use:

LanguageLanguage CodeRegion ExampleFull Hreflang Value
English (US)enUSen-us
English (UK)enGBen-gb
Spanish (Spain)esESes-es
Spanish (Mexico)esMXes-mx
French (France)frFRfr-fr
French (Canada)frCAfr-ca
GermandeDEde-de
JapanesejaJPja-jp
Portuguese (Brazil)ptBRpt-br
Chinese (Simplified)zhCNzh-cn

Pro tip: the language code is always lowercase. The region code is always uppercase. So it's en-US, not EN-us. Get this wrong and Google might ignore your tags altogether.

The Canonical Relationship

Here's something that trips people up: hreflang and canonical tags work together, but they're not the same thing.

The canonical tag says "this is the main version of this page." The hreflang tag says "this page is for this audience, and here are all the related versions."

You can have both on the same page. in fact, you usually should.

Each page in your international cluster should have:

  • Its own canonical tag pointing to itself
  • Hreflang tags referencing all versions, including itself

Yes, a page should include an hreflang tag pointing to itself. That's not a mistake - it's required.

The x-default Tag

There's one special hreflang value you should know about: x-default.

Use this when you have a page that doesn't target any specific language or region. It's your catch-all. If someone visits your site from a country you don't have a localized page for, Google might show them the x-default version.

Here's what it looks like in practice:

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

Common uses for x-default include a language selector page, a generic homepage, or a global version of your content that works for everyone.

Three Ways to Implement Hreflang Tags

There are three methods to add hreflang tags to your site. Which one you choose depends on your technical setup and how your site is built.

Method 1: HTML Head Tag

This is the most common method. You add hreflang tags directly inside the < head>section of your HTML pages.

Here's a real example. Say you have an English page for the US and a Spanish page for Mexico:

< head>
< link rel="alternate" hreflang="en-us" href="https://example. com/en/" />
< link rel="alternate" hreflang="es-mx" href="https://example. com/es/" />
< link rel="alternate" hreflang="x-default" href="https://example. com/" />
</head>

Every page in the group needs these same tags. Both the English page and the Spanish page should include references to all versions.

This method works best for smaller sites or sites where you have direct control over the HTML of each page.

Method 2: HTTP Headers

If your content isn't HTML - think PDFs or other non-HTML files - you can add hreflang signals through HTTP response headers instead.

This method requires server-level access and is a bit more technical. You'll need to modify your server configuration or use a plugin if you're on a CMS. It's not often the first choice, but it's valid and fully supported by Google.

Here's roughly what the HTTP header looks like:

Link: < https://example. com/en/>; rel="alternate"; hreflang="en-us"

Most developers working with non-HTML content already know this method. If you're not sure whether you need it, you probably don't.

Method 3: XML Sitemap

This is often the easiest method for large sites with lots of pages. Instead of adding hreflang tags to every individual page, you specify all the relationships in your XML sitemap.

Here's what a sitemap entry with hreflang looks like:

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

Each URL in the sitemap that's part of an international group needs its own entry with all the alternate versions listed.

The sitemap method is popular because it keeps your HTML clean and gives you one central place to manage all your hreflang relationships. It's especially useful for e-commerce sites with hundreds of product pages in multiple languages.

Common Hreflang Mistakes (And How to Fix Them)

Honestly, hreflang errors are incredibly common. Even experienced SEOs mess this up sometimes. Here are the mistakes you're most likely to make - and how to avoid them.

This is the number one hreflang mistake.

If Page A links to Page B via hreflang, Page B must also link back to Page A. The relationship has to go both ways. Google actually requires this.

Think of it like a handshake. Both sides have to participate. If only one page references the other, Google can't confirm the relationship and may ignore your hreflang tags entirely.

Here's what broken looks like:

  • Page A (en-us) says: "My alternate is Page B (es-mx)"
  • Page B (es-mx) doesn't say anything about Page A

Here's what correct looks like:

  • Page A (en-us) says: "My alternate is Page B (es-mx), and I also reference myself (en-us)"
  • Page B (es-mx) says: "My alternate is Page A (en-us), and I also reference myself (es-mx)"

Every page in the group references every other page in the group, plus itself. That's the rule.

Wrong Language Codes

Using the wrong language or region codes is a surprisingly easy mistake to make.

Common errors include:

  • Using en-UKinstead of en-GB(the UK country code is GB, not UK)
  • Using zh-TWfor Traditional Chinese Taiwan, which is actually correct - but people sometimes mix this up with zh-CN
  • Using spinstead of esfor Spanish
  • Forgetting that language codes are lowercase and region codes are uppercase

Always double-check your codes against the ISO 639-1 language list and the ISO 3166-1 Alpha-2 country list before publishing.

Incorrect URL Formats

Your hreflang URLs must be absolute, fully qualified URLs. Not relative paths.

Wrong: href="/en/page/"

Right: href="https://www. example. com/en/page/"

Also, make sure your URLs are consistent. If you use a trailing slash on your canonical URL, use a trailing slash in your hreflang tag too. If your site uses HTTPS, don't accidentally use HTTP in your hreflang attributes.

These small inconsistencies can cause Google to treat your tags as invalid.

A few more common mistakes to watch out for:

  • Pointing hreflang tags to pages that return a 404 or redirect
  • Using hreflang on pages that are blocked by robots. txt
  • Forgetting to include the self-referencing hreflang tag
  • Mixing methods (using both HTML tags and sitemap entries for the same pages)

Semly Pro: Hreflang and International SEO in 2026

Getting hreflang right is one piece of the international SEO puzzle, but in 2026, international visibility also means tracking how your content performs across different markets, how AI search tools are surfacing your brand, and whether your content strategy is actually working at scale.

That's where a platform like Semly Pro comes in.

How Semly Pro Helps With International Content

Semly Pro is built for SEO professionals, content teams, and agencies that need to produce and track content across multiple projects and markets. Here's what makes it useful for international SEO work:

  • AI content generation at scale - up to 100 long-form SEO articles per month on the Business Pro plan
  • AI visibility tracking - see how your brand appears in ChatGPT, Perplexity, and Google AIO results
  • Multi-project support - manage separate projects for different regions or clients
  • LLMs. txt generation - help AI crawlers understand your site structure correctly
  • Schema optimization on the Managed SEO plan, done by Semly Pro's own team

On the Pro plan at €139/mo, you get 40 long-form SEO articles per month, AI visibility scoring, and publishing to 12 CMS platforms. That's a solid foundation for a solo marketer managing international content.

If you're running an agency or growing team, Business Pro at €229/mo gives you 100 articles per month, advanced AI metrics, data export options, and three team seats. You can add extra team seats for €18/mo each and extra projects for €27/mo each.

Need everything done for you? The Managed SEO plan at €469/mo includes a dedicated strategist, weekly AI visibility tracking, schema and LLMs. txt optimization by their team, and a monthly strategy call. Real talk: that's a lot of coverage for an international SEO operation that doesn't want to manage it in-house.

Comparing SEO Tools for International Visibility

Here's how Semly Pro stacks up against other tools that SEO teams commonly consider in 2026:

ToolAI Visibility TrackingLong-form Content GenerationLLMs. txt GenerationMulti-project SupportManaged SEO Option
Semly ProYesYes (up to 100/mo)YesYesYes (€469/mo)
SemrushPartialLimitedNoYesNo
AhrefsNoNoNoYesNo
Surfer SEONoYes (limited)NoLimitedNo
JasperNoYesNoLimitedNo
FraseNoYes (limited)NoLimitedNo
WritesonicNoYesNoLimitedNo
SE RankingPartialLimitedNoYesNo
NightwatchNoNoNoYesNo

Bottom line: if your international SEO work includes content creation, AI search visibility, and ongoing tracking across multiple markets, Semly Pro covers more ground in one platform than most alternatives.

How to Choose the Right Hreflang Setup for Your Site

Not every international site has the same needs. The right hreflang setup depends on how your content is structured and who you're actually trying to reach.

Single Language, Multiple Regions

This is probably the most common scenario for English-speaking businesses. You have one language (English) but you want to serve different regional audiences - US, UK, Australia, Canada, and so on.

Here's what your hreflang setup would look like:

  • hreflang="en-us"for your US page
  • hreflang="en-gb"for your UK page
  • hreflang="en-au"for your Australian page
  • hreflang="en-ca"for your Canadian page
  • hreflang="x-default"for a generic fallback

Each regional page needs to cross-reference all the others. It gets verbose fast, but it's worth doing right.

Multiple Languages, Multiple Regions

This is the most complex setup. You're targeting different languages in different countries. Think of a global SaaS company with pages in English, French, German, Spanish, and Japanese - each targeting specific countries.

For this kind of setup, the XML sitemap method is almost always the better choice. Trying to manage dozens of hreflang tags in the HTML head of every page becomes a maintenance nightmare.

A few things to keep in mind:

  • You don't have to specify a region if your content targets all speakers of a language worldwide. hreflang="es"(without a region code) is valid and means "Spanish, any region."
  • But if you have region-specific content, always use the full language-region combination
  • Make sure your translations are actually different enough to justify separate pages - thin or identical translated content won't help your rankings

When You Don't Need Hreflang

Here's something many beginners don't realize: hreflang isn't always necessary.

Skip it if:

  • Your site is entirely in one language targeting one country
  • You have translated content but it all lives on the same URL (using JavaScript to switch languages without changing the URL doesn't benefit from hreflang)
  • Your international traffic is so small that maintaining hreflang tags isn't worth the overhead
  • You're using a hosted platform that handles international targeting automatically

Adding hreflang tags to a site that doesn't need them won't hurt you - but it adds technical complexity for no benefit. Keep things simple when you can.

Hreflang Tag Cheat Sheet

Need a quick reference? Here's everything you need to remember in one place.

The Core Rules

  • Always use absolute URLs (include the full domain)
  • Every page must self-reference itself in its own hreflang tags
  • All pages in a group must reference all other pages in that group
  • Language codes are lowercase (en, es, fr, de, ja)
  • Region codes are uppercase (US, GB, MX, FR, DE)
  • Use x-defaultfor a language-agnostic fallback
  • Don't mix implementation methods on the same pages

Quick Syntax Reference

Use CaseExample Tag
English for the US< link rel="alternate" hreflang="en-us" href="https://example. com/en/" />
Spanish for Mexico< link rel="alternate" hreflang="es-mx" href="https://example. com/es/" />
French for all regions< link rel="alternate" hreflang="fr" href="https://example. com/fr/" />
Default fallback< link rel="alternate" hreflang="x-default" href="https://example. com/" />

Implementation Method Comparison

MethodBest ForTechnical DifficultyWorks For Non-HTML
HTML HeadSmall to medium sitesLowNo
HTTP HeadersPDFs and non-HTML filesHighYes
XML SitemapLarge sites with many pagesMediumNo

Hreflang Tag Validation Tools

Before you call your implementation done, run it through a validator. These tools can catch errors you'd otherwise miss:

  • Google Search Console - check the International Targeting report for hreflang errors
  • Ahrefs Site Audit - flags missing return links and incorrect codes
  • Screaming Frog - crawls your site and checks hreflang consistency across all pages
  • Merkle's Hreflang Tags Testing Tool - free, purpose-built tool for validating hreflang tags

Pro tip: run a full audit after any major site migration or redesign. Hreflang tags often break silently during those changes, and you won't notice until your international rankings start dropping.

How Often Should You Audit Your Hreflang Tags

Honestly? More often than most teams do.

A good schedule looks like this:

  1. Full audit when you first implement hreflang
  2. Re-check after any URL changes, site migrations, or CMS updates
  3. Monthly spot-check using Google Search Console's International Targeting report
  4. Quarterly full crawl with Screaming Frog or a similar tool

International SEO mistakes tend to compound over time. A broken hreflang tag today can mean poor rankings in a target market for weeks before you catch it.

Frequently Asked Questions

What is hreflang and what does it do?

The hreflang tag is an HTML attribute that tells search engines which language and region a specific page is meant for. It helps Google show the right version of your page to users in different countries or who speak different languages. Without it, Google has to guess which version to rank in which market - and it doesn't always guess correctly.

Does hreflang affect my SEO rankings?

Hreflang doesn't directly boost rankings, but it prevents problems that hurt them. When implemented correctly, it stops your international pages from competing with each other, reduces duplicate content confusion, and helps Google surface the right page to the right audience. That means better click-through rates and more relevant traffic from international markets.

Do I need hreflang if my site is only in English?

Not necessarily. If you target just one country, you don't need hreflang, but if you have separate English pages for different regions - like one for the US and one for the UK - then yes, hreflang is important. It lets Google know these are distinct regional versions, not duplicate pages.

What happens if I get hreflang wrong?

Google will likely ignore your hreflang tags if they contain errors. That means it'll fall back to its own judgment about which page to show where. You might see the wrong language version appearing in search results, lower rankings in target markets, or your pages being flagged as duplicate content. It won't cause a manual penalty, but the indirect damage can be significant.

Can I use hreflang with a WordPress site?

Yes. Most multilingual WordPress plugins - like WPML or Polylang - handle hreflang tags automatically when you set up your language configurations. If you're managing hreflang manually on WordPress, you'd either use a plugin to inject the tags into the HTML head or add them to your sitemap via an SEO plugin like Yoast or Rank Math.

What's the difference between hreflang and the lang attribute?

The HTML langattribute on your page's < html>tag tells browsers and accessibility tools what language the page content is in. The hreflang tag is specifically for search engines and tells them about the relationship between alternate language versions. Both matter, but they serve different purposes. You should use both on an international site.

How many hreflang tags can I have on one page?

There's no official limit. If your site has 50 language and region variations of a page, you'd include 50 hreflang tags (plus one self-referencing tag and potentially one x-default tag). In practice, very large hreflang clusters are easier to manage via XML sitemap than in the HTML head. Keep in mind that each added language increases the maintenance burden, so only create pages for markets you're genuinely targeting.

Does Bing support hreflang tags?

Bing's support for hreflang is limited compared to Google. Bing has its own way of handling international targeting, including the use of the content-languagemeta tag and geo-targeting settings in Bing Webmaster Tools. That said, implementing hreflang tags for Google doesn't hurt your Bing rankings, so there's no reason not to do it.

What is the x-default hreflang tag used for?

The x-defaultvalue marks a page as the default version to show when no other hreflang value matches the user's language or region. It's commonly used on language selector pages, global homepages, or any version of a page that serves as a universal fallback. It's optional but strongly recommended when you have international variations of a page.

How do I check if my hreflang tags are working?

The best starting point is Google Search Console. Go to the International Targeting section and look for hreflang errors. From there, you can use Screaming Frog to do a full site crawl and check for missing return links, wrong language codes, or broken URLs in your hreflang attributes. Running a validation check every time you make structural changes to your site is a good habit to build.