Hreflang tags solve a specific problem: when the same content exists in multiple languages or regional variants, which one should a search engine actually show a given visitor? Get the tags right and search engines route people to the correct version automatically. Get them wrong, which happens constantly through one specific mistake, and search engines either ignore the tags entirely or show visitors the wrong language page.

Key takeaways
  • Hreflang tags tell search engines which language/region version of a page to serve a given visitor
  • Every page in a set must link to every other page, including itself, or the whole set can be flagged as an error
  • Language code is required (en), region code is optional and more specific (en-US)
  • x-default sets a fallback for visitors who don't match any listed language or region
  • Tags can live in the page <head>, the sitemap, or HTTP headers, all follow the same reciprocity rules

The Basic Tag Format

An hreflang tag is a <link> element in a page’s <head>, pointing to an alternate version of that same content in a different language or region:

<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/page" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/page" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page" />

The hreflang attribute follows a language code, optionally followed by a region code separated by a dash, en for English generally, en-US for US English specifically, en-GB for UK English specifically. The language code alone is valid and useful when a single page should serve all speakers of that language regardless of country.

The Rule That Breaks Most Implementations: Reciprocity

This is where hreflang goes wrong more often than anywhere else. Every page referenced in an hreflang set must link back to every other page in that same set, including a link to itself.

Diagram showing three language pages correctly linking to each other and themselves in a fully reciprocal set, versus a broken set missing one direction of linking
Every page must reference every other page in the set, including itself, or the set is considered broken.

If the English page lists French and Spanish as alternates, the French page must list English and Spanish back, and the Spanish page must list English and French back too, each also referencing itself. Miss even one of these links in one direction, for example the French page forgets to link back to English, and search engines treat the entire set as unreliable rather than partially trusting it. This is the single most common reason hreflang tags show as errors in Search Console despite looking correct on any individual page.

Setting a Fallback with x-default

x-default names a fallback page for visitors whose browser language doesn’t match any of the specific entries listed:

<link rel="alternate" hreflang="x-default" href="https://example.com/" />

This is typically pointed at either a language-selector landing page or a sensible default version of the site, English is common. It’s optional, but leaving it out means search engines have to guess which version to serve visitors who don’t match anything else in the set, which doesn’t always land on the outcome you’d have chosen.

Three Places Hreflang Tags Can Live

Diagram showing the three valid locations for hreflang tags: the HTML head, the XML sitemap, and HTTP response headers
Hreflang tags are valid in the HTML head, the sitemap, or HTTP headers, choose based on scale and content type.

In the page <head> — the most common approach for sites with a modest number of language variants, since it keeps everything visible directly in the page source.

In the XML sitemap — better for sites with many languages or regions, since a large hreflang set in every page’s <head> gets unwieldy fast, while the sitemap centralizes it.

In HTTP response headers — mainly used for non-HTML resources like PDFs, where there’s no <head> element to place a <link> tag in at all.

All three follow the identical reciprocity and format rules, the choice is about scale and content type, not about which one search engines trust more.

Generating a Correct, Reciprocal Set

Manually tracking which pages link to which, across every language and region combination, gets error-prone fast once a site has more than two or three variants, since a single missed reciprocal link anywhere in the set undermines the whole thing. The Hreflang Tag Generator builds the complete, correctly formatted, fully reciprocal tag set for all your language and region pages at once, so nothing gets left out of the loop.

The short version

Hreflang tags tell search engines which language or region version of a page to show a given visitor, using a <link rel="alternate" hreflang="..."> format with a required language code and an optional region code. The rule that trips up most implementations is reciprocity: every page in the set must link to every other page, including itself, or the entire set can be flagged as broken. Add x-default for unmatched visitors, and place the tags in the <head>, sitemap, or HTTP headers depending on how many variants you’re managing.