SpacebirdFree AI plan
Home
›
Glossary
›
Hreflang
Technical SEO

Hreflang

Hreflang is a code that tells search engines which language or country version of a page to show to which user.

Hreflang is a technical hint that tells search engines which language or country version of a page belongs to which visitor. That's particularly relevant for businesses that serve several countries or languages: many websites exist in more than one language, or in separate versions for, say, the UK and Ireland. Without hreflang, Google has to guess for itself which version to show to a searcher in London, Dublin or Paris.

Important to know: hreflang is a signal, not a command. Google says it uses the hint to show the right version, but it can also take other signals into account. Bing mainly uses the language metadata and the content of the page itself.

How does hreflang work?

Each language version of a page refers to all the other versions, including itself. This is done with a code for the language and optionally the country, such as en-gb for English in the United Kingdom, en-ie for English in Ireland or fr-fr for France. You can also set an x-default: the version for visitors who don't match any language, often a language selection page or the English version.

You can add hreflang in three ways: in the head of each page, in the HTTP header (mainly for PDFs) or in your sitemap. Choose one method and stick to it consistently. For smaller sites, the head is usually the simplest; for large sites with many language versions, the sitemap is often easier to manage.

An example

An online store in Manchester sells garden furniture across the UK, Ireland and northern France. There are three versions: /en-gb/ for the UK, /en-ie/ for Ireland with euro prices, and /fr-fr/ with French delivery terms. Without hreflang, Google sometimes shows the UK version to a searcher in Dublin, with different prices and shipping costs. With correct hreflang annotations and an x-default pointing to a language selection page, it becomes much more likely that every visitor gets the version that suits them.

Common mistakes

  • No return link: if the UK page refers to the Irish one but not the other way round, Google may ignore the annotation.
  • Wrong codes: the language always comes first, so en-gb and not gb-en. And the country code for the United Kingdom is gb, not uk (uk is the language code for Ukrainian).
  • Conflicting signals: a canonical tag pointing from the Irish version to the UK version undermines your hreflang. Each language version should canonicalise to itself.
  • Referring to non-indexable pages: URLs with a noindex or a redirect don't belong in your hreflang set.
  • Automatic redirects based on IP address: these can prevent search engines from seeing all the versions.

Hreflang and AI search

Whether AI assistants such as ChatGPT or Perplexity use hreflang directly isn't publicly known. They do often rely on search indexes, and Google AI Overviews builds on Google Search itself. If you have the right language version in the right place there, you probably also increase the chance that AI answers refer to the appropriate page. Clearly separated language versions, each with a proper URL structure, help avoid confusion in any case.

Hreflang becomes error-prone as soon as your site grows, especially with dozens or hundreds of pages per language. A technical SEO analysis of your multilingual website checks whether all references are correct and confirm each other.

How Spacebird helps

Get your multilingual site checked

How will your business be found in AI?

Request your free AI visibility plan. An expert analyses your business and contacts you within 1 working day to present your plan in person.

Visibility scan
yourbusiness-example.com
GoogleModerate
AI answersLow
ContentLimited
+Search opportunities you’re still missing today – you’ll find them in your plan.
Illustrative example