Search · Term

Hreflang

Hreflang is an HTML attribute that tells search engines which language, and optionally which country, each version of a page is meant for, so they can show searchers the most suitable version.

Hreflang is a hint, not a redirect or a translation tool. It does not move visitors anywhere and does not stop Google ranking the wrong version if other signals conflict. It helps Google choose between pages that already exist in different languages or for different regions, such as an English page and its Albanian or German equivalent.

It also differs from a canonical URL. A canonical says pages are duplicates and names the one to keep; hreflang says pages are alternatives for different audiences and that all of them should stay in the index.

How it works

Each language version lists itself and every alternative, usually with link tags in the page head, though the same information can go in HTTP headers or an XML sitemap. Values use language codes such as en, de or sq, optionally followed by a country code, as in en-GB or de-AT. A special value, x-default, marks the page to show when no version matches.

The annotations must be reciprocal. If the English page points to the German one, the German page must point back, or Google may ignore the pair. Every listed URL should be the canonical, indexable version of that page and return a normal response.

Hreflang works between groups of pages, not whole sites. Each page in a set needs the full list, so a site with three languages and fifty pages has fifty sets of three, which is why most sites generate the tags from their content management system or sitemap rather than writing them by hand. Google treats hreflang as one signal among several, alongside the language of the page itself, links and the searcher's settings, so a mistake usually means a less suitable version is shown rather than the page disappearing.

Example

A dental clinic that treats patients from abroad has its site in English, German and Albanian, but German speakers searching from Austria keep landing on the English pages. The developer adds hreflang tags to each group of pages, each listing all three versions plus an x-default pointing to the English page. Over the following weeks, Google starts showing the German pages to German-language searchers.

Some pages, such as a new blog post, had no German version yet. The developer leaves those out of the hreflang sets rather than pointing a German slot at the English page, and adds them when the translation is ready. A crawl after launch flags two German pages that still had canonical tags pointing to their English originals, which contradicts the hreflang signal, and they are corrected to point to themselves.

Why it matters for your business

For a business that serves customers in more than one language, hreflang reduces the chance that people land on a page they cannot read and leave. It is worth doing when the translated pages exist and are genuinely equivalent. A site in one language for one country does not need it, and no tag makes up for a machine translation nobody has checked. If you add a language later, plan the tags as part of that launch rather than as an afterthought, since fixing them across many pages takes far longer.

Common mistakes

  • Forgetting the return link, so the two versions never confirm each other.
  • Using invalid codes, such as en-UK instead of en-GB, or a country code with no language.
  • Pointing hreflang at URLs that redirect, are blocked or carry a noindex rule.
  • Adding hreflang to pages that are not actually translated or adapted for their audience.

Questions people ask

Do I need hreflang for a website in one language?

No. Hreflang only helps when the same content exists in more than one language or regional version. A site in one language for one market gains nothing from it. If you serve identical pages in the same language to several countries, it is usually optional as well.

What is x-default in hreflang?

X-default is a special hreflang value that names the page to show searchers whose language or region does not match any listed version. It is often a language selector page or the main international version, such as the English site. It is optional but widely recommended.

How do I check my hreflang tags?

Crawl the site with an SEO crawler that reports hreflang errors, such as missing return links, invalid codes or links to pages that cannot be indexed. Then spot-check key pages in the page source. Search Console's URL Inspection shows which canonical Google chose for each page, which helps reveal conflicts.

Related terms

Have something worth building right?