Pick a language and, if the page targets one country, a country. Or type the code yourself.
Codes, URLs and x-default look correct.
<link rel="alternate" hreflang="en" href="https://example.com/" /> <link rel="alternate" hreflang="es" href="https://example.com/es/" /> <link rel="alternate" hreflang="fr" href="https://example.com/fr/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />
Every version in a set gets the same block, including a link to itself.
How to use
Add each version, or upload a CSV
In Build tags, pick a language and country or type the code, and paste the full URL of each version. Keep an x-default row for your fallback page. For many pages, use Bulk from CSV with a header row of codes.
Fix the warnings and pick an output
Fix any warning under the rows, such as an unknown code or a URL without https://. Then choose HTML link tags, XML sitemap, or HTTP Link header for PDFs and other files.
Copy, publish, then check it live
Press Copy or Download and add the output to every version of the page, or to your sitemap. Once live, open Check a live page to confirm each alternate returns a link to the others.
Why Hreflang Tag Generator
- Language and country pickers with ISO codes, plus warnings for en-UK style mistakes.
- Output as HTML tags, an XML sitemap or HTTP Link headers.
- Bulk sets from a CSV or spreadsheet paste, one row per page.
- Live checker for self-reference and return links on up to 15 alternates.
Common hreflang code mistakes
Most hreflang errors are small typos in the codes. The generator warns about each of the mistakes below, which are the ones seen most often in audits. Google ignores an annotation it cannot read, so one bad code can quietly drop a version from the set without any error on the page itself.
| Wrong | Right | Why |
|---|---|---|
| en-UK | en-GB | The ISO country code for the United Kingdom is GB |
| jp | ja | jp is a country code; the language code for Japanese is ja |
| en_US | en-US | hreflang uses a hyphen, not an underscore |
| es-419 | es-MX, es-AR and so on | Google only supports two-letter country codes, not numeric regions |
| en-EU | en-IE, en-DE and so on | EU is not a country; list each country or use en |
| US | en-US | A country alone is not valid; the language comes first |
| /es/ | https://example.com/es/ | URLs must be absolute |