SEO Utilities

Free Hreflang Tag Generator

Generate correct hreflang tags for your multilingual or multi-region site. Add each language-region and URL, including x-default, then copy the tags.

Add language codes and URLs to generate hreflang tags.

What hreflang tags do

If your site serves multiple languages or regions, hreflang tags tell Google which version to show to which user. Done right, a French speaker sees your French page and a US visitor sees your US page - rather than Google guessing and sometimes getting it wrong.

Two rules trip people up most. First, hreflang must be reciprocal: if page A references page B, page B must reference page A. Second, the x-default value sets the fallback for users whose language or region you have not explicitly targeted - often a language selector or your primary version.

Hreflang code examples

Hreflang values combine a language code, and optionally a region code, in ISO format - for example en, en-GB, es, or es-MX. A typical set of tags on an English page that also serves UK English and Spanish looks like this:

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

You can place these tags in the <head> of each page (what this tool generates), or implement the same relationships in your XML sitemap - both are valid; pick one method and apply it consistently.

Hreflang and canonical tags together

This is where most hreflang setups break. Each language version should have a self-referencing canonical tag - the Spanish page's canonical points to the Spanish page, not to the English one. Pointing a canonical across languages tells Google to ignore the other versions, which cancels out your hreflang entirely.

So the rule is: canonical to yourself, hreflang to your alternates. Build matching self-canonicals with our canonical tag generator.

How to use this tool

Add a row for each language-region you target, using ISO codes like en, en-GB, or es-MX, paired with the full URL of that version. Add an x-default if you have a fallback. Copy the generated link tags into the head of every alternate page (remembering the reciprocal rule).

Reach more markets with content

Correct hreflang ensures the right page is shown; great content ensures it is worth showing. Soro helps you produce optimised content at scale so each market has something to rank. Learn more.

Frequently asked questions

What are hreflang tags?

Hreflang tags tell Google which language and regional version of a page to show to which users, preventing the wrong-language page from appearing in results.

What is the x-default hreflang value?

x-default specifies the fallback page for users whose language or region you have not explicitly targeted - often a language selector or your primary version.

Do hreflang tags need to be reciprocal?

Yes. If page A points to page B with hreflang, page B must point back to page A. Missing return tags are the most common hreflang error.

How do hreflang and canonical tags work together?

Each language version must have a self-referencing canonical (the Spanish page canonicalises to itself), while hreflang points to the alternate versions. Canonicalising across languages cancels out your hreflang, so keep canonicals pointing to the same page.

Related free tools

Browse all free tools