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.