Hreflang Tag Generator
Generate correct hreflang tags for multilingual and multi-regional websites. Choose HTML <link> tags, XML sitemap format, or HTTP headers — all validated in your browser.
Language Alternates
<!-- Add language rows and URLs to generate tags -->Paste these tags inside the <head> of every page. Each page should include its own hreflang tags pointing to all language variants.
How to Use the Hreflang Tag Generator
Hreflang tags are Google's mechanism for understanding multilingual and multi-regional content. When you serve the same content in multiple languages — or target the same language to different countries (like English for the US, UK, and Australia) — hreflang ensures the right page appears in the right country's search results.
This generator lets you build a complete set of hreflang tags in three formats without any manual coding. Add each language/region variant, enter its URL, and copy the generated output directly into your site.
Step-by-Step Guide
Set the x-default URL
Enter the URL of your fallback page — usually a homepage with a language selector. This is shown to users whose language does not match any specific hreflang tag.
Add language rows
Click 'Add Language' for each locale. Select the language from the dropdown. Add a region code (US, GB, BR) if you target country-specific audiences. Enter the full URL for that locale.
Choose your output format
Switch between HTML, XML Sitemap, and HTTP Header formats. HTML is the default for most sites. Use XML for large sites, and HTTP headers for non-HTML content.
Copy and implement
Click 'Copy Output' and paste into your pages. For HTML, paste inside <head>. For XML, add to sitemap.xml. For HTTP, configure your server headers.
Common Hreflang Mistakes to Avoid
| Mistake | Impact | Fix |
|---|---|---|
| Missing x-default | Google may serve wrong page in unsupported locales | Always add an x-default pointing to your main/fallback page |
| One-way hreflang | Google ignores incomplete pairs | Every alternate page must also link back to the original |
| Wrong language code | Tags are silently ignored | Use ISO 639-1 codes (en, fr) + ISO 3166-1 region (US, GB) |
| Broken hreflang URLs | Tags are invalidated | All hreflang URLs must return 200 OK, no redirects |
| Mixed implementation | Inconsistent signals confuse Googlebot | Pick one method (HTML/XML/HTTP) and use it site-wide |
Language Code Reference (Top 20)
| Language | Code | With Region |
|---|---|---|
| English | en | en-US, en-GB, en-AU |
| French | fr | fr-FR, fr-CA |
| German | de | de-DE, de-AT, de-CH |
| Spanish | es | es-ES, es-MX, es-AR |
| Portuguese | pt | pt-BR, pt-PT |
| Italian | it | it-IT |
| Dutch | nl | nl-NL, nl-BE |
| Russian | ru | ru-RU |
| Japanese | ja | ja-JP |
| Chinese (Simplified) | zh-CN | zh-CN |
| Chinese (Traditional) | zh-TW | zh-TW, zh-HK |
| Korean | ko | ko-KR |
| Arabic | ar | ar-SA, ar-AE |
| Turkish | tr | tr-TR |
| Polish | pl | pl-PL |
| Swedish | sv | sv-SE |
| Danish | da | da-DK |
| Finnish | fi | fi-FI |
| Norwegian | no | no-NO |
| Greek | el | el-GR |
Frequently Asked Questions
What is an hreflang tag and why does it matter for SEO?
An hreflang tag is an HTML attribute that tells Google which language and region a page targets. When you have the same content in multiple languages (or regional variants like en-US vs en-GB), hreflang signals prevent duplicate content issues and ensures Google serves the correct language version to searchers in each region. Without it, Google may pick the wrong version, hurting your rankings in key markets.
What is the x-default hreflang tag?
The x-default tag specifies the fallback URL Google should serve when no other hreflang tag matches the user's language or region. Typically this points to your main page (e.g. an international homepage with a language selector). It is not required but strongly recommended by Google because it prevents no-match scenarios where Google must guess which version to display.
Do I need to add hreflang to every page on my site?
Yes. Hreflang tags must be present on all pages you want Google to understand as language alternates. Each page should include tags pointing to all its own language/region variants — including itself. If page A lists page B as an alternate, page B must also list page A. This bidirectional relationship is required; one-way hreflang signals are ignored by Google.
Should I use HTML tags, an XML sitemap, or HTTP headers for hreflang?
All three methods are equally valid per Google's guidelines. HTML <link> tags in the <head> are easiest for most sites. XML sitemap format is best for large sites where editing individual HTML pages is impractical. HTTP headers are ideal for non-HTML content like PDFs or when using JavaScript-rendered pages where injecting <head> tags is difficult. Pick one method and apply it consistently — do not mix methods across pages.
What are the most common hreflang mistakes?
The five most common mistakes are: (1) Missing the x-default tag. (2) One-way hreflang — page A links to B but B doesn't link back to A. (3) Using the wrong language code — hreflang requires ISO 639-1 language codes (en, fr, de) and optional ISO 3166-1 alpha-2 region codes (US, GB, DE). (4) Pointing hreflang to URLs that return 404 or redirect. (5) Inconsistent implementation — some pages having hreflang while others don't.
Related Tools
Need a Full International SEO Audit?
Our SEO specialists can audit your hreflang implementation, find indexing issues across all regions, and build a global ranking strategy.
Get a Free SEO Audit