The moment a site publishes the same page in two languages, it creates a quiet problem. A searcher in France types a query, and the English version ranks for it, because nothing told the search engine that a French version exists. The reader lands on a page they half understand; the French page sits unused.

Hreflang tags are the declaration that fixes this: a set of link tags that tells search engines which language and region version of a page to show each user. This guide shows how to build a correct set with Ovatly's free Hreflang Tag Generator: the codes, the fallback, and the one rule whose breach makes the whole set liable to be ignored.

Contents

  • Quick answer
  • What hreflang actually declares
  • The codes: language first, region only when it differs
  • The x-default fallback
  • The reciprocity rule
  • How to generate your tags, step by step
  • Worked example: English and French versions of one page
  • Tags in the head, or in the sitemap?
  • Limitations and alternatives
  • Common mistakes
  • Troubleshooting
  • FAQs
  • Conclusion

Quick answer

For every page that exists in more than one language or region version, build one tag set that lists every version, including the page itself, each with its code (en, fr, en-GB) and its full URL. Add an x-default tag pointing at a fallback page for visitors whose language matches nothing. Paste the identical set into the head of every version, or place the equivalent set in your sitemap. The Hreflang Tag Generator builds both forms from a simple list of your versions.

What hreflang actually declares

A hreflang tag is a claim about audience, not content: this URL is the version of the page for speakers of this language, or readers in this region. Search engines use the set to swap the URL shown, giving the version that fits the person searching instead of whichever version happened to rank.

Two consequences follow. The versions must be real, reachable pages: a tag pointing at a missing URL, or one that canonicalises elsewhere, declares a version the engine cannot use. And hreflang neither translates anything nor creates versions: it only labels versions you have already published.

The codes: language first, region only when it differs

Each entry pairs a code with a full URL. The code starts with the language, validated against the ISO 639-1 list: en for English, fr for French, es for Spanish. A region can follow, format-checked as two letters, or as three digits such as 419 for Latin America, giving codes like en-GB or es-419.

The judgement call is when to include the region. Use a plain language code (en) when the page targets all speakers of that language. Add a region (en-GB, en-US) only when the content genuinely differs by country: spelling differences alone are a weak case; different prices, regulations or delivery terms are a strong one. Every region code you add is another version to maintain and another entry every other version must list.

The x-default fallback

One entry in the set is special. The x-default tag names the fallback page for users whose language or region matches none of your versions. It is often a language selector page, or your main English page, if that is the version you would rather an unmatched visitor saw than a wrong-language one.

X-default is optional, but on a many-language site it answers a real question: when no version fits, where do people get sent? It takes one extra row in the generator, and it can point at a version already in the set, as the worked example shows.

The reciprocity rule

Hreflang is reciprocal: every version must list every other version, including itself, or search engines may ignore the set. If the English page declares the French version but the French page declares nothing, the claim is one-sided, and the set is liable to be dropped.

In practice this means the tag set is identical on every version of the page. You write one set, once, and paste it everywhere. This is the step people most often get wrong, usually by tagging the new translation and forgetting the original, and the first thing to check when tags have no effect.

How to generate your tags, step by step

  1. Add a row for every language or region version of the page, including the original, in the Hreflang Tag Generator.
  2. Use codes like en, en-GB or es-419, and the full URL of each version.
  3. Optionally set an x-default URL for visitors whose language matches nothing.
  4. Copy the link tags into every version's head section, or use the sitemap version in your sitemap file.
  5. Before publishing, re-check reciprocity: every listed URL is a real page, and every one of those pages will carry the same set.

Worked example: English and French versions of one page

Take a page published in English at https://example.com/page and in French at https://example.com/fr/page, with the English page also serving as the fallback. The rows are: en = "https://example.com/page", fr = "https://example.com/fr/page", x-default = "https://example.com/page".

The generator's HTML output includes a tag for each row:

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

That same set goes into the head of both pages, unchanged. The sitemap output expresses the same information differently: each url entry lists all versions as xhtml:link alternates, so each version's entry names the other version and the fallback. Same declaration, two envelopes.

Tags in the head, or in the sitemap?

Both implementations are equivalent to search engines, so choose on maintenance, not expected effect. Head tags are easier for a few pages: the declaration sits with the page, visible in its source. The sitemap version scales better and avoids editing every template, which matters once a site has hundreds of multilingual pages. The generator produces both forms from the same rows, so you can switch later without rebuilding the set.

Limitations and alternatives

Hreflang targets language and region, not currency or content differences within the same language and region. Two English pages that differ only in the currency they display are not a hreflang case. Hreflang also resolves most regional duplication concerns, but it does not merge or hide versions: each still needs to be a real, reachable page with a canonical tag pointing at itself.

If a language version does not exist, there is nothing to declare: hreflang is a signal about existing pages, not a substitute for them. A site with one version should simply publish it well and add tags only when a genuine second version goes live.

Common mistakes

  • Tagging only the new translation. The original page carries no set, reciprocity fails, and the tags may be ignored. Paste the identical set into every version.
  • Forgetting the self-reference. Each page must list itself as well as the others. A set that names only the other versions is incomplete.
  • Adding regions the content does not support. An en-GB entry whose page is identical to the en-US one declares a difference that does not exist, and doubles your maintenance for nothing.
  • Declaring versions that are not real pages. Tags pointing at redirects, missing pages or pages canonicalised elsewhere declare versions the engine cannot show.

Troubleshooting

My tags seem to be ignored. Check reciprocity first: does every version, including the original, carry the complete identical set? Then check that every listed URL loads as a real page whose canonical points at itself.

The wrong language version shows for a country. Check the codes. A plain language code targets every speaker of that language; if readers in one country should get a different version, that version needs its own region code, and every other version needs to list it.

FAQs

What is x-default for? It names the fallback page for users whose language or region matches none of your versions, often a language selector page or your main English page.

Should I use en or en-GB style codes? Use a plain language code (en) when the page targets all speakers of that language. Add a region (en-GB, en-US) only when the content genuinely differs by country.

Tags or sitemap: which implementation is better? Both are equivalent to search engines. Tags are easier for a few pages; the sitemap version scales better and avoids editing every template, which is why this tool generates both.

Does hreflang fix duplicate content between regions? It tells engines which version fits which audience, which resolves most regional duplication concerns. The versions still need to be real, reachable pages with canonical tags pointing at themselves.

Can hreflang separate pages that differ only in currency? No. Hreflang targets language and region, not currency or content differences within the same language and region.

Conclusion

A correct hreflang setup is one honest list: every real version of the page, each with the plainest code that tells the truth, an x-default for everyone left over, and the identical set pasted into every version so the claim is reciprocal. Build the list once in the Hreflang Tag Generator, choose tags or sitemap by how many pages you maintain, and re-check the set whenever a version is added or retired. For the search-result side of metadata, see the companion guide on how long a meta description should be; the other generators and checkers live under SEO Tools.