hreflang x-default: What It Is, When It's Missing, and How to Fix It
By Seth Black · Published
hreflang="x-default" names the page Google should show a searcher whose language or region matches none of your other hreflang versions. It’s optional, it goes in the same set as your other hreflang annotations, and it usually points at a language selector or at your main international page. A “missing x-default” warning means a page has a set of language alternates and no fallback in that set.
This post covers x-default only. For hreflang in general, including return links and the mistakes that make Google ignore the whole set, read hreflang: why it breaks, how to audit it, and how to fix it.
What does hreflang x-default do?
Google’s documentation on localized versions says the reserved x-default value “is used when no other language/region matches the user’s browser setting”, and that it “was designed for language selector pages”. It needs no language code.
Here is a complete set for a site with English, Spanish and German versions:
<link rel="alternate" hreflang="en" href="https://example.com/en/pricing" />
<link rel="alternate" hreflang="es" href="https://example.com/es/precios" />
<link rel="alternate" hreflang="de" href="https://example.com/de/preise" />
<link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />
A searcher with French as their browser language matches none of en, es or de, so Google can show the x-default URL. Without x-default, Google picks one of the versions itself.
When do you need x-default?
| Your setup | x-default |
|---|---|
| One language, no hreflang at all | Not needed. There’s nothing to fall back from. |
| Two or more language versions | Recommended. Point it at a selector page or your main version. |
| A language selector or geo-redirecting home page | Strongly recommended. This is the case it was designed for. |
| One version per country with no global page | Pick the version most visitors from elsewhere should see, usually English. |
It’s fine for x-default to point at the same URL as one of the languages. Plenty of sites mark the English page as both en and x-default, and that’s a valid set.
How do you fix a missing x-default?
Add one line to the set, and add it to every page in the set. Each language version must list itself and all the others, and x-default is part of that list. If the English page carries x-default and the Spanish page doesn’t, the sets don’t match.
There are three equivalent ways to declare it. Google says the three methods “are equivalent from Google’s perspective”, so use whichever your stack can keep consistent.
In the HTML head
Shown above. This is the most common and the easiest to check.
In an HTTP Link header
Useful for PDFs and other files without a <head>:
Link: <https://example.com/en/guide.pdf>; rel="alternate"; hreflang="en",
<https://example.com/es/guia.pdf>; rel="alternate"; hreflang="es",
<https://example.com/en/guide.pdf>; rel="alternate"; hreflang="x-default"
In nginx:
location = /en/guide.pdf {
add_header Link '<https://example.com/en/guide.pdf>; rel="alternate"; hreflang="en", <https://example.com/es/guia.pdf>; rel="alternate"; hreflang="es", <https://example.com/en/guide.pdf>; rel="alternate"; hreflang="x-default"';
}
In the XML sitemap
<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="es" href="https://example.com/es/precios"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/pricing"/>
</url>
Repeat the full set under each <url> entry in the cluster, and declare xmlns:xhtml="http://www.w3.org/1999/xhtml" on the <urlset>.
Pick one method. Mixing them is allowed, but when the HTML says one thing and the sitemap another, you’ve built a debugging problem for yourself.
What does the “missing x-default” warning mean in bseoa?
bseoa reports missing x-default hreflang when a page declares hreflang alternates for two or more languages and none of them is x-default. It treats it as a recommendation, not an error, because Google treats it the same way: the set still works without it, Google just picks the fallback for you.
A page with a single hreflang alternate, or none, isn’t reported. There’s no cluster to fall back from.
To check one page right now, our free hreflang checker reads a page’s hreflang from both the HTML and the HTTP Link header, validates every language code, then fetches the alternates to confirm each one returns 200, links back, and carries the same set. Missing x-default shows there as a warning with a link to the fix.
Common x-default mistakes
Spelling it wrong. default, x_default and xdefault aren’t valid. The value is exactly x-default.
Putting it on some pages in the set. Every page in the cluster needs the same annotations, x-default included. A template change that adds it to English pages only leaves the Spanish pages with a different set.
Pointing it at a redirect. If https://example.com/ redirects visitors by IP or browser language, x-default should point at that URL only if Googlebot gets a real page there. Google documents that Googlebot crawls from IP addresses that appear to be in the USA and sends no Accept-Language header, so a geo-redirect can send it to the English page every time. A selector page that doesn’t redirect is safer.
Pointing it at a non-canonical URL. If the x-default target canonicalizes elsewhere, or is noindexed, the annotation points at a page Google won’t show. Every hreflang URL, x-default included, should be the canonical, indexable, 200 version. That’s the same rule I go through in how to find and fix every broken canonical tag.
Using it as a language code. hreflang="x-default-en" and hreflang="en-x-default" aren’t valid. x-default stands alone.
Quick answers
Is x-default required? No. It’s recommended whenever you have two or more language versions.
Can x-default point at a page that’s also one of the languages? Yes. That’s common and valid.
Does x-default affect ranking? It affects which version Google shows to users who match none of your languages. It doesn’t make any version rank higher.
Does it need to be in the sitemap if it’s in the HTML? No. One method is enough.
-Sethers