Embed this tool on your site
About this tool
Incorrect hreflang tags are one of the most common international SEO mistakes — sending French users to the Spanish site or serving UK content to Australian searchers. The Hreflang Tag Generator turns rows of URL and language-region code pairs into <link rel="alternate" hreflang="…" href="…"> tags for the <head>. Each row has a URL field and a free-text code field (en, en-GB, fr-CA, x-default); the output lists one tag per complete row, in row order, and updates as you type. The starter rows include an x-default fallback, and the output ends with a reminder comment to keep one. Because hreflang must be reciprocal, paste the same block into the <head> of every page in the group. Codes are used exactly as typed — the tool does not validate ISO 639-1 language or ISO 3166-1 region codes, and it outputs HTML link tags only (no sitemap XML or HTTP Link header format). Everything runs in your browser.
Why use it
Fast Tag Assembly: Each complete row becomes a <link rel="alternate" hreflang="…" href="…"> line, in row order, ready to paste into a <head>.
Same Set for Every Page: Hreflang only works when every page in the group lists all the others, including itself. Build the list once and paste the identical block into each page's <head>.
x-default Reminder: The first starter row is set to x-default and the output ends with a reminder comment, so the fallback page is hard to forget.
Multi-Regional Language Handling: Rows accept language-only codes (en, fr, de) and language-region codes (en-US, en-GB, fr-CA) in the same set, which suits sites targeting one language in several countries.
Private by Default: Everything runs in your browser; the URLs you enter are not sent anywhere.
How to use
- Edit the starter rows or click + Add row; each row takes a URL and a code typed as text (e.g. en, en-GB, x-default)
- Keep one row with the code x-default for your fallback page — the first starter row uses it
- Watch the link tags update as you type, or click Generate to rebuild them
- Click Copy, then paste the same set into the <head> of every page in the group
- Double-check each code yourself — the tool does not validate language or region codes
- After deployment, confirm the tags with a hreflang testing tool or a crawl of the live pages
When it helps
- When launching a multilingual site with separate URLs for each language version
- When running a multi-regional site that serves the same language differently for different countries (e.g., en-US and en-GB)
- When Search Console or a crawler reports hreflang errors and you need to rebuild the tag set for a page group
- When adding a new language or region to an existing international site and needing to update all existing page sets
- When drafting hreflang tags for one page group to hand to a developer or CMS editor
- When migrating a site to a new URL structure and needing to rebuild hreflang annotations for the new URLs
Examples
01English US/GB plus French
InputRows: https://example.com/en-us/ (en-US), https://example.com/en-gb/ (en-GB), https://example.com/fr/ (fr), https://example.com/en-us/ (x-default)
Expected result<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/">
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/">
<link rel="alternate" hreflang="fr" href="https://example.com/fr/">
<link rel="alternate" hreflang="x-default" href="https://example.com/en-us/">
<!-- include one x-default URL for global fallback -->
InputRows: https://example.com/ (x-default), https://example.com/en/ (en)
Expected result<link rel="alternate" hreflang="x-default" href="https://example.com/">
<link rel="alternate" hreflang="en" href="https://example.com/en/">
<!-- include one x-default URL for global fallback -->
03Codes are not validated
InputRows: https://example.co.uk/ (en-UK)
Expected result<link rel="alternate" hreflang="en-UK" href="https://example.co.uk/">
<!-- include one x-default URL for global fallback -->
Tips
- Use absolute URLs (including https:// and the full domain) in all hreflang tags — relative URLs are not valid and will be ignored by Google
- If you use a CDN or proxy that rewrites URLs, verify the hreflang tags reflect the final canonical URL that Google sees, not the internal URL before rewriting
- For large sites with many language variants, implement hreflang in the sitemap rather than every HTML page to reduce template complexity and risk of missing reciprocal links
- Re-validate after any URL restructuring — hreflang references to old URLs that redirect rather than resolve directly may cause Google to ignore the annotations
- Use the same protocol (https vs http) in all hreflang URLs as in your canonical tags to avoid canonical/hreflang mismatches that confuse crawlers
Frequently Asked Questions
What is the x-default hreflang value used for?⌄
x-default signals to Google which page to show users whose browser language or location does not match any specific language/region code in the set. It is typically the English (or primary language) version or a language selector page.
Does every page in a hreflang set need to reference all the others?⌄
Yes. Google requires full reciprocal annotation — if page A references page B, page B must reference page A. Missing reciprocal links cause Google to ignore the annotations for the affected pages. This tool outputs one block listing every row; paste that same block on each page in the set.
Is en-UK a valid hreflang code?⌄
No. The correct code for English as used in the United Kingdom is en-GB, using ISO 3166-1 alpha-2 for the region. en-UK is a common mistake. This tool does not validate codes and will output en-UK exactly as typed, so check each code yourself.
Can I use hreflang in a sitemap instead of HTML tags?⌄
Yes. Google supports three implementation methods: HTML <link> tags, sitemap XML annotations, and HTTP response headers. Sitemap implementation is often preferred for large sites. This tool only outputs the HTML <link> form, so convert the pairs yourself if you use a sitemap or headers.
What happens if my hreflang implementation has errors?⌄
Google silently ignores hreflang annotations it cannot validate, falling back to serving whatever page its algorithm thinks is most relevant. This often means users see the wrong language version, increasing bounce rates and reducing conversion on international pages.
Should I use language-only codes like 'fr' or region-specific like 'fr-FR' and 'fr-CA'?⌄
Use language-only (fr) when you have one French version for all French speakers. Use language-region codes (fr-FR, fr-CA) when you have distinct versions for different countries, such as different prices, products, or spelling conventions.
Does hreflang affect rankings in the targeted region?⌄
Hreflang does not directly boost rankings; it tells Google which URL to show to which users. The correct page appearing in the right regional search results reduces bounce rate and improves engagement signals, which can indirectly support rankings.
How do I verify my hreflang implementation is working?⌄
Search Console's International Targeting report was retired in 2022, so use a crawler or a dedicated hreflang checker to confirm that every page carries the full set of return links. You can also test by searching from different countries with a VPN.
Glossary
- hreflang
- An HTML attribute on <link rel="alternate"> tags that specifies the language and optional region of an alternate page URL, telling search engines which version to serve to which users.
- x-default
- A special hreflang value indicating the fallback page to show users whose language or region does not match any other annotated variant in the set.
- Reciprocal Annotation
- The requirement that every page in a hreflang set must reference all other pages in the set, including itself. Missing reciprocal links cause Google to ignore the annotations.
- ISO 639-1
- The international standard for two-letter language codes used in hreflang attributes, such as en for English, fr for French, and de for German.
- ISO 3166-1 alpha-2
- The international standard for two-letter country codes used in the region portion of hreflang values, such as US, GB, FR, and AU.
- International Targeting
- A former Google Search Console report, retired in 2022, that showed hreflang errors and country-targeting settings for a site.
A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.
Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.
✳
✳
✓ Free to use✓ No sign-up✓ 500+ possibilities