Every page in the set needs the complete, identical tag block#
This is the rule that breaks hreflang most often in practice: the tags are not something you put only on your default or English page. Every URL in the set — the English page, the Spanish page, the Mexican-Spanish page — needs the exact same block of tags, including a tag that points back at itself.
Google describes this as a required "return link" — if your Spanish page links to your English page via hreflang, but the English page does not link back to the Spanish one, Google may ignore the annotations entirely rather than guess at what you meant.
Why the language code has to be real#
hreflang values are checked against ISO 639-1 for the language part and ISO 3166-1 Alpha 2 for the optional region — not just "two letters." A typo like xx or a made-up code fails silently: Google does not error out or notify you, it simply ignores that particular annotation, and the page it pointed to stops receiving the international targeting you intended.
This tool validates every code against the actual ISO 639-1 list, not just a regex checking for two letters, specifically to catch that failure mode before it reaches production.
Language versus language-region, and when you need both#
A plain es targets every Spanish-reading visitor, everywhere. es-MX targets Spanish-reading visitors specifically in Mexico. You do not need to specify a region unless the content genuinely differs by region — pricing in local currency, region-specific promotions, or dialect differences worth serving separately.
A common, correct pattern is a generic es page for Spanish-speaking visitors generally, plus es-MX and es-AR variants only where the content actually diverges — not a full region for every Spanish-speaking country by default.
What x-default is for#
x-default marks the page to show a visitor whose language does not match any of the versions you have listed — someone browsing in German when you only have English and Spanish versions, for instance. It is optional but recommended by Google's own documentation, and it is usually your default or English-language page.
Without it, a visitor outside every language you have targeted gets Google's best guess instead of your explicit choice, which is worth being deliberate about rather than leaving to chance.