Free Tool
4.9/5

Free Hreflang Tag Generator

Build international SEO link tags for multilingual sites. Validate ISO 639-1 language and ISO 3166-1 region codes, add x-default, and copy HTML or XML sitemap markup.

Output format:

Add language rows with valid URLs to generate hreflang tags.

Routing users to the right locale?

Shorten campaign URLs with Flyn to track which locale your audiences click, built-in click analytics by country, device, and referrer.

Shorten for free

How to Generate Hreflang Tags in 3 Steps

Step 1: Add a row per language and region, Hreflang Tag Generator screenshot
1

Add a row per language and region

Enter the ISO 639-1 language code (e.g. en, es, fr), the optional ISO 3166-1 region (US, GB, ES, MX), and the URL of that page version. Use the "Add common languages" quick button to scaffold six popular locales in one click.

Step 2: Review validated tags and warnings, Hreflang Tag Generator screenshot
2

Review validated tags and warnings

The tool builds <link rel="alternate" hreflang="..." href="..."> tags, validates every code against ISO standards, flags duplicate or malformed entries, and automatically includes an x-default row for unmatched locales.

Step 3: Paste into <head> or your XML sitemap, Hreflang Tag Generator screenshot
3

Paste into <head> or your XML sitemap

Copy the generated HTML and paste it into the <head> of every language version of your page, or switch to XML sitemap output and paste the markup into your sitemap. Verify in Google Search Console.

What Is Hreflang and Why Does International SEO Need It?

Hreflang is an HTML attribute that tells search engines which language and regional version of a page should be served to which audience. It lives inside a <link rel="alternate"> tag in the <head> of every page. When Google sees a properly tagged set of alternates, it picks the right URL based on the searcher's language preferences and country, so a German searcher gets the de-DE page and a Mexican searcher gets the es-MX page, even if they search for the same term.

The tag itself does not boost rankings. What it does is prevent two common SEO problems on multilingual sites: duplicate content (when the same text is published at multiple URLs) and locale mismatch (when Google shows the wrong country's version in search results). Without hreflang, your localized pages can cannibalize each other or be filtered out as duplicates.

A complete hreflang set in HTML:

<link rel="alternate" hreflang="en-US" href="https://example.com/" /> <link rel="alternate" hreflang="es-ES" href="https://example.com/es/" /> <link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />

Common Language & Country Codes for Hreflang

Hreflang uses ISO 639-1 (lowercase, two letters) for language and ISO 3166-1 alpha-2 (uppercase, two letters) for region. Below are the most common combinations, copy a row into the generator above.

Language

Region

Locale

hreflang

en

US

English (United States)

en-US

en

GB

English (United Kingdom)

en-GB

en

CA

English (Canada)

en-CA

en

AU

English (Australia)

en-AU

en

IN

English (India)

en-IN

es

ES

Spanish (Spain)

es-ES

es

MX

Spanish (Mexico)

es-MX

es

AR

Spanish (Argentina)

es-AR

fr

FR

French (France)

fr-FR

fr

CA

French (Canada)

fr-CA

de

DE

German (Germany)

de-DE

de

AT

German (Austria)

de-AT

de

CH

German (Switzerland)

de-CH

it

IT

Italian (Italy)

it-IT

pt

PT

Portuguese (Portugal)

pt-PT

pt

BR

Portuguese (Brazil)

pt-BR

nl

NL

Dutch (Netherlands)

nl-NL

sv

SE

Swedish (Sweden)

sv-SE

da

DK

Danish (Denmark)

da-DK

no

NO

Norwegian (Norway)

no-NO

fi

FI

Finnish (Finland)

fi-FI

pl

PL

Polish (Poland)

pl-PL

cs

CZ

Czech (Czech Republic)

cs-CZ

ru

RU

Russian (Russia)

ru-RU

tr

TR

Turkish (Turkey)

tr-TR

ar

SA

Arabic (Saudi Arabia)

ar-SA

ar

AE

Arabic (UAE)

ar-AE

he

IL

Hebrew (Israel)

he-IL

ja

JP

Japanese (Japan)

ja-JP

ko

KR

Korean (South Korea)

ko-KR

zh

CN

Chinese Simplified (China)

zh-CN

zh

TW

Chinese Traditional (Taiwan)

zh-TW

zh

HK

Chinese Traditional (Hong Kong)

zh-HK

hi

IN

Hindi (India)

hi-IN

th

TH

Thai (Thailand)

th-TH

vi

VN

Vietnamese (Vietnam)

vi-VN

id

ID

Indonesian (Indonesia)

id-ID

ms

MY

Malay (Malaysia)

ms-MY

x-default

-

Default / fallback for unmatched locales

x-default

Common Hreflang Mistakes to Avoid

Using country codes as language codes

A common error is writing hreflang="uk" for a UK English page, but "uk" is the language code for Ukrainian. The language code for the UK is "en"; the country code is "GB". The full correct value is hreflang="en-GB".

Missing return links between versions

Every page in your hreflang cluster must reference every other page, including itself. If your English page lists Spanish but the Spanish page does not list English, Google discards the entire cluster's hreflang signals. Audit return links in Search Console.

Pointing to redirecting or 404 URLs

Hreflang URLs must resolve to a 200 OK response. If the URL 301-redirects or 404s, Google treats the entire alternate as broken. Re-check your URLs after site migrations, locale renames, or theme changes.

Forgetting x-default for the fallback locale

Without x-default, Google has to guess which URL to show when a searcher's locale does not match any of your declared versions. Add an x-default entry pointing to your language selector page or main global version.

Mixing HTML, HTTP header, and sitemap hreflang

Pick one delivery method per page and stick with it. If you set hreflang in both the HTML head and the XML sitemap, Google may see the values as conflicting signals and may end up ignoring both. Use the method that fits your CMS.

Hreflang Best Practices

Do

Don't

Use lowercase language and uppercase region codes

Mix case like en-us, EN-GB, or En-Us

Include x-default for unmatched locales

Skip x-default and let Google guess your fallback

Add return links so every version references every other

List Spanish on the English page but not the reverse

Point hreflang URLs at 200 OK pages only

Point at pages that 301-redirect or 404

Self-canonical each locale to its own URL

Canonicalize every locale to the English version

Validate codes against ISO 639-1 and ISO 3166-1

Invent locale codes like en-uk, es-latam, or zh-zh

Three Ways to Implement Hreflang

Google supports three delivery methods. Pick the one that fits your stack, never mix on the same page.

HTML <link> tags in the <head>

Pros

Easiest to inspect, debug, and validate per page. Works with any static or server-rendered site.

Cons

Adds bytes to every page, heavy for sites with 20+ locales. Has to be present in the initial HTML, not injected by JavaScript.

<link rel="alternate" hreflang="en-US" href="https://example.com/" /> <link rel="alternate" hreflang="es-ES" href="https://example.com/es/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />

HTTP Link headers

Pros

Works for non-HTML files like PDFs, downloadable manuals, or API responses. No need to modify the document body.

Cons

Harder to inspect, requires curl or browser dev tools. Less common, so harder for SEO collaborators to audit.

Link: <https://example.com/file.pdf>; rel="alternate"; hreflang="en-US", <https://example.com/es/file.pdf>; rel="alternate"; hreflang="es-ES"

XML sitemap with xhtml:link entries

Pros

Scales best for large multilingual sites, centralizes all mappings in one place. Easy to regenerate programmatically.

Cons

Requires submitting the sitemap to Search Console. Errors are not visible in page-level audits.

<url> <loc>https://example.com/</loc> <xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/" /> <xhtml:link rel="alternate" hreflang="es-ES" href="https://example.com/es/" /> </url>

Hreflang + Link Shortener: Track Your International Audience

Hreflang sends search traffic to the right locale. Flyn short links tell you where your campaign clicks actually come from, so you know which markets are pulling weight.

Per-country click analytics

See which countries open each campaign link in real time. Validate that your localized landing pages match where traffic actually comes from.

Locale-aware short links

Create per-language short links and pass UTM parameters so analytics shows each locale's performance separately.

International SEO toolkit

Combine the hreflang generator with our canonical, sitemap, and redirect tools for a complete international SEO audit workflow.

Free, no sign-up needed

Generate as many hreflang sets as you want. Save your history in your browser, your data never leaves your device.

Frequently Asked Questions

What is hreflang and what does it do?
Hreflang is an HTML attribute used in <link rel="alternate"> tags that tells search engines which language and regional version of a page to serve to which audience. For example, hreflang="en-GB" signals that a page is in English written for users in the United Kingdom. Google, Yandex, and Seznam use hreflang to pick the most appropriate URL for each searcher; Bing relies on its own language meta tag instead. Hreflang does not change rankings on its own, it changes which URL Google shows in results when multiple versions exist.
When should I add hreflang tags to my site?
Use hreflang any time you have substantially the same content in multiple languages or targeted at multiple regions, for example, English versions for the US and UK, or a Spanish site serving both Spain and Mexico. You do not need hreflang if you only have one language, if your translations are auto-generated by a widget, or if your site is global English with no regional differences. The clearest signal that you need hreflang is users in the wrong locale landing on the wrong URL from search.
What format do hreflang values use?
Hreflang values follow the IETF BCP 47 standard. A value is either a two- or three-letter language code from ISO 639-1 (e.g. en, es, fr, de, zh, ja), or a language code combined with a hyphen and a two-letter region code from ISO 3166-1 alpha-2 (e.g. en-US, es-MX, pt-BR). The language code is required and must be lowercase; the region code is optional and must be uppercase. Using en-uk or eng-US is invalid, Google will silently ignore malformed values.
What is x-default and when should I use it?
The x-default value tells search engines which URL to serve when no other language version matches the user. Use it for a language selector page, a global English version, or your main domain. Google strongly recommends adding x-default whenever you implement hreflang because it covers users whose browser or location does not match any of your targeted locales. Without x-default, Google may pick an unpredictable fallback for unmatched users.
Should I put hreflang in HTML, HTTP headers, or my XML sitemap?
All three are valid and equally weighted by Google, pick the one that fits your stack. HTML link tags in the <head> are the easiest to inspect and the most common; HTTP headers are useful for non-HTML files like PDFs; XML sitemap entries scale best for sites with hundreds of localized URLs because they centralize the mappings in one file. Whichever you choose, never mix methods on the same page, Google may treat the duplicates as conflicting signals.
What are the most common hreflang mistakes?
The top three mistakes are: (1) missing return links, every version must reference every other version, including itself, or Google ignores the whole cluster; (2) using country codes as language codes, "uk" is not a language, the language code for the UK is "en"; and (3) pointing hreflang URLs at pages that 301-redirect or 404. Run Google Search Console's International Targeting report to surface return-link errors and invalid codes after you deploy.
Why do I need a self-referencing hreflang tag?
Every page in an hreflang cluster must list itself as one of the alternate versions. So the English page must include <link rel="alternate" hreflang="en" href="..."> pointing to its own URL, in addition to listing the Spanish, French, and other versions. Without self-references, Google treats the cluster as broken and may stop swapping URLs in search results. The hreflang generator on this page automatically self-references when you add the page URL to a row.
Where can I find Google's official hreflang documentation?
Google maintains hreflang guidance at developers.google.com/search/docs/specialty/international/localized-versions. The doc covers all three implementation methods (HTML, HTTP header, sitemap), valid value formats, return-link rules, and common errors. It is updated when policies change, bookmark it and re-check yearly. The International Targeting report in Search Console (under Legacy tools) is the canonical place to debug live hreflang implementations.
Can hreflang hurt my SEO if I get it wrong?
Misconfigured hreflang will not penalize your site, but it can waste effort. If return links are missing or codes are malformed, Google simply ignores hreflang entirely and falls back to its own language detection, which may serve the wrong URL to the wrong country. The real risk is duplicate content: if your en-US and en-GB pages are identical and you do not use hreflang or canonicals, Google may pick only one to index and drop the other from search results.
How is hreflang different from canonical tags?
Canonical and hreflang solve different problems and should be used together. Canonical tells Google "of these similar URLs, this one is the master version to index"; hreflang tells Google "this set of URLs are equivalent translations, pick the right one per audience". Each language version should self-canonical (point its canonical at its own URL) and also list all other language versions via hreflang. A common mistake is canonicalizing every locale to the English version, that tells Google to drop the localized pages.
How do I monitor hreflang health after deployment?
The fastest signal is Google Search Console's International Targeting report under the Legacy tools section, it lists hreflang errors per cluster, including missing return links and code errors. You can also run a crawler like Screaming Frog or Sitebulb with hreflang validation enabled. After major site changes, re-fetch a sample URL with curl to confirm the link tags render in the raw HTML (some JavaScript frameworks omit them on initial server render).
Does hreflang work for subdomains, subdirectories, and ccTLDs?
Yes, Google supports all three URL structures equally. Subdirectories like example.com/es/ are simplest to manage and inherit the parent domain's authority. Subdomains like es.example.com are treated as separate sites by Google but work the same way for hreflang. Country-code top-level domains (ccTLDs) like example.es are the strongest geo-targeting signal because the TLD itself implies the country, but they require more SEO effort to build authority for each domain.

Hreflang tells search engines about your locale versions. If you are also weighing automatic country redirects for campaign traffic, read geo-targeted links vs standard redirects first, because Google warns against IP-based redirects on indexed pages.

Ready to scale your international link strategy?

Combine valid hreflang tags with Flyn's link shortener for branded short links, real-time click analytics by country, QR codes, and per-locale A/B testing, all on one platform.