Hreflang Tag Generator
Tell Google which language or country version of a page to show, with correct hreflang tags for HTML, sitemaps or headers.
| Language | Country (optional) | URL of that version |
|---|
How to use the Hreflang Generator
- List every versionAdd one row for each language or language-and-country version of the page, with its full URL.
- Choose x-defaultPick the version for visitors whose language does not match any of yours, usually the English or language-selector page.
- Add the tags everywhereCopy the HTML tags into the <head> of every version, or use the XML sitemap or HTTP header format. Each version must list all the others and itself.
Example
<link rel="alternate" hreflang="bn-BD" href="https://www.example.com/bn/" /> tells Google to show the Bangla page to Bangla speakers in Bangladesh.
en-GB without a plain en version would trigger a tip to add one, so English speakers in other countries also get a match.
Frequently asked questions
What format do hreflang codes use?
An ISO 639-1 language code (en, bn, es), optionally followed by an ISO 3166-1 country code (en-GB, bn-BD). A country alone is not valid, and en-UK is wrong: the code for the United Kingdom is GB.
Why must every page link back?
Google only trusts hreflang when the pages confirm each other. If the Spanish page points to the English one, the English page must point back to the Spanish one, and each page should include itself.
HTML tags, sitemap or headers?
All three work equally well; use one method. HTML tags are simplest for small sites, sitemaps scale better for large sites, and HTTP headers are for non-HTML files like PDFs.