Hreflang tags are HTML link elements that tell search engines which language and regional variant of a page to show to users in different countries. For international websites serving content in multiple languages, hreflang is essential to prevent duplicate content issues and ensure the correct page version ranks in each target market.
Default / Fallback URL (x-default)
Recommended: use your international or English homepage as the x-default fallback.
Language / Region Entries
How to Use the Hreflang Tag Generator
International SEO requires telling Google exactly which page to show to users in different countries and languages. Without hreflang tags, Google may show your US English page to German speakers — even if you have a dedicated /de/ version. This hreflang generator helps you create the correct HTML link tags and XML sitemap markup in seconds.
Step 1: Enter Your x-default URL
The x-default URL is the fallback page shown to users whose language doesn't match any specific language version you define. Best practice: use your main international page (e.g., your English homepage at https://example.com/) as the x-default. This ensures non-targeted users always reach a page they can navigate.
Step 2: Add Language and Region Entries
Click Add Language to add a new entry row. Each row requires a language (e.g., English, Spanish, French) and a URL. Optionally, add a region to target a specific country (e.g., English for the United States = en-US). Use region targeting when you have country-specific pricing, legal requirements, or content — use language-only when one page serves all speakers of that language globally.
Step 3: Validate and Generate
The tool automatically validates your URLs (they must be absolute, starting with https://) and checks for duplicate language-region combinations. Errors appear inline next to each row. Fix any warnings before copying the output to ensure Google processes your hreflang correctly. A common mistake is having the same language-region pair twice, which Google ignores — the tool catches this for you.
Step 4: Choose HTML or Sitemap XML Format
Use the HTML Tags tab to get <link rel="alternate"> tags to paste into the <head> section of each page. Use the Sitemap XML tab to get the equivalent hreflang declarations formatted for inclusion in your XML sitemap — better for large sites where adding tags to every HTML page is impractical. Both formats are supported by Google.
Hreflang Common Mistakes to Avoid
The most common hreflang error is forgetting the self-referential tag — every page must include its own hreflang entry. For example, your English page must have a tag pointing to itself in addition to all other language versions. Another common error is inconsistent URLs: if your hreflang uses https://example.com/ with a trailing slash, make sure all other references to that page also use the trailing slash.
FAQ
Is this hreflang tag generator free?
Yes, this hreflang tag generator is completely free with no usage limits. Generate hreflang tags for unlimited language/region combinations with no account or payment required. Everything runs in your browser.
What is an hreflang tag and why do I need it?
An hreflang tag tells Google which version of a page to show to users in specific languages or regions. Without hreflang tags, Google may show the wrong language version to users — for example, showing your English page to Spanish speakers when you have a dedicated /es/ version. Hreflang tags eliminate this problem.
What is x-default in hreflang?
The x-default hreflang value specifies the fallback URL shown to users whose language doesn't match any of your specific language versions. For example, if you have en-US and de-DE versions but a user visits from Japan, Google will show them the x-default URL. Use your primary/international page as x-default.
What is the difference between language-only and language+region hreflang?
Language-only hreflang (e.g., hreflang='en') targets all English speakers regardless of region. Language+region (e.g., hreflang='en-US') targets only English speakers in the US. Use language+region when you have region-specific pricing, currency, or legal requirements. Use language-only when you have one version for all speakers of that language.
Do I need to add hreflang on every page?
Yes. Hreflang tags must be present on every page that has alternate language versions. Each page must self-reference itself AND list all alternate versions. If you have 50 pages with English and Spanish versions, all 100 URLs need hreflang tags. Consider using the XML sitemap method for large sites.
What is the XML sitemap version of hreflang?
For large sites, adding hreflang to every page's HTML can be impractical. Google also supports hreflang declared in an XML sitemap using <xhtml:link> elements inside each <url> entry. This tool generates both formats — use the Sitemap XML tab when managing more than a handful of pages.
Can I use relative URLs in hreflang tags?
No. Hreflang tags require absolute URLs including the protocol (https://). Relative URLs like /es/about will not work. This tool validates that all URLs start with http:// or https:// and warns you if any are relative or invalid.