Hreflang for Spanish Sites: Language and Region Codes
How to implement hreflang for Spanish-language websites. Covers es vs es-MX vs es-ES, targeting Latin America vs Spain, implementation examples, x-default strategy, and common mistakes like es-LA.
Spanish is spoken in over 20 countries. That's more regional variation than almost any other language you'll deal with in hreflang, and it creates a real question: do you tag everything as es and call it a day, or do you break it down by region? The answer depends on how different your content actually is across markets.
This guide covers the codes, the strategy, and the mistakes. For the full hreflang specification, start with our comprehensive hreflang guide.
Spanish language codes for hreflang
Hreflang follows ISO 639-1 for language codes and ISO 3166-1 alpha-2 for region codes. For Spanish, the language code is always es. The region code is optional and specifies which country's audience the content targets.
es -- Generic Spanish
Use es alone when your content isn't tailored to any specific Spanish-speaking country. This is generic Spanish, and Google will consider it relevant to all Spanish-speaking users.
<link rel="alternate" hreflang="es" href="https://example.com/es/page" />
Common regional variants
Here are the most frequently used Spanish region codes:
es-ES-- Spaines-MX-- Mexicoes-AR-- Argentinaes-CO-- Colombiaes-CL-- Chilees-PE-- Perues-VE-- Venezuelaes-EC-- Ecuadores-GT-- Guatemalaes-CU-- Cubaes-BO-- Boliviaes-DO-- Dominican Republices-HN-- Hondurases-PY-- Paraguayes-SV-- El Salvadores-NI-- Nicaraguaes-CR-- Costa Ricaes-PA-- Panamaes-UY-- Uruguayes-PR-- Puerto Ricoes-US-- United States (Spanish-speaking audience)
Each code combines the es language code with the ISO 3166-1 alpha-2 country code. For the full list of valid language and region codes, see the hreflang language codes reference.
When to use es alone vs es with a region code
This is the central question for any Spanish-language hreflang implementation.
Use es when you have a single Spanish version. If your site has one set of Spanish pages that serve all Spanish-speaking visitors equally, there's no reason to add a region code. Tag it as es and move on.
Use region codes when your content genuinely differs by country. If your Mexico pages show prices in MXN, reference Mexican regulations, and use Mexican vocabulary (like "computadora" instead of "ordenador"), that content is different from your Spain pages. Tag the Mexican content as es-MX and the Spanish content as es-ES.
Use es as a fallback alongside regional variants. If you have es-MX and es-ES versions but want to serve something to Spanish speakers in countries you haven't specifically targeted (like Colombia or Peru), add a generic es version as the catch-all. Google will serve es-MX to users in Mexico, es-ES to users in Spain, and es to everyone else who speaks Spanish.
The practical reality: most sites don't need 20 regional variants. The typical pattern is either es alone, or es-ES plus es-MX (or another Latin American variant) plus es as a fallback. Two or three versions cover the vast majority of use cases.
Targeting Latin America vs Spain
The biggest content split in the Spanish-speaking world is between Spain and Latin America. Here's how to handle the common scenarios.
Scenario 1: One Spanish version for everyone
Tag it es. Done. No region code needed.
<link rel="alternate" hreflang="en" href="https://example.com/en/page" />
<link rel="alternate" hreflang="es" href="https://example.com/es/page" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/page" />
Scenario 2: Spain vs Latin America
You have two Spanish versions. One uses European Spanish conventions (Spain). The other uses Latin American Spanish. The problem: there is no es-LA or es-419 code in hreflang. More on that mistake below. Instead, you pick one Latin American country as the tagged variant and use es as the fallback.
<link rel="alternate" hreflang="en" href="https://example.com/en/page" />
<link rel="alternate" hreflang="es-ES" href="https://example.com/es-es/page" />
<link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/page" />
<link rel="alternate" hreflang="es" href="https://example.com/es-mx/page" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/page" />
In this example, es points to the same URL as es-MX. This means Spanish speakers outside of Spain and Mexico will land on the Mexico version, which is a reasonable default for Latin American Spanish. Alternatively, you could point es to a separate generic page if you have one.
Scenario 3: Multiple Latin American countries
You have truly localized content for Mexico, Argentina, and Colombia, plus a version for Spain.
<link rel="alternate" hreflang="es-ES" href="https://example.com/es-es/page" />
<link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/page" />
<link rel="alternate" hreflang="es-AR" href="https://example.com/es-ar/page" />
<link rel="alternate" hreflang="es-CO" href="https://example.com/es-co/page" />
<link rel="alternate" hreflang="es" href="https://example.com/es/page" />
<link rel="alternate" hreflang="en" href="https://example.com/en/page" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/page" />
The es fallback catches all other Spanish-speaking countries not explicitly listed.
Implementation in HTML
Place hreflang tags in the <head> section of every page in the cluster. Every page must include the complete set of tags, including a self-referencing tag. Here's a full example for a bilingual site (English + Spanish for Spain and Mexico):
<!-- On the English page -->
<head>
<link rel="alternate" hreflang="en" href="https://example.com/en/pricing" />
<link rel="alternate" hreflang="es-ES" href="https://example.com/es-es/pricing" />
<link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/pricing" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/pricing" />
</head>
The exact same four tags go on the es-ES page and the es-MX page. No exceptions. If any page in the cluster is missing a tag or has a different set, Google may ignore the entire cluster for that page.
For the XML sitemap approach, which works well for large sites, see the hreflang sitemaps guide. For more HTML patterns, check the hreflang HTML examples.
x-default strategy for Spanish sites
The x-default tag tells search engines which page to show when no other hreflang value matches the user. Your strategy depends on your site structure.
Multilingual site with Spanish as one option. Point x-default to your English page (or whichever language is your primary/international version). Spanish-speaking users will be routed by the specific es, es-ES, or es-MX tags. Everyone else gets x-default.
Spanish-only site with regional variants. Point x-default to your generic es page, or to the version that serves your largest audience. If 60% of your traffic comes from Mexico, x-default could point to es-MX.
Spanish-only site, single version. x-default and es can point to the same URL. It's redundant but harmless, and it makes your intent clear.
The important thing is to include x-default. Omitting it means Google picks the fallback on its own, which doesn't always go the way you expect.
Common mistakes with Spanish hreflang
Using es-LA (it doesn't exist)
This is the most common Spanish hreflang mistake. LA is not a valid ISO 3166-1 country code. There is no "Latin America" region code in the ISO standard, and Google does not recognize es-LA.
If you want to target Latin American Spanish speakers collectively, use es as a generic fallback alongside your specific regional tags. There is no shortcut.
Using es-419
The UN M.49 code 419 represents Latin America and the Caribbean. Some systems (like Android) recognize es-419 as a locale. Hreflang does not. Google's hreflang implementation only supports ISO 3166-1 alpha-2 country codes (two letters), not numeric region codes. es-419 will be ignored.
Forgetting return links
If your es-MX page points to your es-ES page, the es-ES page must point back. This bidirectional requirement is mandatory for all hreflang relationships. Missing it means Google silently ignores the tag. Our common mistakes guide covers this in detail.
Tagging translated-only content as localized
Translation and localization are different things. If you took your Spain content, translated it from European Spanish to a more neutral Latin American Spanish, but kept all the Spain-specific pricing, addresses, and regulatory references, tagging it as es-MX is misleading. The content isn't truly localized for Mexico. Either localize it properly or use es to indicate it's generic Spanish.
Inconsistent URL structures
Some sites use /es/ for Spain and /es-mx/ for Mexico, while others use /es-es/ and /es-mx/. Either approach is fine, but be consistent. Google doesn't care about your URL structure for hreflang purposes -- the tags are what matter -- but inconsistent URLs confuse your team and make maintenance harder.
How many Spanish variants do you really need?
Unless you're a large e-commerce site with country-specific pricing, legal requirements, or warehousing, you probably don't need more than two or three Spanish variants. A generic es page covers the majority of cases. Add es-ES for Spain and es-MX for your primary Latin American market, and you've handled 90% of Spanish-speaking search traffic.
Testing your implementation
After deploying your Spanish hreflang tags, validate them:
- View the source of each page and confirm the full set of hreflang tags is present.
- Check that every relationship is bidirectional. If page A references page B, page B must reference page A.
- Verify all URLs return a 200 status. Tags pointing to redirects or 404s are ignored.
- Confirm your canonical tags don't conflict with your hreflang self-references.
- Use a crawling tool to check the implementation at scale.
Manual spot-checking works for small sites. For anything with more than a few dozen pages, automate the validation. One template error propagates across every page on the site.
For a full validation checklist, see how to implement hreflang.
Generate Spanish hreflang tags instantly
Create correct es, es-ES, and es-MX hreflang markup with automatic validation. Catches missing return links and invalid codes.
Related Articles
References
Generate perfect hreflang tags
Create and validate hreflang markup for your multilingual site. Free.
Try Hreflang Generator