What Are Hreflang Tags?
Hreflang tags tell Google that several pages are versions of the same content for different languages or countries. Google then shows each searcher the version that fits them best, so a visitor in India sees your English India page while a visitor in Germany sees the German one.
The tags do not change rankings by themselves. They stop the wrong version from showing up, and help Google treat similar pages, like English for India and English for the UK, as a related set instead of duplicates.
How to Use the Hreflang Generator
- Add one row per version of the page. Pick the language, and a country only when the content is made for that country.
- Paste the full URL of each version, including
https://. - Set a fallback page with
x-default, such as your main page or a language picker. - Choose a format: HTML tags, XML sitemap entries or an HTTP header.
- Add the same code to every version. Each page must list itself and all the others.
Hreflang Rules Google Uses
| Rule | Example |
|---|---|
| Language first, in ISO 639 1 format | en, hi, de |
| Optional country, in ISO 3166 1 format | en-IN, en-GB |
| A country alone is not allowed | in or gb on their own are wrong |
| Reserved codes do nothing | Use en-GB, never en-UK |
| Optional script for some languages | zh-Hans, zh-Hant |
| Fully qualified URLs only | https://www.example.com/de-de/ |
| Return links are required | If A points to B, B must point back to A |
These rules come from Google's guide to localized versions of your pages. Google also says region codes like es-419 are not supported, so this generator lists real countries only.
Practical Hreflang Tips
- Pick one method. HTML tags, sitemap entries and headers do the same job. Using more than one only adds room for mistakes.
- Match your canonicals. Each version should have a self referencing canonical tag, not one that points to another language.
- Translate the whole page. Hreflang works best when the main content, not just the menu, is in the target language.
- Keep the set identical. When you add a new language, update the tags on every existing version too.
Learn More About International SEO
Start with hreflang tags explained, then make sure every version has the right canonical tag and a clear URL structure. Already live? Test your tags with the hreflang checker.
Frequently Asked Questions
1Do I need a country code in hreflang?
No. A language code alone, like en or hi, is often the best choice. Add a country only when the page is made for that country, for example different prices, currency or spelling.
2What is the x default hreflang value for?
It names the page to show visitors whose language or country matches none of your versions. Many sites use their main English page or a language picker page.
3Should a page include a hreflang tag for itself?
Yes. Google asks every version to list itself as well as all the other versions. The generator builds one shared block that does this for you.
4Can hreflang point to another domain?
Yes. Versions can live on different domains, such as example.in and example.de, as long as every URL is fully qualified and every page links back.