Hreflang tags tell search engines which language/region version of your content to serve in which country. They're easy to understand, easy to implement, and stunningly easy to get wrong.
Suppose you have three versions of a page:
example.com/us/product. US Englishexample.com/uk/product. UK Englishexample.com/fr/product. French for FranceHreflang tells Google: show the US version to users in the US, UK version to UK users, French version to French users. Without hreflang, Google guesses (often wrongly).
Each page references every version (including itself). Three implementations, pick one:
<link rel="alternate" hreflang="en-us" href="https://example.com/us/product" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/product" />
<link rel="alternate" hreflang="fr-fr" href="https://example.com/fr/product" />
<link rel="alternate" hreflang="x-default" href="https://example.com/us/product" />
Link: <https://example.com/us/product>; rel="alternate"; hreflang="en-us"
<url>
<loc>https://example.com/us/product</loc>
<xhtml:link rel="alternate" hreflang="en-us" href="https://example.com/us/product"/>
<xhtml:link rel="alternate" hreflang="en-gb" href="https://example.com/uk/product"/>
...
</url>
en, fr, es, de (ISO 639-1)en-us, en-gb, en-au, fr-ca (ISO 3166-1 alpha-2 for region)x-default (the fallback for unmatched users)The x-default tag specifies a fallback version for users whose language/region doesn't match any specific hreflang. Usually your US English or international-English version.
hreflang="en" means "any English", you can't say "English except UK."For a site with 10 languages × 20 countries = 200 page variations, every page needs 200 hreflang references. This gets unmaintainable fast in head tags. For large sites, XML sitemap hreflang is the sanity-preserving choice.