Back to Blog
Technical SEOTechnical SEO

What Is Hreflang Tags? Complete Guide for Beginners

A beginner-friendly guide to hreflang tags: what they are, how they work (HTML, sitemaps, headers), implementation steps, and common pitfalls.

November 18, 2026
7 min read
Share:
International SEO specialist placing colored pins on a world map to plan language and country versions for hreflang implementation.

Hreflang tags are rel="alternate" hreflang="..." annotations that tell search engines which language or regional version of a page to show to which users. If a site has the same page in English, British English and French, hreflang is how it points search engines to the right one for each searcher.

This guide covers what the tags look like, why they matter, the three ways to implement them, and a practical workflow for rolling them out.

TL;DR:

  • Hreflang signals which language/region version of a page fits which audience. It doesn't translate anything or improve content quality.

  • You can add it through HTML link elements, XML sitemaps, or HTTP headers. Pick the one that fits your CMS and scale.

  • Every version must reference every other version (and itself). Missing return links are the most common error, so validate and monitor.

What Hreflang Tags Are (Definition and Quick Example)

Short Definition

Hreflang is an annotation that links alternate versions of a page together and labels each with its language and, optionally, its region. As Weglot's guide to hreflang best practices puts it, it tells search engines which language and region a page is meant for, so each searcher can be shown the right version. MDN's reference for the link element's hreflang property describes it the same way: it indicates the language and geographical targeting of a page.

A Simple HTML Example

A typical tag reads: link, rel equals "alternate", hreflang equals "en-gb", href equals the full URL of the British English page. Here's what each part does:

  • rel="alternate": says this URL is an alternate version of the current page.

  • hreflang: the language (and optionally region) the alternate targets.

  • href: the absolute URL of that alternate version.

The tag sits in the page's <head>, and you add one for each version.

Key Terms: Language Vs. Region Codes

The language part uses ISO 639-1 codes, two letters such as en or fr. The optional region part uses ISO 3166-1 alpha-2 country codes, such as GB or FR. So en-GB means English for the United Kingdom, and fr-FR means French for France.

You can use a language alone (fr), but you can't use a region alone. Hreflang targets language/region combinations. It doesn't guarantee rankings, and it doesn't judge translation quality.

Why Hreflang Matters for International Visibility

Without hreflang, a search engine has to guess which version of similar pages suits each searcher. Sometimes it guesses wrong, and a French visitor lands on an English page.

The practical benefits are straightforward:

  • Users see the page in their language or regional variant, which reduces mismatches that send people straight back to the results.

  • Near-identical versions are understood as alternates of each other rather than competing pages.

Picture a store with one English page for US shoppers (dollars, US spelling) and another for UK shoppers (pounds, UK spelling). Marking them en-US and en-GB helps each audience get the one that fits.

Hreflang complements your site structure rather than replacing it. Subfolders, subdomains and country-code domains organize versions, and geotargeting settings in Search Console can add a signal. Hreflang is what explicitly connects the versions to each other. Google Search Central is the authoritative source for how Google treats these annotations, so check its documentation before finalizing rules. If your site serves several physical locations rather than languages, see our piece on managing multiple locations, since the strategy differs.

How Hreflang Works: HTML, Sitemaps, and HTTP Headers

There are three supported ways to declare the same information. Use one consistently rather than mixing them.

You place link elements in the <head> of every page. The key rule is reciprocity: each page lists all language variations, including itself. If page A points to page B but B doesn't point back, the annotation can be ignored. This method is easiest on small sites, but the tag count grows quickly as you add languages, since every page carries every tag.

Sitemap Method

You can list alternate URLs inside your XML sitemap instead. This suits large sites, and it keeps page weight down since nothing is added to the HTML. It also helps when pages are served in ways that make editing heads awkward. For background, see this XML sitemaps overview and the guide on how to create XML sitemaps. The tradeoff: errors are harder to spot by eye in a big file.

HTTP Header Method

Headers are meant for non-HTML files such as PDFs, where there's no <head> to edit. Your server sends the annotations in the response. It's the least common method for typical sites.

The X-default Value and When to Use It

x-default marks the fallback page for users who don't match any listed language or region. It's commonly pointed at a language selector or a general version. It's optional, but useful when you have a global landing page.

Hreflang and canonicals do different jobs. A canonical tag picks the preferred URL among duplicates, while hreflang connects alternates. Each language version should typically canonicalize to itself, not to another language. Our explainer on canonical URLs and the guide to canonical tag implementation cover this in detail. Ahrefs' beginner guide to hreflang also walks through common errors.

How to Implement Hreflang (Practical Steps & Options)

For a deeper walkthrough, see our step-by-step hreflang guide. The core workflow looks like this:

  1. Audit. List every page that has a language or region variant, and note each variant's URL and canonical.

  2. Choose a method. HTML for small sites, sitemaps for large ones or when editing templates is hard, headers for files like PDFs.

  3. Generate reciprocal entries. Each variant lists all variants including itself. Large sites should automate this, since doing it by hand invites mistakes.

  4. Validate and publish. Run a hreflang validator or link checker, then check for errors in Search Console before and after release.

  5. Monitor and iterate. Watch impressions by country and fix errors as new pages are added.

For a visual demonstration, check out this video on understand hreflang in SEO and how to implement:

Here's an illustrative example. A site has a homepage in English, British English and French (France). Each of the three homepages carries three annotations: en pointing to the English page, en-GB to the UK page, and fr-FR to the French page. Add an x-default pointing to the main English page if you want a fallback. Every page has the identical set, which is what makes the annotations reciprocal. Technicalseo.com's hreflang documentation describes these annotations as signals about the language and targeted audience of a page.

The Bottom Line

Hreflang is a technical signal that helps search engines serve the right language or regional page. Choose the implementation method that fits your CMS and scale, then validate and monitor, because small mistakes are common and show up in Search Console.

Frequently Asked Questions

Do I need hreflang if I use subdomains or ccTLDs?

Often yes. Subdomains and country-code domains organize versions, but hreflang still connects them as alternates. If you use country-specific domains exclusively and each serves one distinct audience, it may matter less.

What is x-default and should I use it?

It's the fallback for users who match none of your listed languages or regions, often a language selector page. It's optional but helpful for sites with a global entry point.

Can hreflang fix duplicate content?

No. Hreflang signals targeting, but it doesn't replace canonicalization. Use self-referencing canonical tags on each version alongside hreflang where appropriate.

How do I test whether my hreflang is working?

Check Search Console for reported errors, inspect URLs, and run an online hreflang validator. You can also search with localized queries to see which version appears.

hreflanginternational SEOtechnical SEOmultilingual SEO

Ready to Scale Your Content?

Turn your expertise into search-ready articles—planned, drafted, reviewed, and delivered in one workflow.

Start Your Free Trial