Skip to content
ToolsMinify logo
SEO Tools
Popular

Hreflang Tag Generator

Generate correct hreflang annotations for language and region versions of a page.

About Hreflang Tag Generator

Generate correct hreflang annotations for language and region versions of a page. Add each locale URL, optionally include x-default, then copy HTML head tags or sitemap xhtml:link XML. This site already ships five locales (English unprefixed, Spanish, Portuguese, French, German under /es /pt /fr /de) - the preset expands that exact pattern so the cluster matches real production URLs. Validation catches broken codes such as en-UK (use en-GB), relative URLs, duplicates, and incomplete rows. The output is bidirectional and self-referencing by construction: every page in the cluster lists itself and every alternate. Pick one placement method - HTML head, HTTP Link header, or XML sitemap - and do not mix them on the same pages.

How to Use Hreflang Tag Generator

  1. Paste an English page URL and click Fill en / es / pt / fr / de, or type your own locale + URL rows.
  2. Toggle x-default and optionally set a dedicated fallback URL (language selector or primary locale).
  3. Fix any inline errors - invalid codes, relative URLs, or duplicates block the output.
  4. Choose HTML head, Sitemap XML, or HTTP header. Copy the result.
  5. Deploy with exactly one method for the whole cluster. Paste the same HTML set into every localized page, or publish the sitemap entries for every URL.

Hreflang Tag Generator Examples

ToolsMinify five-locale tool page

English https://www.toolsminify.com/seo-tools/hreflang-tag-generator plus /es /pt /fr /de prefixed siblings, x-default pointing at the English URL - the same pattern this site uses in production.

Language + region (en-US and en-GB)

Use en-US and en-GB, never en-UK. UK is not an ISO 3166-1 country code; Great Britain is GB. The generator flags en-UK and offers a one-click fix.

Sitemap for a large cluster

Switch to Sitemap XML when you have many localized URLs. Each <url> entry repeats the full xhtml:link set including itself - that is what Google requires.

HTTP header for a PDF

Non-HTML files cannot use head tags. Copy the HTTP Link header tab and send it on the PDF response.

Frequently Asked Questions about Hreflang Tag Generator

How do I generate hreflang tags for free?
Add each language version URL (or use the ToolsMinify en/es/pt/fr/de preset), enable x-default if you want a fallback, then copy HTML head tags or sitemap XML. This hreflang tag generator runs entirely in your browser.
Should I use HTML head, HTTP headers, or a sitemap?
All three are valid. HTML head tags are simplest for a few pages. XML sitemaps scale better for large sites. HTTP Link headers are required for PDFs and other non-HTML files. Pick one method per cluster and do not mix them - conflicting signals make Google ignore parts of the set.
Do hreflang tags need to be reciprocal and self-referencing?
Yes. Every page must list itself and every alternate, and if page A lists page B then B must list A. This generator emits the complete cluster so both rules hold by construction. Use the lint box to catch broken pasted markup.
What is x-default?
x-default names the URL for visitors whose language matches none of your locales - typically a language selector or your primary English page. It is recommended whenever you have multiple language versions.
Why is en-UK wrong?
Hreflang regions must use ISO 3166-1 Alpha-2 codes. The United Kingdom is GB, not UK. Use en-GB for British English. The tool flags en-UK and suggests en-GB.
Can I mix subdirectory and subdomain locale patterns?
Yes across different sites, but keep one consistent pattern inside a single cluster. This site uses subdirectories with English unprefixed (/page, /es/page). The preset builds that shape from any English URL.
Does my data leave the browser?
No. Locale codes and URLs are processed locally. Nothing is uploaded or stored on a server.