Hreflang Tag Generator

Generate hreflang link tags for multilingual / multi-region sites. Tell Google which language/region each URL targets.

Generated Hreflang Tags

What is Hreflang?

Hreflang is an HTML attribute (<link rel="alternate" hreflang="en-US" href="...">) that tells search engines which language and country each URL targets. For multilingual sites (English, Hindi, Spanish versions) or multi-regional sites (US English, UK English, Australian English), hreflang signals which version Google should show to which user. Without hreflang, Google may show wrong-language version in search results, hurting user experience and conversion. Essential for: international e-commerce, global brand sites, content available in multiple languages, region-specific pricing pages, country-specific product variants.

How to use this tool

  1. List all language/region URLs — Format: lang-region|URL (one per line).
  2. Use ISO codes — Language: en, hi, es, fr. Region: US, GB, IN, MX. Combined: en-US, en-IN.
  3. Include x-default fallback — x-default = users not matching any specific locale.
  4. Copy generated tags — Paste ALL tags inside <head> of EVERY language version.
  5. Ensure bi-directional links — If A links to B, B must link back to A. Self-reference too.

Hreflang rules and structure

Format options:

  • Language only: hreflang="en" (any English speaker worldwide)
  • Language + region: hreflang="en-US" (English in United States)
  • Fallback: hreflang="x-default" (catch-all for unmatched users)

ISO codes used:

  • Language: ISO 639-1 (2 letters) — en, hi, es, fr, de, ja, zh, ar
  • Region: ISO 3166-1 Alpha-2 (2 letters) — US, GB, IN, JP, BR, MX, AU, CA
  • Region is OPTIONAL; if used, format is lang-REGION (case-sensitive)

Critical implementation rules:

  1. Tags must be on EVERY page they apply to, not just homepage
  2. Each page must include self-referencing hreflang
  3. Bi-directional: if /en/ links to /hi/, then /hi/ must link to /en/
  4. Use absolute URLs (https://…)
  5. Always include x-default fallback
  6. Implement either in HTML head, HTTP headers, or XML sitemap (all three work; HTML is most common)

Examples

  • Hindi blog: hreflang="hi" — targets Hindi speakers worldwide
  • US English store: hreflang="en-US" + hreflang="en-GB" for UK version
  • Indian e-commerce: hreflang="en-IN" (Indian English) + hreflang="hi-IN" (Hindi India)
  • Default fallback: hreflang="x-default" for users from countries not specifically targeted
  • European site: Separate en-DE, en-FR, en-NL for English content priced in EUR, GBP, etc.

Tips & best practices

  • Include x-default ALWAYS — catches users from countries you didn't explicitly target
  • Self-reference: every page MUST include hreflang to itself
  • Bi-directional: /en/page links to /hi/page, /hi/page must link back to /en/page
  • Test with Google Search Console — International Targeting report shows hreflang errors
  • Don't mix hreflang in HTML head AND XML sitemap — pick one, stay consistent
  • Use language-only (en) when content is language-specific, language-region (en-US) when region-specific too
  • WordPress: WPML or Polylang plugins handle hreflang automatically
  • Common mistake: incorrect ISO codes (UK is GB, not UK in ISO)

Limitations & notes

Hreflang is HINTS to search engines — Google may still show wrong-language results based on user signals. Other search engines (Bing, Yandex) may not fully support hreflang. Maintaining hreflang for sites with 10+ languages is tedious — use plugins/CMS features. Wrong implementation (missing self-reference, broken bi-directional links) commonly causes hreflang errors that take weeks to fix.

Frequently Asked Questions

Do I need hreflang for an English-only site?

No — hreflang is only for multilingual or multi-regional sites. If you serve same English content to everyone, hreflang adds complexity without benefit.

Should I use en or en-US?

Use en (language only) if your content is generic English for all English speakers. Use en-US if content is specifically for US audience (US pricing, US-specific examples, US legal info). Same English content but different regional versions = en-US, en-GB.

What is x-default for?

Fallback for users from countries you don't explicitly target. Example: you have en-US, en-GB, en-IN versions. User from Australia (en-AU not specified) sees x-default page. Usually point x-default to your primary version.

Can I add hreflang to my XML sitemap?

Yes — alternative to HTML head implementation. Use Sitemap protocol's <xhtml:link> elements. Useful for sites with many languages where HTML head clutter is unwanted.

How does Google verify hreflang?

Google crawls the page, finds hreflang tags, verifies bi-directional links exist (referenced pages link back). Google Search Console reports hreflang errors in International Targeting report.

Common hreflang errors?

(1) Missing self-reference. (2) Broken bi-directional links. (3) Wrong ISO codes (UK instead of GB). (4) Not including x-default. (5) Using language without region (en) when region is the actual difference.

Does hreflang help with rankings?

Not directly. Hreflang doesn't boost rankings; it ensures the RIGHT language version is shown to the RIGHT user. Indirectly improves CTR and engagement, which Google factors into rankings over time.

Related tools

Canonical Tag Generator · Meta Tag Generator · Schema.org Generator

Copied