Hreflang tells search engines which URL is the language (or region) version of a page. Get it right and each locale can rank for the right audience. Get it wrong and you ship silent failures: missing return tags, wrong codes like en-UK, or mixed HTML and sitemap signals that cancel each other out. This guide is written from ToolsMinify's own setup - English unprefixed, /es /pt /fr /de, and x-default pointing at English - not from a generic checklist.
Quick answer
Every URL in a cluster must list every alternate, including itself. Every alternate must list the others back. Pick one delivery method (HTML link tags, HTTP headers, or sitemap xhtml:link) and stick to it. Use valid BCP 47 codes (en-GB, never en-UK). Treat hreflang as a strong hint, not a guarantee. Build and lint clusters with the Hreflang Tag Generator.
How ToolsMinify ships five locales
The live site uses one slug per page under every language. English has no /en prefix. Other languages keep the same path after a locale prefix.
- English (default): https://www.toolsminify.com/seo-tools/hreflang-tag-generator
- Spanish: https://www.toolsminify.com/es/seo-tools/hreflang-tag-generator
- Portuguese: https://www.toolsminify.com/pt/seo-tools/hreflang-tag-generator
- French: https://www.toolsminify.com/fr/seo-tools/hreflang-tag-generator
- German: https://www.toolsminify.com/de/seo-tools/hreflang-tag-generator
- x-default: the English URL - the fallback for unmatched language preferences
Slugs stay the same across locales so the cluster is easy to generate and hard to mistype. When you invent a new path, keep it lowercase and hyphenated with the Slug Generator, then mirror that slug under every locale prefix.
Self-reference: every page lists itself
Google expects each URL in the set to include a link to itself with its own hreflang code. The Spanish page is not only announced from English - the Spanish HTML (or sitemap entry) must also say hreflang="es" pointing at the Spanish URL.
- On the EN page: include hreflang="en" with the EN URL, plus es, pt, fr, de, and x-default.
- On the ES page: the same full set, including hreflang="es" with the ES URL.
- Missing self-reference is one of the most common silent breaks. The cluster looks complete from one page and incomplete from another.
The Hreflang Tag Generator emits the full alternate set for every URL in HTML and sitemap forms so self-reference is not optional busywork.
Reciprocal return tags
If page A points at page B as an alternate, page B must point back at page A. One-way links are treated as errors. A partial rollout - English and Spanish live, French tags still pointing at 404s - will not "half work." Fix the whole cluster before you publish the tags.
- Ship all locale URLs that you declare, or remove the codes you are not ready to support.
- Keep hosts consistent (www vs apex). Mixing https://toolsminify.com and https://www.toolsminify.com splits the cluster.
- Canonical tags should agree with the URL you list in hreflang. Pointing canonical at a different host or trailing-slash variant undermines the signal.
Reciprocal means the full set
It is not enough that EN links to ES and ES links to EN. Every page must list every other language in the cluster. Think of one shared matrix, not pairwise friendships.
Do not mix HTML and sitemap methods
You can deliver hreflang three ways: HTML <link rel="alternate" hreflang="..."> in the head, HTTP Link headers, or xhtml:link entries in an XML sitemap. Pick one primary method for a cluster. Mixing incomplete HTML tags with a different sitemap set is a classic way to create contradictions Google cannot resolve cleanly.
- HTML link tags - good when your layout already injects locale alternates (as Next.js metadata languages maps do).
- Sitemap xhtml:link - good for large URL sets generated from one source of truth.
- HTTP Link headers - useful for non-HTML responses; rare on marketing sites.
- If you change method, remove the old annotations so crawlers see one story.
Sitemaps and crawl rules still matter elsewhere. Keep indexable locale URLs allowed in robots.txt - see Robots.txt Best Practices for SEO and the Robots.txt Generator. Do not Disallow /es/ or /de/ if those pages are meant to rank.
en-GB not en-UK (and other code traps)
Hreflang codes follow ISO 639-1 language codes, optionally plus ISO 3166-1 region codes. The United Kingdom region code is GB, not UK. en-UK is invalid. The generator on this site flags en-UK and suggests en-GB.
- Language only: en, es, pt, fr, de - fine when you do not need region targeting.
- Language + region: en-GB, en-US, pt-BR, es-MX - use when content truly differs by country.
- x-default - special value for the fallback URL when no other code matches. On ToolsMinify it is the English (unprefixed) URL.
- Do not invent codes. zh-CN and zh-TW are valid patterns; made-up regions are not.
ToolsMinify uses plain language codes (en, es, pt, fr, de) because the same article ships to every region that speaks that language. Add a region suffix only when you maintain separate country pages.
Hreflang is a hint, not a directive
Hreflang does not force Google to show the Spanish URL in Spain or the German URL in Germany. It is a strong signal about language targeting. Google may still choose another URL if it thinks that result is better for the user - for example when the Spanish page is thin, blocked, or slower.
- Translate (or properly localize) the content. Empty shells with hreflang still fail users and quality systems.
- Keep titles, meta descriptions, and visible copy in the target language.
- Do not use hreflang to paper over duplicate English pages under /es URLs.
- Monitor International Targeting / hreflang reports in Search Console after you ship a cluster.
Hint vs guarantee
Correct tags remove confusion. They do not replace crawlability, quality, or relevance. Fix robots, canonicals, and content first - then annotate the cluster.
A worked ToolsMinify cluster
For the hreflang tool page itself, the HTML head should include (absolute https URLs, one line per alternate):
- <link rel="alternate" hreflang="en" href="https://www.toolsminify.com/seo-tools/hreflang-tag-generator" />
- <link rel="alternate" hreflang="es" href="https://www.toolsminify.com/es/seo-tools/hreflang-tag-generator" />
- <link rel="alternate" hreflang="pt" href="https://www.toolsminify.com/pt/seo-tools/hreflang-tag-generator" />
- <link rel="alternate" hreflang="fr" href="https://www.toolsminify.com/fr/seo-tools/hreflang-tag-generator" />
- <link rel="alternate" hreflang="de" href="https://www.toolsminify.com/de/seo-tools/hreflang-tag-generator" />
- <link rel="alternate" hreflang="x-default" href="https://www.toolsminify.com/seo-tools/hreflang-tag-generator" />
That same full set must appear on every locale URL of the page - not only on English. Paste a cluster into the generator's linter to catch missing self-refs and one-way links before deploy.
Common mistakes that break clusters
- Relative hrefs (/es/page) instead of absolute https URLs.
- en-UK, pt-PT typos, or language codes that do not match the page language.
- Declaring a locale that 404s or redirects to a different language.
- Mixing www and non-www, or http and https, inside one cluster.
- Blocking locale prefixes in robots.txt while listing them in hreflang.
- Shipping HTML tags and a conflicting sitemap set for the same URLs.
Frequently asked questions
Do I need hreflang if I only have English?
No. Hreflang is for alternate language or region URLs. A single-language site should focus on canonicals, sitemap, and clear language in the HTML lang attribute.
Should x-default be a separate "global" page?
Only if you maintain a true language picker or global landing page. Many sites, including ToolsMinify, point x-default at the default language URL (English). That is valid and simpler to keep reciprocal.
Is en-UK ever acceptable?
No. Use en-GB for British English. UK is not an ISO 3166-1 country code for this purpose.
Can I put hreflang only in the sitemap?
Yes - sitemap delivery alone is valid if every URL entry lists the full alternate set. Do not also ship a conflicting incomplete HTML set. Prefer one method and keep it complete.
Does hreflang replace geotargeting in Search Console?
No. Hreflang annotates language and optional region at the URL level. Country targeting for a whole property is a separate (and often unnecessary) setting once you use proper hreflang.
Build and lint hreflang on ToolsMinify
Every tool below runs in your browser - free, no signup, nothing uploaded:
- Hreflang Tag Generator - build HTML, sitemap, and HTTP Link output and lint self-refs and return tags.
- Robots.txt Generator - keep locale paths crawlable while you block only what must stay private.
- Slug Generator - create lowercase hyphenated slugs you can reuse under every locale prefix.
- All SEO tools - the full category index.
Try it free
Enter your EN / ES / PT / FR / DE URLs in the Hreflang Tag Generator, enable x-default on English, and copy the HTML or sitemap block. Everything stays on your device.