InSpace logo
Schedule free demo
bubble illustration bubble illustration bubble illustration

Hreflang Tags Explained: Syntax, Examples, Implementation and Common Errors

Hreflang Tags Explained: Syntax, Examples, Implementation and Common Errors

SEO

June 09, 2026 • min read

Hreflang tags help search engines understand which language or regional version of a page should be shown to the right user. If your site serves multiple countries, multiple languages, or both, correct hreflang implementation can improve relevance, reduce indexing confusion, and support stronger International SEO. This guide covers what hreflang is, how it works, how to implement it, and the mistakes that most often break it.

What hreflang tags are

Hreflang is an attribute used to signal alternate versions of a page for different languages or regions. It tells search engines that several URLs are closely related, but intended for different audiences.

For example, you might have:

  • en-us for English speakers in the United States
  • en-gb for English speakers in the United Kingdom
  • de-de for German speakers in Germany

Without hreflang, search engines may struggle to choose the best version for a user, especially when pages are very similar across markets. With it, you make those relationships explicit.

Why hreflang matters for SEO

Hreflang does not act like a direct ranking boost, but it plays an important role in SEO. Its main job is to improve matching between searchers and the correct local page.

  • Better audience targeting – Users are more likely to land on the version written for their language or market.
  • Cleaner handling of similar pages – Regional or translated pages can look highly similar, and hreflang helps search engines understand they are intentional alternatives.
  • Stronger user experience – Visitors avoid landing on the wrong currency, spelling, messaging, or regional offer.
  • Clearer international page relationships – Search engines can interpret your localized structure more accurately.

This becomes especially important for businesses expanding into multiple markets, where localized content, internal linking, and indexing signals need to work together rather than compete.

What a hreflang tag looks like

The basic HTML format looks like this:

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

Each part has a specific role:

  • rel=”alternate” identifies the page as an alternate version
  • hreflang=”en-us” specifies the language and optional region
  • href=”…” points to the correct URL for that version

How hreflang values work

Hreflang values can target language only or language plus region.

Language only

Use a language code when the same version serves all users of that language:

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

Language plus region

Use a language and country code when the page is tailored to a specific market:

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

This is useful when pages differ by currency, product availability, legal details, shipping terms, or local wording.

x-default

The x-default value is used for a fallback page when no language or regional version is the best match.

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

This is often used for a global homepage or language selector.

Correct hreflang implementation rules

Most hreflang problems come from a few core mistakes. If you get the following rules right, your setup is usually in much better shape.

Every version should reference all alternatives

If an English page and a German page are alternates, both pages should include the full set of hreflang references. Search engines use that reciprocity to confirm the relationship.

Include a self-referencing hreflang tag

Each page should usually include a hreflang entry for itself. This helps create a complete and consistent cluster.

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

Use valid language and region codes

Language codes should follow ISO 639-1 and region codes should follow ISO 3166-1 Alpha 2. A common example is using en-gb rather than en-uk.

Point hreflang to canonical, indexable URLs

Your hreflang annotations should reference live canonical URLs, not redirected pages, broken pages, or URLs that declare another canonical target. When canonical and hreflang conflict, search engines may ignore the setup or interpret it unpredictably.

How to add hreflang tags

There are three standard implementation methods. You only need one per page type, and consistency matters more than complexity.

1. HTML head

This is the most direct option for normal web pages. Add the alternate links inside the <head> of each page.

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

This works well for smaller sites or where page templates can handle the markup cleanly. It becomes harder to manage as the number of languages and URLs grows. If you’re using WordPress, our WordPress SEO guide covers implementation details and common pitfalls.

2. XML sitemap

For larger Multilingual SEO sites, hreflang in XML sitemaps is often easier to maintain. Instead of placing alternate links in every page template, you manage the relationships centrally.

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

This method is often preferred when scaling SEO across many pages, because updates are easier to control in one place.

3. HTTP headers

HTTP headers are mainly used for non-HTML files such as PDFs. Since those files do not have a page head, hreflang needs to be delivered in the response header instead.

Hreflang and canonical tags

Hreflang and canonical tags solve different problems, but they must work together.

  • Hreflang tells search engines which page version fits which audience.
  • Canonical tells search engines which URL is the preferred version when duplicates or near-duplicates exist.

A common mistake is setting regional pages as alternates with hreflang, then canonically pointing them all to a single master URL. That sends mixed signals. If your US and UK pages are distinct regional versions, they should normally be self-canonical and connected through hreflang.

Common hreflang errors to avoid

You do not need a complex setup to get hreflang wrong. Most failures come from a short list of technical mistakes.

Missing return links

If page A references page B, but page B does not reference page A, the hreflang relationship is incomplete.

Missing self-referencing hreflang

When a page links to alternates but not to itself, the cluster is weaker and easier to break.

Invalid codes

Incorrect language or region values can cause search engines to ignore your annotations entirely.

Multiple URLs for the same language-market target

If two pages both claim the same hreflang value, search engines may not know which one to serve.

Hreflang pointing to non-canonical or broken pages

Alternate links should not point to redirected, noindexed, canonicalized-away, or 404 pages.

Using multiple implementation methods carelessly

HTML, sitemap, and header implementations can all work, but mixing methods without perfect alignment increases the chance of conflicting signals.

Language mismatch between page content and signals

If the page content, HTML language attribute, and hreflang point to different languages, search engines receive inconsistent information.

When hreflang is worth implementing

Hreflang is useful when you have materially equivalent pages for different languages or markets. Typical examples include:

  • Translated versions of the same page
  • Regional variants with different pricing, currency, legal copy, or local messaging
  • Multinational content hubs where several countries share the same core page with localized differences

If you only have one language and one market, hreflang usually is not needed.

Practical maintenance tips

Hreflang is not a set-and-forget task. It needs maintenance whenever your site structure changes.

  • Update hreflang when URLs change
  • Check clusters after migrations or template updates
  • Audit for broken, redirected, or non-canonical targets
  • Review international sections in Google Search Console and crawl reports
  • Keep localized content and internal linking aligned with your market structure

That last point matters because hreflang works best when it supports a broader multilingual SEO setup, not when it is treated as an isolated tag fix.

FAQ

What are hreflang tags?

Hreflang tags are signals that tell search engines which language or regional version of a page should be shown to different users.

What is an example of a hreflang tag?

A basic example is:

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

How do I add hreflang tags?

You can add them in the HTML head of a page, in an XML sitemap, or in HTTP response headers for non-HTML files.

How do hreflang tags help international SEO?

They help search engines match the right localized page to the right audience, which improves relevance and reduces confusion between similar regional or language versions.

For teams managing multilingual SEO at scale, hreflang usually performs best as part of broader technical optimization that also covers canonical tags, indexing control, localized content structure, and internal linking.

background illustration

Martijn Apeldoorn

Leading Inspace with both vision and personality, Martijn Apeldoorn brings an energy that makes people feel instantly at ease. His quick wit and natural way with words create an atmosphere where teams feel at home, clients feel welcomed, and collaboration becomes something enjoyable rather than formal. Beneath the humor lies a sharp strategic mind, always focused on driving growth, innovation, and meaningful partnerships. By combining strong leadership with an approachable, uplifting presence, he shapes a company culture where people feel confident, motivated, and genuinely connected — both to the work and to each other.

background illustration

We're always on comms.

Let us help you chart your next digital mission with confidence.

Glow Now
background illustration

share_link:

Table of contents

background illustration

We're always on comms.

Let us help you chart your next digital mission with confidence.

Glow Now
image image

Related articles

background illustration background illustration

NO TIME FOR SEO?

GOOD. NOVA DOES IT FOR YOU.

See how your entire SEO strategy builds itself without extra work.