Hreflang Tag Generator
Hreflang Tag Generator
Build hreflang tags for every language and country version of a page, checked against Google’s rules. Get HTML tags, an XML sitemap or an HTTP header, and test tags you already have.
- Free, no sign-up
- 184 languages, 249 countries
- HTML, sitemap or header
- Checks Google’s rules
Add every language or country version of one page. Type a code like en, en-GB or zh-Hant, or pick one from the list.
Paste a list instead
Your hreflang tags
Everything runs in your browser. Nothing you type is sent anywhere.
Step by step
How to use the hreflang generator
Add each version of the page
One row per language or country version: the hreflang code and the full URL. Paste a list from a spreadsheet if you have many. The generator checks every code and URL as you type and explains anything Google would ignore.
Add an x-default URL
Optional, but useful. It tells Google which page to show people whose language you have not listed, usually your main page or a language picker.
Pick the format
HTML tags for normal pages, an XML sitemap if you manage hreflang in your sitemap, or an HTTP Link header for PDFs and other files.
Put the same set on every page
Copy or download the result. Every page in the set needs the full list, including a tag pointing to itself. Then use Check tags to test what is live.
Formats
HTML tags, sitemap or HTTP header
Google reads hreflang in three places and treats them the same. Pick the one that is easiest to keep up to date. Google says there is no benefit to using more than one method, and doing so makes mistakes more likely.
| Method | Best for | How |
|---|---|---|
| HTML tags | Normal web pages | Put the <link> tags in the <head> of every page in the set. |
| XML sitemap | Large sites, or when you cannot edit the head | One <url> entry per page, each listing all versions. The links do not count towards the sitemap URL limit. |
| HTTP header | PDFs and other files with no HTML | The server sends a Link header with each file. |
Codes
Hreflang language and region codes
An hreflang value starts with a two-letter language code from ISO 639-1, such as en, de or lv. You can add a two-letter country code from ISO 3166-1 Alpha 2 after a hyphen, such as en-GB, and a script code for Chinese, such as zh-Hans for Simplified and zh-Hant for Traditional. Google accepts upper or lower case, but the generator writes regions in capitals, as the standard does.
| Code | Works | Why |
|---|---|---|
en | Yes | English, for every country |
en-GB | Yes | English for the United Kingdom |
zh-Hant | Yes | Chinese in Traditional script |
x-default | Yes | Any language you have not listed |
en-UK | No | UK is not an ISO country code. Use en-GB |
gb or us | No | A country on its own is not allowed. Start with the language |
eng | No | Three-letter language codes are not used. Use en |
en_US | No | Use a hyphen: en-US |
es-419 | No | Google does not support number regions. Use es, or one tag per country |
en-EU | No | EU and UN are not countries. Google ignores them |
If you have several regional English pages, such as en-GB and en-US, Google suggests also adding a plain en tag for English speakers in other countries. It can point to one of the pages you already have.
Rules
Self-reference, return links and x-default
- Every page lists itself. Each version must list itself as well as all the others, so the block of tags is identical on every page in the set.
- Return links. If page A points to page B, page B must point back to page A. Google ignores a pair that does not link both ways, so that another site cannot claim to be a version of your page. Pairs that do link both ways still count.
- Full URLs only. Write
https://example.com/uk/, not/uk/or//example.com/uk/. Versions can sit on different domains. - One URL per code. Two different URLs for the same code confuse Google. One URL for several codes is fine.
- x-default. Use it for the page people should land on when no listed language matches them. It was designed for language picker pages, but your main page works too.
These rules come from Google’s own guide, Tell Google about localized versions of your page. The generator applies all of them, and Check tags tests a page you already have.
FAQ
Questions about the tool
Do I put the same hreflang tags on every page?
Yes. Every version of the page carries the full set, including a tag pointing to itself. Generate the block once and paste it into the head of each version.
What is x-default and do I need it?
x-default is the page Google shows when none of your languages match the searcher, often your main page or a language picker. It is optional, but it is worth adding whenever you have a page that suits everyone else.
Is en-UK a valid hreflang code?
No. The ISO country code for the United Kingdom is GB, so use en-GB. Google says UK, EU and UN have no effect in hreflang. The generator flags them and offers a one-click fix.
Can I use a country code without a language?
No. The language always comes first. de means German, not Germany. For German speakers in Austria, use de-AT.
Which is better: HTML tags, a sitemap or HTTP headers?
None of them ranks better. Use HTML tags if you can edit each page’s head, a sitemap for large sites or when templates are hard to change, and HTTP headers for PDFs. Pick one and keep it up to date.
Can the versions be on different domains?
Yes. A set can mix example.com, example.de and example.lv. Each URL must be the full address of a page that returns content, not a redirect.
How do I check hreflang tags that are already live?
Open the page, view its source, and paste the head into Check tags. Add the page’s own URL to check that it lists itself. Repeat for each version to confirm the sets match.
Is my data sent anywhere?
No. The generator and the checker run in your browser. Nothing you type leaves your device.