Enter each version of a page, with its language code, an optional region code and its full URL, and the generator writes the complete hreflang set in all three formats Google accepts: link tags for the head, an HTTP Link header and XML sitemap entries. It flags invalid codes such as en-UK, region-only codes, duplicates and relative URLs, and adds x-default when you give one.
Return links: put this same set, unchanged, on every page it lists. Each page must list itself and all the others, or Google ignores the pairs that don't point both ways.
Optional: add a plain en line as well. Google suggests a catchall page for speakers of a language outside the regions you list, and it can be one of the pages above.
Google says the tags must sit inside a well-formed <head>, so check the rendered page if a plugin or script adds them.
Return linksAll 2 pages list all 3 codes.
Each page in the set must list every code, itself included, or Google ignores the pairs that don't point both ways.
Each page in the set must list every code, itself included, or Google ignores the pairs that don't point both ways.
Page
en-US
en-GB
x-default
en-UShttps://www.example.com/
Lists en-US
Lists en-GB
Lists x-default
en-GBhttps://www.example.com/uk/
Lists en-US
Lists en-GB
Lists x-default
Codes are written the usual way, with a lowercase language and an uppercase region (en-GB); Google accepts either case. Everything is built in your browser: nothing you type is sent to us, and no URL is visited.
Tags ready3 lines
Selling in more than one country?
We send you a recorded walkthrough within 2 business days.
Languages must be ISO 639-1 codes and regions ISO 3166-1 alpha-2 codes, as Google supports; scripts follow ISO 15924. UK, EU and UN aren't region codes, so en-UK is flagged with en-GB suggested.
Every URL must be fully qualified, with http or https. Entries with a bad code or URL are left out of the code until fixed, and said so.
Return links: the same set goes on every page it lists, so every page lists itself and all the others.
Nothing is fetched: the generator can't see whether your live pages already carry the tags.
Take an example business with a pricing page in three versions: US English, UK English and German, with the US page as the fallback for everyone else. The same set, written three ways:
1. Link tags, in the <head> of every version (example URLs)
3. XML sitemap entries (one <url> per version, each listing the full set)
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://www.example.com/pricing/</loc>
<xhtml:link rel="alternate" hreflang="en-US" href="https://www.example.com/pricing/" />
<xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/pricing/" />
<xhtml:link rel="alternate" hreflang="de-DE" href="https://www.example.com/de/preise/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/pricing/" />
</url>
<!-- Repeat the <url> block for /uk/pricing/ and /de/preise/, with the same four xhtml:link lines -->
</urlset>
Google treats the three as equivalent, so use one. Google says link tags must sit inside a well-formed head section, so check the rendered page if a plugin or script writes them. The HTTP header is what you need for a PDF, which has no head. In the sitemap, the order of the xhtml:link lines doesn't matter, but the xhtml namespace on the urlset line does.
Hreflang language and region codes
A code is a language from ISO 639-1, then, if you need it, a hyphen and a region from ISO 3166-1 alpha-2: en, en-GB, fr-CA. Google supports only those two lists, plus an optional script code for languages written in more than one script, such as zh-Hant for Traditional Chinese. Case doesn't matter. The W3C's advice is to keep the tag as short as possible and add a region only when you have different pages for different countries.
Codes that look right but aren't (checked against the IANA and Library of Congress code lists)
Written
What it actually means
Use instead
en-UK
UK is not a region code, so Google ignores it
en-GB
uk
Ukrainian
en-GB for British English; uk only for a Ukrainian page
gb or us
A region with no language, which Google says is not valid
en-GB or en-US
jp
Not a language code (JP is the region Japan)
ja, or ja-JP
se
Northern Sami, not Swedish
sv, or sv-SE
dk
Not a language code (DK is the region Denmark)
da, or da-DK
gr
Not a language code (GR is the region Greece)
el, or el-GR
be
Belarusian, not Belgium
nl-BE, fr-BE or de-BE
es-419
Latin America as a UN region number, which Google doesn't support
es, or a code per country such as es-MX
If you have regional versions of one language, Google suggests a generic page as well: an en page for English speakers outside the countries you target, alongside en-US and en-GB.
Hreflang return links: why every page lists every page
Google reads hreflang in pairs. If page X lists page Y, page Y must list page X, or Google ignores the pair. Each version must also list itself. So the rule is simple: the identical set goes on every version.
How many lines one set needs
Lines on each page = number of versions + 1 (if you use x-default)
Lines across the set = number of versions × lines on each page
Worked examples
Versions
x-default?
Lines on each page
Lines across the set
2 (en-US, en-GB)
No
2
2 × 2 = 4
3 (en-US, en-GB, de-DE)
Yes
4
3 × 4 = 12
5 (adding fr-FR and es-ES)
Yes
6
5 × 6 = 30
The last row is where sites slip: adding two languages means editing the three pages that already exist, not just publishing the two new ones. A page left out of the set also loses out on canonical choice. Google's own example: if the de-DE and de-CH pages point to each other but not to de-AT, Google prefers the de-DE and de-CH pages as canonicals over the de-AT page outside the set.
That is the reason this generator writes one full set, with the self-referencing line included, for you to paste unchanged into every version, or into every url block of the sitemap.
When to use hreflang x-default
x-default is the answer to "what should Google show someone who matches none of my codes?" A searcher in Brazil who reads Portuguese, on a site with only en-US, en-GB and de-DE pages, is shown the page x-default names.
A language or country selector page is the case Google designed it for: point x-default at the selector.
With no selector, point it at the version most visitors can use, often your main English page.
Use one x-default per set, and list it on every version with the rest of the set.
x-default can point to the same URL as one of your coded versions, as in the example above. That is normal.
Common hreflang mistakes, and how to check yours
Missing return links: a version lists the others, but they don't list it back.
Wrong codes: en-UK, a country on its own, or a language code that means something else (see the table above).
Relative or partial URLs: Google needs the full address, starting with https:// or http://, so /uk/pricing/ won't work.
http addresses: Google says not to list the http version of a page in hreflang when an https version exists.
Pointing at the wrong page: each line should name the equivalent page in that language, not the other site's homepage, and the address its canonical tag names, in the same language.
The same code given to two URLs, or the same URL listed twice, within a set. The generator flags both so you can check the repeat is intended; x-default sharing a URL with one version is normal.
Expecting hreflang to translate or to tell Google the language: Google detects language from the content itself, so the page still needs to be written in that language.
Search Console no longer has an International Targeting report, though Google still uses hreflang. To check a live site, open each version and view its source (or its response headers, or your sitemap) and confirm the same set is there, with the same codes. A crawler can do this across hundreds of pages. Google notes that third-party hreflang testing tools aren't maintained or checked by Google, so treat their warnings as pointers.
Hreflang is one part of a multi-country site. If you are deciding between folders, subdomains or separate domains, or your UK pages keep appearing in US results, our international SEO team can review the setup, or start with a free audit. The technical SEO service covers the canonicals and sitemaps hreflang depends on.
The short answers
What you need to know.
What is an hreflang tag?
An hreflang tag tells Google which other language or country versions of a page exist, so it can show searchers the version in their language. Each tag pairs a code, such as en-US or de-DE, with the full URL of that version: <link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/" />.
It is a map between versions, not a translation signal: Google says it doesn't use hreflang or the HTML lang attribute to work out what language a page is in.
How do I add hreflang tags to my site?
Use one of three methods, which Google treats as equivalent: link tags in the head of each page, an HTTP Link header sent with the page, or xhtml:link entries in your XML sitemap. Google says using all three brings no extra benefit, so pick one and keep it up to date.
Link tags suit most sites. The HTTP header is the only option for files without a head, such as PDFs. The sitemap keeps every set in one file, which is easier to maintain when you have many pages or can't edit page templates.
Is it en-UK or en-GB in hreflang?
Use en-GB. GB is the region code for the United Kingdom in ISO 3166-1, and UK is not an assigned region code; Google says UK in an hreflang annotation has no effect on Search. The generator flags en-UK and suggests en-GB.
Watch the other way round too: on its own, uk is the language code for Ukrainian, so hreflang="uk" targets Ukrainian speakers, not British ones.
What does hreflang x-default mean?
x-default names the page to show when none of your language or region codes matches the searcher's browser settings. Google designed it for language and country selector pages, but it can point to any page, such as your main English version.
What are hreflang return links?
Return links mean every version lists every other version, and itself. If your US page points to your UK page, the UK page must point back to the US page, or Google ignores the pair. So the same full set of tags goes on every version, with only the page it sits on changing.
Does each page need an hreflang tag pointing to itself?
Yes. Google says each language version must list itself as well as all the other versions, so the self-referencing line belongs in the set on every page.
Should I use HTML tags, an HTTP header or a sitemap?
Any one of them. Google treats the three methods as equivalent and says using all three adds nothing. Use link tags for normal pages, the HTTP header for PDFs and other files, and the sitemap when you have many pages or can't edit the templates.
Can I use a country code on its own, such as hreflang="gb"?
No. Google says specifying the region alone is not valid. The language always comes first, then an optional region after a hyphen: en-GB, fr-CA, es-MX. A plain language code such as en is fine.
Are hreflang codes case-sensitive?
No. Google accepts upper and lower case, so en-gb and en-GB mean the same. The usual style is a lowercase language and an uppercase region, which is what the generator writes.
Is it hreflang or href lang?
Hreflang, one word. It is an attribute of the link element that gives the language of the page at the link's href, which is where the name comes from. Written as two words it is no longer the hreflang attribute, so the generator always writes it as one.
Can hreflang point to pages on other domains?
Yes. Google says the alternate URLs don't need to be on the same domain, so example.com can point to example.de and example.co.uk, as long as each site points back.
Can I use es-419 for Latin America?
Not for Google. 419 is a United Nations region number, and Google supports only two-letter ISO 3166-1 region codes. Use plain es for a single Spanish page, or one code per country, such as es-MX and es-AR.
Should hreflang URLs be the canonical versions?
Yes. Point each line at the https address of the page, the one its canonical tag names. Google says to set a canonical page in the same language and not to list http versions in hreflang.
How do I check hreflang errors now that Search Console has no report?
Google retired the International Targeting report but still uses hreflang. Open each live version and confirm the full set appears in the page source, the HTTP response or the sitemap, with the same codes and return links on every version. A site crawler can check this across many pages.
Do I need hreflang if my site is in one language?
No. Hreflang describes alternate versions of a page, so a site with one version of each page has nothing to list. Add it when you publish a second language or a page for another country.
Is my information stored anywhere?
No. The tags are built in your browser, and nothing you type is sent to us. The generator doesn't visit your URLs, so it can't see whether your live pages already carry the tags.
A useful next conversation
Want to know what AI says about your business?
The tools show what is on your site. Our free audit looks at how ChatGPT, Google and Perplexity describe you, and what we would fix first. We send you a recorded walkthrough within 2 business days.