Hreflang is an HTML attribute that tells search engines which language and regional version of a page to show users, when you have multiple versions of the same content targeting different countries or languages.
Why it’s needed: Without hreflang, search engines might show a French user your English-language page even though a French version exists, or worse, treat your different language versions as duplicate content competing against each other.
Basic implementation: Hreflang tags go in the <head> of each page, and every language/region version needs to reference itself and every other version — including a “return tag” pointing back. For example, an English US page needs a link to its Spanish version, and that Spanish version needs a corresponding link back to the English page, plus a self-referencing tag.
<link rel="alternate" hreflang="en-us" href="https://example.com/us/" />
<link rel="alternate" hreflang="es-mx" href="https://example.com/mx/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
The x-default tag specifies a fallback version for users whose language/region doesn’t match any of your specified options.
Common mistakes: Missing return tags (Page A links to Page B, but B doesn’t link back), using incorrect language/country codes, and forgetting to update hreflang tags when a page URL changes.
How to validate: Google Search Console’s International Targeting report flags hreflang errors, and third-party tools like Merkle’s hreflang tag generator help catch syntax mistakes before publishing.
