SEO & AI Search

Hreflang Tags: How to Implement Them and Avoid Common Errors

Hreflang tags tell search engines which version of a page to show. Here is how to set them up, which errors break them and how to check them.

Faox DigitalNovember 5, 202613 min read
Hreflang Tags: How to Implement Them and Avoid Common Errors
Short answer

Hreflang tags tell search engines which language or regional version of a page to show each searcher. To implement them, give every version its own URL, list all versions on each page with valid language and region codes, make sure every pair points back, add x-default as a fallback, and use one method per type of content: HTML, HTTP headers or an XML sitemap. The errors that break them are mostly missing return links, wrong codes and URLs that redirect or are not canonical, so check the tags with a crawler after launch and whenever pages change.

A buyer in Vienna searches for your product and lands on your German page, with a Hamburg sales contact and delivery terms for Germany, even though you have an Austrian page. Nothing looks broken in your reports. Hreflang tags exist to close this gap between having the right page and showing it to the right person. They look like a few lines of code, but they connect every version of every page, so they can fail without anyone noticing.

This article covers the codes, the ways to add the tags, the errors that break them and how to check them. For the wider work, see our international SEO guide.

What is hreflang in SEO?

The hreflang attribute labels a link with the language, and optionally the region, that a page is written for. A set of these labels tells search engines that several URLs are versions of the same content. Here is one tag:

<link rel="alternate" hreflang="de-AT" href="https://example.com/at/" />

It marks this address as the German version for people in Austria. Google uses these sets to point each searcher to the most suitable version. Three things the tags do not do:

  • They do not change rankings. Asked in 2022 whether rankings could rise after adding them, Google’s John Mueller replied, "Hreflang does not change ranking." He has described the effect as a swap: if your German page already ranks in Austria, Google can show the Austrian URL in its place. If nothing ranks there, there is nothing to swap, so pages still have to match what people search for in each market. That is the job of international keyword research.
  • They do not set the language. Google says it works out a page’s language with its own algorithms, not from hreflang or the lang attribute, so the visible text must be in that language.
  • They do not redirect anyone or fix the result. Google decides what to show, and it says geotargeting is not an exact science. Keep visible links between versions so that people who land on the wrong one can switch.

When you need hreflang tags

Google recommends stating your alternate pages in three situations:

  • Full translations: English and German versions of each page, for example.
  • Regional variations in one language: similar English pages for the US, the UK and Ireland.
  • Translated templates: the main content stays in one language, and only the navigation and footer change.

The second case needs the most care, because near-identical pages give Google little else to tell them apart. If you already see Google showing the wrong country, that article covers the wider diagnosis.

Hreflang works with any international site structure, because alternate URLs do not have to be on the same domain. It does need one URL per version. Google advises against changing content through cookies, browser settings or IP address on a single URL, and against automatic redirects by language, because its crawler may never see the other versions.

You do not need the tags if each page has only one version. Translated pages need them for matching, not to avoid a penalty: Google treats localized versions as duplicates only if the main content remains untranslated.

Language and region codes

An hreflang value has one or two parts joined by a dash: a language code from ISO 639-1, then an optional region code from ISO 3166-1 Alpha 2. Google accepts upper or lower case, although capitals for the region (en-GB) are the convention. The language always comes first, and a country code alone is not allowed.

Use the language alone, such as de, unless the page really differs by country: other prices, certificates, stock or a local contact. Then add the region, as in de-AT. If you have several regional pages in one language, Google suggests adding a catch-all for other speakers of that language, which can be one of those regional pages.

These language and region codes are where small slips creep in:

You wantUseNotWhy
English for the UKen-GBen-UKUK is a reserved code, and Google ignores it
Greek, Swedish, Ukrainianel, sv, ukgr, se, uaThese are country codes; as a language, se means Northern Sami
French in Belgiumfr-BEbebe means Belarusian
German in Germanyde-DEde_DEThe parts take a dash, even if your CMS writes locales with an underscore
Spanish in Latin Americaes, or es-MX per countryes-419Google says it does not support this code
Buyers across the EUen, or one code per countryen-EUEU has no effect in Google Search

For Chinese, you can also state the script: zh-Hans for Simplified and zh-Hant for Traditional.

The rules every set of hreflang tags must follow

Take a site with three versions of each page. These rules apply to the whole set:

VersionCodePath on example.com
English, any regionen/
German, any regionde/de/
German for Austriade-AT/at/
  • Each version lists itself and every other version. The set is identical on all three pages.
  • Every pair points both ways. If two pages do not both point to each other, Google ignores the tags. These return links, also called return tags, are easy to break: change one page, and its partners stop matching.
  • URLs are complete. Write https://example.com/de/, not /de/.
  • URLs are final. List the canonical URL of each version, one that returns 200 and does not redirect. A redirected or missing page cannot point back.
  • Only true equivalents belong together. A German product page lists the English and Austrian versions of that product, not their home pages. If a product has no Austrian page, leave de-AT out of its set.
Diagram of one set of hreflang tags: three page versions labelled en, de and de-AT, joined by two-way arrows, each also listing itself, with x-default pointing to the English page
Every version lists itself and all the others, and every pair points both ways. Based on Google Search Central documentation, 2026.

Large catalogs get some relief. If complete sets become too hard to maintain, Google says you can leave some languages out on some pages, and it still processes the pairs that point to each other. Link newer versions with your original version first.

Three ways to add hreflang tags

Google treats HTML, HTTP headers and an XML sitemap as equivalent. Using all three brings no benefit and makes the work harder to manage, so pick the one that suits each type of content:

MethodWhere the tags goSuitsWatch out for
HTML<link> elements in the HTML head of each pageSites whose CMS or templates can print the full setThe tags must sit inside a valid <head>
HTTP headersA Link: header in the server’s responsePDFs and other non-HTML filesNeeds server access, and the tags do not show in the page source
XML sitemap<xhtml:link> entries under each <url>Large catalogs, or no access to templatesCan drift from the live pages; Yandex no longer supports it for language versions

HTML. Each of the three pages carries the same lines in its <head>, here with x-default added:

  • <link rel="alternate" hreflang="en" href="https://example.com/" />
  • <link rel="alternate" hreflang="de" href="https://example.com/de/" />
  • <link rel="alternate" hreflang="de-AT" href="https://example.com/at/" />
  • <link rel="alternate" hreflang="x-default" href="https://example.com/" />

HTTP headers. A PDF data sheet in two languages returns one header, the same on both files:

Link: <https://example.com/data-sheet.pdf>; rel="alternate"; hreflang="en", <https://example.com/de/data-sheet.pdf>; rel="alternate"; hreflang="de"

XML sitemap. Each URL gets its own entry, and each entry lists every version, including itself. Declare the xhtml namespace in the urlset tag. The child entries do not count toward the sitemap’s URL limit.

<url> <loc>https://example.com/</loc> <xhtml:link rel="alternate" hreflang="en" href="https://example.com/" /> <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/" /> </url>

For most B2B sites we would start with HTML if the CMS can print the tags, and move to a sitemap when a catalog makes the sets long.

Hreflang x-default: the fallback for everyone else

x-default is a reserved value for searchers whose language settings match none of your versions. In the example above, a French-speaking buyer would match nothing, so Google can use this page instead. Google recommends it, but it is not required. Add it as one more line in every set, with no language code.

Google says it was designed for language selector pages and works best there, though it can point to any page. So point it at:

  • Your language or country selector, if you have one.
  • A home page that redirects by language, if yours works that way. This is the one place where a redirecting URL belongs in a set.
  • The version most unmatched buyers can read, if you have neither. For many exporters that is English.

How hreflang and canonical tags work together

Canonical tags and hreflang answer different questions: which URL is the main one among duplicates, and which version suits this searcher. Trouble starts when they disagree.

  • Translated pages point to themselves. Google says that when you use hreflang, the canonical should be in the same language. A German page whose canonical points to the English page sends mixed signals, so watch for templates that print one URL on every version.
  • Regional pages in one language use both. Google may treat near-identical US and UK pages as duplicates and choose one as canonical. It says to pick a preferred version and use rel="canonical" and hreflang together, so that the right regional URL reaches searchers. URL Inspection may then show the other URL as the Google-selected canonical, which is not always a fault: Google notes that the canonical is not always the URL shown in results.
  • The two stay in separate elements. Google does not use a rel="canonical" link for canonicalization if it also carries an hreflang attribute.

How to implement hreflang tags, step by step

  1. List the versions of each page. Keep one sheet with a row per page and a column per version, and mark the gaps.
  2. Assign the codes. Give each column one valid code, and add a region only where the page differs by country.
  3. Choose the fallback. Decide where x-default points.
  4. Pick the method. Use HTML or a sitemap for pages and HTTP headers for PDFs.
  5. Set the canonical tags. Translated versions point to themselves, and the URLs in your sheet match them.
  6. Generate the tags. Let the CMS or a script write them from the sheet, because hand-edited sets drift apart.
  7. Test, then crawl. Test one page per template, then crawl every version after launch.
  8. Add it to your publishing routine. Whoever adds, moves or retires a page updates its set in every language.

Hreflang in a CMS or plugin

Most sites do not write these tags by hand. At the time of writing (November 2026), these systems say they create them for you:

PlatformWhat its documentation says
WordPress with WPMLInserts the tags and updates them as the site changes
WordPress with PolylangAdds the tags, but x-default only on the home page unless you add a code snippet
Shopify MarketsAdds the tags, including x-default, once markets are configured
HubSpot CMSAdds alternate links between the pages of a multi-language group

Automatic does not mean correct. View the source of a few pages and check the region codes, the pages with no translation, the canonical tags, and whether a theme or a second plugin prints another set. Choosing a platform is a separate decision, part of the wider project of building a multilingual website.

Common hreflang errors and how to fix them

Ahrefs’ 2023 study of 374,756 domains using hreflang found at least one issue on 67% of them. This is one vendor’s data, and not every issue matters equally, so we list them from what breaks the tags to what is only untidy:

ErrorDomains (Ahrefs, 2023)Why it mattersFix
Missing return links15.3%Google ignores pairs that do not point to each otherGenerate every set from one source
Tags point to redirected or broken pages16.9%The target cannot point backUse final URLs that return 200
Tags point to non-canonical URLs8%Hreflang and the canonical give different answersList each version’s canonical URL
Invalid codes4.6%Google ignores codes it cannot use, such as UKCheck them against the two standards
More than one page for one code2.5%Google has to choose; often page tags and a sitemap disagreeOne URL per code, one method
lang and hreflang disagree3.2%Google ignores lang, but a mismatch can reveal a wrong labelCheck the language on the page
Missing self-reference18%Google’s rules ask each version to list itselfPrint the same full set on every version
Missing x-default56.3%Recommended, not requiredAdd it if you have a sensible fallback

One more error sits outside that study: a broken <head>. HTTP Archive’s 2025 Web Almanac found invalid elements in the <head> of 10.1% of desktop pages and 10.3% of mobile pages, and it warns that hreflang tags below such an element end up in the <body>, where they have no effect. If in doubt, Google suggests pasting the rendered code into an HTML validator.

How to check hreflang tags: checkers and monitoring

Search Console no longer has an hreflang report. Google retired the International Targeting report, while saying it still uses hreflang tags. So you need a mix of tools (at the time of writing, November 2026):

What you checkToolWhat it shows
One live page or sitemapMerkle’s hreflang Tags Testing ToolWhether the tags are correct
A set you are writingAleyda Solis’s Hreflang Tags GeneratorCorrect syntax, for up to 50 URLs
The whole siteA crawler, such as Screaming Frog’s SEO Spider or Ahrefs’ Site AuditMissing return links, URLs that do not return 200 and more
What Google crawledURL Inspection in Search ConsoleThe returned HTML and the Google-selected canonical
What searchers getPerformance report in Search ConsoleWhich pages get impressions in each country

Google lists the first two in its documentation, but it neither maintains nor checks them. An hreflang checker tests the rules and not your plan, so it will not notice that you paired the wrong product. Have someone who knows the catalog review a sample.

The last row is the real test, and the core of your monitoring. Filter the Performance report by a country, such as Austria, and group by page. If impressions go to the German URLs and not the Austrian ones, look at the set first, then at how much the two pages really differ. Crawl again whenever you add a language, change a template or move URLs, because that is when sets break.

Once the tags are right, the remaining question is who keeps them right. If you are considering outside help, our article on choosing an international SEO consultant lists the questions to ask.

How Faox Digital sets up language versions

At Faox Digital, each language of a site gets its own structure, set up to rank and read in its own market, and hreflang belongs to the foundations step of an SEO project. We treat localization and translation as two different jobs, so each version is written for its market rather than copied from another.

Key takeaways

  • Hreflang tags connect the versions of a page so search engines can show the right one. They do not change rankings.
  • Each version lists itself and all the others, and every pair must point both ways, or Google ignores the tags.
  • Codes take the language first, then an optional region. UK, EU and es-419 have no effect in Google Search.
  • Use one method per type of content, keep canonical tags in the same language and list only final, canonical URLs.
  • Search Console has no hreflang report, so use a crawler and watch which pages get impressions in each country.

Frequently asked questions

How do I add hreflang tags in WordPress?

The usual route is a multilingual plugin. WPML and Polylang both add the tags automatically once pages are connected as translations. Then view the source of a few pages to check the codes, x-default and canonical tags, and make sure no other plugin prints a second set.

How do I check hreflang tags?

For one page, read the source or use a testing tool such as Merkle’s. For a whole site, run a crawler. Then use Search Console’s Performance report to see which pages get impressions in each country.

Do other search engines use hreflang?

Yandex does. It recommends hreflang markup on the page and says it no longer supports sitemaps for language versions. Bing is less clear: Fabrice Canel, then at Bing, said in 2020 that hreflang counts for far less there than content-language, and we found no newer statement. Check each engine’s current guidance if it matters in your market.

How do you pronounce hreflang?

We found no official pronunciation. The word joins two HTML terms, href and lang, so "h-ref-lang" is the natural way to say it.

Sources

  1. Google Search Central: Tell Google about localized versions of your page, 2026
  2. Ahrefs: Over 67% of Domains Using Hreflang Have Issues, 2023
  3. HTTP Archive: Web Almanac 2025, SEO chapter, 2026
  4. Library of Congress: ISO 639 language code list, accessed November 2026

Let’s talk

Where do you want to be found?

Tell us the searches that matter to your business. We will review your site and tell you plainly what to fix first, including what you can do yourself.

See our B2B SEO services →

Chat with us