How to use the hreflang generator
- Add a row for each language or country version of the same page, with its full URL.
- Add an x-default URL, usually your main or international page, for visitors who match none of the versions.
- Choose HTML tags (for the page head) or XML sitemap format.
- Place the same complete set of tags on every version of the page.
What is hreflang?
Hreflang is an HTML attribute that tells Google a page has versions in other languages or for other countries. It helps Google show the right version, for example the UK page with prices in pounds to UK searchers, and prevents your versions competing with each other.
Hreflang rules that matter
- Return links: if page A points to page B, page B must point back to page A. Missing return links are the most common error.
- Self-reference: each page must include a tag pointing to itself.
- Correct codes: language first (ISO 639-1, such as en), then optional country (ISO 3166-1, such as GB). Use en-GB, not en-UK.
- Full URLs: always include https:// and the full path.
- Canonical match: each version should have a self-referencing canonical, not point to another language.
Frequently Asked Questions
Do I need hreflang if my site is only in English?
Only if you have separate pages for different English-speaking countries, such as UK and US versions. A single-language, single-country site does not need it.
What is x-default in hreflang?
It tells Google which page to show visitors whose language or country does not match any version you listed.
Is it en-UK or en-GB?
en-GB. The country code for the United Kingdom is GB.
Should I use HTML tags or the sitemap?
Both work. HTML tags are simpler for small sites; the XML sitemap is easier to manage for large sites.