Building a hreflang cluster without hand-typing it
You list each language or regional version of one page, with its language code and full URL, and this generator writes the matching hreflang annotations in three formats: link tags for the HTML head, a Link HTTP header, and an XML sitemap block. Because every version of the page needs the same complete list, including a line for itself, a generator saves you from the copy-and-paste errors that break most hand-written setups.
As you type, the form also catches common mistakes before you copy anything: underscores instead of hyphens (en_US), country codes used as language codes (jp instead of ja, cn instead of zh), the non-existent region en-UK (it is en-GB), URLs that are not absolute http or https addresses, the same code pointing at two different URLs, and a missing x-default. It works entirely in your browser and does not fetch the URLs; to check what is actually live, use the Hreflang Validator.
What hreflang tells search engines, and what it does not
Hreflang says "these URLs are versions of the same content for different languages or regions". Google uses it to show the right version in results: the German page to searchers using German, the en-GB page to English speakers in the UK. It also stops region variants that are nearly identical, such as US and UK English pages, from being treated as competing copies.
It is not a ranking boost, and it does not translate anything. Bing has described hreflang as a weaker signal for its engine and also looks at the html lang attribute and the content-language meta tag, so do not treat hreflang as the only language signal on the page.
A four-version example in HTML and sitemap form
Here a pricing page exists for the US, the UK, German speakers anywhere, and a global fallback. Every one of the four pages carries the identical block, including the line pointing at itself.
<!-- The SAME block goes in the <head> of all four pages -->
<link rel="alternate" hreflang="en-US" href="https://example.com/us/pricing" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/pricing" />
<link rel="alternate" hreflang="de" href="https://example.com/de/preise" />
<link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />The sitemap method puts the same information in your XML sitemap instead. Each URL gets its own entry, and each entry repeats the full list of alternates. The urlset element must declare the xhtml namespace, which the generator's output includes.
<url>
<loc>https://example.com/us/pricing</loc>
<xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/us/pricing" />
<xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/uk/pricing" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />
</url>
<!-- ...then one <url> entry for EACH of the other pages, with the same links -->Head tags, HTTP header or sitemap: choosing one
Head tags are the easiest to see and debug, and they suit most sites. The HTTP header is the only option for non-HTML files such as PDFs. The sitemap suits large sites where adding dozens of tags to every page would bloat the HTML, or where templates are hard to change. Google treats all three as equivalent. Pick one method per set of pages and keep it consistent; spreading one cluster across methods makes it hard to keep in sync and hard to audit.
Codes: language first, region optional
The value is an ISO 639-1 language code, optionally followed by a hyphen and an ISO 3166-1 alpha-2 region code: de, de-AT, pt-BR. A region on its own (hreflang="us") is invalid. Scripts can be added for languages written in more than one, such as zh-Hans and zh-Hant. Use the broadest code that is true: if one English page serves everyone, use en; only add regions when you really have different pages for different countries, for example because prices, currency or delivery differ.
x-default is a special value for the page to show when no other version matches the searcher, typically a language picker or your main international page. It is optional but recommended.
The return-link rule
If page A lists page B as an alternate, page B must list page A. Google ignores pairs that are not confirmed in both directions. That is why every page gets the full block rather than just links to the others, and why adding a new language means updating every existing version too. Generate the block once, then paste the same output into every page in the cluster.
Two more rules make or break a cluster. Every URL in it should return 200 directly, not redirect. And every URL should be the canonical version of itself: if the German page's canonical points at the English page, Google follows the canonical and the hreflang for that page is ignored. Our Canonical Tag Checker confirms each page's canonical.
Adding the tags on WordPress, Shopify, Next.js or Nginx
WordPress
Multilingual plugins such as WPML and Polylang output hreflang automatically for linked translations; check their output rather than adding a second set by hand. Without one, add the generated block with a header-code plugin limited to the right pages.
Shopify
Shopify Markets adds hreflang for the language and country subfolders or domains it manages. Only add your own tags for pages outside Markets, and make sure you do not end up with two conflicting sets.
Next.js
In the App Router, set alternates.languages in the page's metadata, for example { 'en-US': '/us/pricing', 'de': '/de/preise', 'x-default': '/pricing' }, with metadataBase set so the URLs are absolute.
Nginx (for PDFs)
Paste the generator's HTTP header output into an add_header Link "..." line in the location block that serves the file, and do the same for each language version of the file.
Beyond the tags: structure and content
Hreflang connects versions; it does not decide how you organise them. Country-code domains (example.de) send the clearest country signal but each builds authority separately. Subfolders (example.com/de/) share one domain and are the simplest to run. Subdomains sit in between. Google retired Search Console's country-targeting setting in 2022, so for generic domains the structure, hreflang and the content itself (language, currency, addresses, local details) now carry the targeting. The hreflang validator checks the tags themselves, and our hreflang guide covers the strategy.
After you paste the output
Deploy to every page in the cluster at once, then run one of the URLs through the validator, which fetches each alternate and confirms it links back. Re-check whenever you add a language, change a URL or add a redirect, since those are the moments clusters break. Over the following weeks, Search Console's performance report filtered by country shows whether the right URL is appearing in each market.