Skip to content
Aback Launch
Guides9 min read

Hreflang Checker Guide: How to Write, Test and Fix Hreflang Tags

How to use a hreflang checker, and how hreflang works: language and region codes, HTML, HTTP header and sitemap examples, return links, x-default and the errors that make search engines ignore your tags.

Devvrat Hans

Founder

November 19, 2026
Hreflang Checker Guide: How to Write, Test and Fix Hreflang Tags

A hreflang checker reads the hreflang tags on a page and tells you whether search engines can use them: valid language and region codes, a self reference, an x-default, and alternates that link back. Paste a multilingual page into the free hreflang checker to list every alternate with its code and status, and see which pairs are broken.

Hreflang is easy to describe and easy to get wrong. One mistyped region code, or a translated page that forgets to link back, and Google quietly ignores the pair. Nothing breaks for visitors, so the problem can sit unnoticed for months while Spanish searchers land on your English page. This guide explains what hreflang does, the codes it accepts, the three ways to implement it with code you can copy, and the errors a hreflang tag checker catches.

What hreflang does

Hreflang tells search engines that several pages are versions of the same content for different languages or regions, and which version is for whom. When someone searches in German, Google can then show your German page in place of the English one, even if the English page is the one with more links.

What hreflang does not do:

  • It does not translate or create pages. You need real localized versions first.
  • It is not a ranking boost. It swaps the right version into results the cluster already earns; it does not make the cluster rank higher.
  • It is not needed for single-language sites. If you only publish in English, you do not need hreflang at all, even if you have visitors worldwide.
  • It is a signal, not a command. Google may still show another version if it judges it more relevant.

The most common reason to need it is regional variants of the same language. English pages for the US, UK and Australia are nearly identical, so without hreflang Google treats them as duplicates and may show the US page with US prices to someone in London. Hreflang tells Google they are deliberate alternates.

Language and region codes

Each hreflang value is a language code, optionally followed by a region code:

  • Language: ISO 639-1, two letters. en, es, de, fr, pt, ja, zh.
  • Region (optional): ISO 3166-1 alpha-2, two letters, after a hyphen. en-GB, es-MX, pt-BR.
  • x-default: a special value for the fallback page, covered below.

The language always comes first, and a region alone is not valid. These codes trip people up most:

WrongRightWhy
en-UKen-GBThe ISO 3166 code for the United Kingdom is GB
en-EUen-IE, en-DE, or plain enEU is not a country code; target countries or the language
be (meaning Belgium)nl-BE or fr-BEbe is the language code for Belarusian; Belgium needs a language plus BE
jpja or ja-JPjp is the country code for Japan; the language is ja
se (meaning Swedish)sv or sv-SESwedish is sv; SE is the country
es-LA (Latin America)One tag per country (es-MX, es-AR, es-CO), or plain esLA is the country code for Laos; there is no two letter code for Latin America
en_USen-USUse a hyphen, not an underscore

If your content differs only by language, use plain language codes (es, de). Add regions only when you really have different pages per country, such as different prices, currency, shipping or legal text. Fewer, well formed tags beat a long list that guesses.

Three ways to implement hreflang, with examples

You can put hreflang in the HTML head, in HTTP headers or in your XML sitemap. All three are equivalent to Google. Pick one per page type and use it consistently, because conflicting annotations from two methods make the whole set unreliable.

Here is a hreflang example for a pricing page in US English, UK English and German, with an x-default. The exact same block goes in the head of all three pages:

<link rel="alternate" hreflang="en-US" href="https://example.com/pricing" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/pricing" />
<link rel="alternate" hreflang="de" href="https://example.com/de/preise" />
<link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />

Note that each page lists itself as well as the others, and that every href is a full absolute URL with https://. This is the method to use if you control your templates and have a handful of languages.

Files without an HTML head, like PDFs, can carry hreflang in the response header. Each alternate is separated by a comma:

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

In practice this is sent as one header line; it is wrapped here to be readable. You can confirm what your server actually sends with the HTTP header checker.

3. XML sitemap (best for many languages)

With ten or twenty language versions, the HTML method adds dozens of tags to every page. The sitemap method moves them out of the page. Each url entry lists every alternate, including itself, using the xhtml namespace:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://example.com/pricing</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/pricing" />
    <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise" />
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />
  </url>
  <url>
    <loc>https://example.com/de/preise</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/pricing" />
    <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise" />
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />
  </url>
</urlset>

Every language version gets its own url entry with the full set of alternates. The downside is that the tags are invisible on the page, so page-level tools will not see them; you check them by reading the sitemap. Our XML sitemap guide covers the rest of the sitemap rules, and Google's own reference is Tell Google about localized versions of your page.

MethodBest forDrawback
HTML link tagsMost sites with a few languagesAdds weight to every page as languages grow
HTTP Link headerPDFs and other non-HTML filesNeeds server configuration, easy to forget
XML sitemapLarge sites with many languagesNot visible on the page, harder to spot check

Hreflang works in pairs. If your English page says the German page is its alternate, the German page must say the English page is its alternate. If the return link is missing, search engines ignore that pair, because anyone could otherwise claim another site's page as their translation.

Return links usually break when one language is updated separately: a new German page goes live, the English page gets its tag, but the French and Spanish pages are never updated. Generate the hreflang block from one shared list of versions in your code, rather than writing it by hand per page, and the problem disappears.

Every page lists itself

Each version must include a tag pointing to its own URL, with its own code. It looks redundant, but the self reference is part of the set that search engines compare across pages. The simplest way to guarantee it is to output the identical block on every version, as in the example above.

Hreflang and canonical tags must agree

Each language version should carry a self-referencing canonical URL. A common mistake is to canonicalize every translation to the English page, which tells Google the translations are duplicates and should not be indexed, and so cancels the hreflang. Hreflang should only point at URLs that are themselves canonical, indexable and return 200. Our canonical tag guide covers this in detail, and the canonical URL checker shows where each version's canonical points.

What x-default is for

hreflang x-default names the page to show when none of your language or region codes match the searcher. If you have en, de and fr versions, a searcher in Italian matches none of them, and x-default tells Google which one to show.

Two common choices:

  • Your main language version, often English, when it serves as the international default.
  • A language picker page, when you have no single default and want visitors to choose.

x-default is optional, but recommended. It is also the right place to point a home page that auto-detects language: let the root URL be x-default and give each detected version its own URL and code.

Common hreflang errors

  1. Missing return links. The single most common error, explained above.
  2. Invalid codes. en-UK, jp, region-only codes, underscores.
  3. No self reference. The page lists its siblings but not itself.
  4. Alternates that redirect or fail. The tag points at an old URL that now redirects, or at a 404. Point at the final working URL; run old ones through the redirect checker to find where they land.
  5. Relative URLs. A bare path such as /de/preise in the href is not enough. Use absolute URLs.
  6. Translations canonicalized to one language. Cancels the whole setup.
  7. The same code used twice. Two different URLs both marked de, so search engines cannot tell which is the German page.
  8. Hreflang on noindex pages. An alternate that is excluded from the index cannot be shown.

How to check hreflang tags

The free hreflang tag checker fetches a page, reads its hreflang link tags and, for each alternate, reports the code, whether the code is valid, the status that URL returns and whether it links back. It flags en-UK specifically, warns when x-default is missing, catches a missing self reference and spots duplicate language codes. It reads tags in the HTML; if you use the sitemap method, check the xhtml:link entries in the sitemap itself.

A practical routine:

  1. Check one page per template in each language, not just the English home page.
  2. Check a page right after adding a new language, since that is when return links break.
  3. View the source of one alternate yourself to confirm the block is in the head and identical across versions.
  4. Watch the Page indexing report in Search Console for translated pages marked as duplicates, which usually points to a canonical conflict.

International SEO beyond hreflang

Hreflang is one part of international SEO. A few other decisions shape how well localized pages perform:

  • URL structure. Subfolders (example.com/de/) keep all versions on one domain and share its authority. Country domains (example.de) send the strongest country signal but each one starts from scratch. Subdomains (de.example.com) sit in between. All three work with hreflang; subfolders are the easiest for a small team.
  • Do not auto-redirect by IP or browser language. Googlebot crawls mostly from US addresses, so forced redirects can hide your other versions from it. Suggest the local version with a banner instead, and let every version stay reachable.
  • Translate the whole page. Title tag, meta description, headings and body. A page with a German title and English body sends mixed signals.
  • Set the lang attribute. Add lang="de" to the html element of each version. It helps browsers, screen readers and translation tools, and costs one attribute.

For the full list of on-page items to review on each version, use our on-page SEO checklist. Then run one page from every language through the free hreflang checker and fix any pair that does not link back.

FAQ

What is a hreflang tag?

A hreflang tag is a link element, written as rel="alternate" with a hreflang attribute, that tells search engines a page has versions in other languages or for other regions, and which URL serves which audience. Search engines use it to show each searcher the version in their language.

How do I check if hreflang tags are working?

Run the page through a hreflang checker, which lists every alternate and confirms valid codes, a self reference, x-default and return links. Then check a few alternates by hand and watch Search Console for translated pages treated as duplicates.

Is it en-UK or en-GB?

en-GB. The region part of a hreflang value is an ISO 3166-1 alpha-2 country code, and the United Kingdom's code is GB. en-UK is not a valid value and is ignored.

Do I need x-default?

It is optional but recommended. x-default tells search engines which page to show when no language or region in your set matches the searcher, typically your main language version or a language picker.

Should hreflang go in the HTML or the sitemap?

Either works the same for Google. HTML tags are simplest for a few languages; the sitemap is better when you have many, because it keeps page heads small. Use one method per page and keep it consistent.

Does hreflang help rankings?

Not directly. It does not raise a page's position; it helps search engines show the right language or regional version in the results the content already earns, which improves click through and reduces bounces from the wrong audience.

Written by

Devvrat Hans

Founder

Share
Newsletter
Get the Monday launch email
The week's new launches and winners, in one short email.

By subscribing, you agree to get our newsletter by email. Unsubscribe any time in one click. See our Privacy policy and Terms.

Launch your startup on Aback Launch

Get a launch page that search engines and AI assistants can read, a place in the weekly launch list, and a review by a real person. Free to join.