What is hreflang x-default and when do you need it?

Published

Short answer

hreflang="x-default" names the page Google should show when a user's browser language and region match none of the versions you list, usually a language chooser or your main version. Google recommends it as the fallback but does not require it. Add it when visitors come from languages or regions you do not serve, and only inside a complete hreflang set where every page lists itself and all the others.

If an audit has flagged "missing x-default" or "hreflang without x-default", the fix takes one line per page. The line only helps if the rest of the set is correct, though, and that is where most hreflang problems are. This guide follows Google's documentation on localized versions of a page: what x-default means, the three ways to declare it, and the mistakes that make Google ignore the annotations.

On this page
  1. What does hreflang x-default mean?
  2. How do I add hreflang x-default in HTML?
  3. Can I declare x-default in an HTTP header?
  4. How do I add x-default to an XML sitemap?
  5. What does "missing x-default" mean, and which hreflang mistakes matter more?
  6. Do other search engines and AI answer engines use hreflang?
  7. How does AISeeWhy check hreflang?

What does hreflang x-default mean?

hreflang annotations tell Google which URL serves which language or region, so it can send each user to the right version. Google describes x-default as a reserved value used when no other language or region matches the user's browser setting. It was designed for language selector pages, and Google recommends it for naming the fallback page.

Take a site with versions for en-GB, en-US and de. A reader in Germany gets the German page and a reader in the United States gets the US page. A reader whose browser is set to French matches nothing, so Google uses the page you marked x-default.

hreflang does not tell Google what language a page is in. Google says it uses neither hreflang nor the HTML lang attribute to detect a page's language. hreflang only links versions of the same content to their audiences.

How do I add hreflang x-default in HTML?

The most common method is a set of link elements in the <head>. Every page in the set carries the same block: one line per version, including a line for the page itself, plus the x-default line.

<!-- Put the same block in the <head> of every page in the set -->
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/pricing/" />
<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/pricing/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/preise/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/pricing/" />

Google requires fully qualified URLs, including https://. A relative path such as /de/preise/ or a protocol-relative //example.com/de/preise/ is not valid. Alternate URLs do not have to be on the same domain, so the pattern also works for sites with a separate domain per country.

Can I declare x-default in an HTTP header?

Yes. Google accepts a Link response header with the same values, and says this is useful for files that have no <head>, such as PDFs. Each version lists all alternates, including itself:

Link: <https://example.com/en/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"

Set the header in your web server or CDN for each file in the set. Google says the three methods are equivalent from its perspective, so a header is no stronger or weaker than HTML tags.

How do I add x-default to an XML sitemap?

For large sites, putting hreflang in the sitemap keeps it out of every page template. Each <url> entry lists all versions with xhtml:link elements, including itself, and the urlset must declare the xhtml namespace. The x-default page gets its own entry with the same set:

<?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/en/pricing/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/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/en/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/pricing/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/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>

Pick one method and keep it consistent. Google says combining methods brings no benefit in Search, and two sources that disagree are harder to maintain than one.

What does "missing x-default" mean, and which hreflang mistakes matter more?

A "missing x-default" warning means the page lists language alternates but none of them uses x-default. The set still works for the languages you list, because Google recommends x-default rather than requiring it. The mistakes below are more serious, because they can make Google ignore the annotations or misread them:

Do other search engines and AI answer engines use hreflang?

The rules in this guide are Google's. Google's page does not speak for other search engines, so check each engine's own webmaster documentation if you rely on it.

For AI answer engines, there is no documentation to go on. The crawler documentation published by OpenAI, Anthropic and Perplexity that we reviewed does not mention hreflang, so nothing says whether ChatGPT, Claude or Perplexity use it to pick the language version they cite. Treat any claim that x-default changes AI answers as unproven.

What you can control is access. Each language version is an ordinary URL that AI crawlers fetch like any other, so make sure robots.txt and your firewall let them reach every version you want cited.

How does AISeeWhy check hreflang?

AISeeWhy reports a language set that has hreflang alternates but no x-default, and its fix guide for "hreflang without x-default" shows the line to add. The free check also shows whether AI crawlers can reach the page at all, which matters for every language version.

Fixes for this problem

Free tools

Next steps

Frequently asked questions

Is hreflang x-default required?

No. Google recommends x-default for naming the fallback page, but a set without it still works for the languages and regions it lists. Add it when you get visitors whose language you do not serve.

Which page should x-default point to?

Google designed it for language selector pages. If you do not have one, use the version you want unmatched visitors to see, usually your main language. Whichever URL you choose, give it the same block of annotations as the other pages in the set.

Is hreflang="en-UK" valid?

No. UK is not the ISO 3166-1 code for the United Kingdom, and Google says it has no effect in hreflang. Use en-GB.

Should I use HTML tags and a sitemap at the same time?

There is no need. Google treats the HTML, HTTP header and sitemap methods as equivalent and says combining them brings no benefit in Search. Choose the one that is easiest to keep correct.

Does hreflang tell Google what language my page is in?

No. Google says it does not use hreflang or the HTML lang attribute to detect language. hreflang links versions of the same content to the audiences they serve.

Sources

More articles