Technical SEO

Hreflang Tags: A Step-by-Step Guide for International SEO

Paul Donnelly5 min read
A diverse collection of national flags waving under a vibrant blue sky.

Hreflang is one of the most error-prone technical SEO implementations in existence. Google's own technical documentation confirms that hreflang errors are among the most commonly reported issues in international sites, and Ahrefs data consistently shows that more than 75% of sites using hreflang have at least one implementation error. These errors cause Google to serve the wrong language or country version to users, harming both user experience and search performance. Getting hreflang right is worth the careful attention it demands.

What Is Hreflang and What Does It Tell Google?

Hreflang is an HTML attribute that tells Google which version of a page to show to users in specific language and geographic contexts. It solves a specific problem: when you have the same page in multiple languages or regional variants, Google needs to know which version is intended for which audience. Without hreflang, Google guesses, and frequently gets it wrong, showing your French page to German users or your US English page to UK visitors.

Hreflang tags are read by Googleand Yandex (not Bing, which has its own method). They are implemented in three possible locations: in the HTML <head> of each page, in your XML sitemap, or in HTTP response headers (for non-HTML files). For most websites, implementation in the HTML <head> is the most straightforward and the most commonly used method.

What Is the Correct Hreflang Syntax?

A hreflang tag has the following structure:

<link rel="alternate" hreflang="language-COUNTRY" href="https://yourdomain.com/page-url/" />

The hreflang attribute value consists of:

  • A language code in ISO 639-1 format (e.g. "en" for English, "fr" for French, "de" for German, "es" for Spanish)
  • Optionally, a country code in ISO 3166-1 alpha-2 format (e.g. "GB" for United Kingdom, "US" for United States, "FR" for France)

Language codes are lowercase; country codes are uppercase. Combined, they look like: en-gb, en-us, fr-fr, de-at (German for Austria).

You can use language only (without a country): hreflang="fr" targets all French speakers regardless of country. You can use country only when combined with language: hreflang="en-gb" targets English speakers in the UK specifically.

The special x-default value points to the default page shown to users whose locale does not match any other hreflang annotation:

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

What Is the Reciprocal Requirement?

The most critical rule of hreflang: every page in the international set must include hreflang annotations for every other page in the set, including itself. This reciprocal structure confirms to Google that the annotations are intentional and correctly cross-referenced.

If you have four versions of a page:

  • UK English: yourdomain.com/uk/about/
  • US English: yourdomain.com/us/about/
  • French: yourdomain.com/fr/about/
  • German: yourdomain.com/de/about/

Each of these four pages must contain all four hreflang annotations (plus x-default) in its <head>:

<link rel="alternate" hreflang="en-gb" href="https://yourdomain.com/uk/about/" />
<link rel="alternate" hreflang="en-us" href="https://yourdomain.com/us/about/" />
<link rel="alternate" hreflang="fr" href="https://yourdomain.com/fr/about/" />
<link rel="alternate" hreflang="de" href="https://yourdomain.com/de/about/" />
<link rel="alternate" hreflang="x-default" href="https://yourdomain.com/about/" />

A hreflang annotation that is not reciprocated will be ignored by Google. This is why hreflang errors are so common: a single missing annotation on one page breaks the confirmation chain for that entire page cluster.

How Do You Implement Hreflang in Your HTML?

Method 1: HTML Head Tags

Place all hreflang link elements in the <head> section of every page in the international set. This is the most reliable method for most websites.

For large sites with many international versions, this means each page's <head> can contain a large block of hreflang tags. With ten language versions and hundreds of pages each, this is manageable but requires a systematic, template-driven approach rather than manual implementation.

Most CMS platforms (WordPress, Shopify, Contentful) have plugins or built-in features that automate hreflang generation once configured correctly. Verify the output by viewing the page source and confirming all annotations are present and correctly formatted.

Method 2: XML Sitemap

In an XML sitemap, hreflang is implemented using the <xhtml:link> extension within each <url> block:

<url>
  <loc>https://yourdomain.com/uk/about/</loc>
  <xhtml:link rel="alternate" hreflang="en-gb" href="https://yourdomain.com/uk/about/"/>
  <xhtml:link rel="alternate" hreflang="en-us" href="https://yourdomain.com/us/about/"/>
  <xhtml:link rel="alternate" hreflang="fr" href="https://yourdomain.com/fr/about/"/>
  <xhtml:link rel="alternate" hreflang="de" href="https://yourdomain.com/de/about/"/>
  <xhtml:link rel="alternate" hreflang="x-default" href="https://yourdomain.com/about/"/>
</url>

The sitemap must declare the XHTML namespace: xmlns:xhtml="http://www.w3.org/1999/xhtml". The sitemap method is useful for large sites where adding tags to every page's HTML is impractical, but it only works if Google regularly crawls your sitemap.

What Are the Most Common Hreflang Errors?

Missing Reciprocal Annotations

The most common error. If page A references page B but page B does not reference page A, Google ignores the annotation. Automated auditing tools are essential for catching these at scale.

Incorrect Language or Country Codes

Using "uk" instead of "gb" for the United Kingdom country code is a frequent mistake ("uk" is the country code for Ukraine). Using "en-UK" instead of "en-gb" (country codes are not case-sensitive in practice, but using correct casing avoids ambiguity). Using unsupported language codes that do not exist in ISO 639-1.

Hreflang Pointing to Redirects or Non-200 Pages

Hreflang must point to the live canonical URL returning a 200 HTTP status. Hreflang pointing to a page that redirects to another URL does not pass the signal correctly. Hreflang pointing to a noindexed page is also invalid.

Mixing Hreflang Methods Inconsistently

If some pages implement hreflang in the HTML head and others in the XML sitemap, the inconsistency can create conflicts. Choose one method and apply it consistently.

Self-Referential Hreflang Missing

Every page must include a hreflang pointing to itself. A page that references all its alternate versions but forgets to include its own URL in the annotation set is technically non-compliant.

How Do You Validate Your Hreflang Implementation?

Screaming Frog

Screaming Frog's hreflang validator crawls your site, identifies hreflang annotations, and checks for reciprocal errors, missing self-referential annotations, invalid language codes, and redirect issues. The hreflang report is the fastest way to get a comprehensive view of your implementation quality.

Google Search Console

Google Search Console's International Targeting report (now under Settings) previously showed hreflang errors directly. While this feature has been reduced in recent versions, the URL Inspection tool can be used to check what hreflang data Google has processed for individual pages.

Ahrefs Site Audit

Ahrefs' Site Audit module includes hreflang checks and generates a summary of common errors across your site with specific URLs flagged for each error type.

If you are expanding internationally and want your hreflang implementation to be correct from the start, Dynamically can set up and validate your international SEO technical infrastructure. Get in touch to discuss your international expansion.

Paul Donnelly — Backend Developer at Dynamically

Written by

Paul Donnelly

Backend Developer

Paul is a backend developer at Dynamically, leading technical SEO audits, site migrations, and structured data implementation.

Back to Insights

Work with Dynamically

Ready to put these insights into practice?

Our Liverpool-based team works with UK businesses to grow organic search, improve paid media performance and build visibility in AI-powered search. Get a free audit to see exactly where your opportunities are.