HTML head tags
Use it when: you control the HTML templates for ordinary web pages.
Usually the clearest choice: render the full same cluster in every page head.
Most broken hreflang deployments fail the same way: page A lists page B, but B never lists A back. Build the set here and every URL references every other and itself, so the set is bidirectional by construction — that mistake can't happen. A linter flags wrong codes, duplicates, and missing fallbacks as you type.
Example data — replace with your own
One row per locale version of the same page. Paste a URL with /de/ or a
de. subdomain and the locale fills itself in. Use arrow keys to move
between cells; Enter on the last row adds a new one. The optional per-row
x-default lets each page point unmatched users somewhere different (e.g.
a localized language selector) — leave it blank to use the shared one below.
| hreflang | URL | x-default (optional, per page) | Remove |
|---|
For many pages that share a URL pattern: define one URL template per locale with
{path} as the placeholder, then paste your paths. Each path becomes one
page set with the full alternate cluster.
| hreflang | URL template | x-default url template (optional, per page) | Remove |
|---|
Paste CSV/TSV rows (locale,url with an optional third
x-default column — a header row is fine) or a sitemap.xml
that already contains xhtml:link entries. It prefills the single-page
matrix (CSV) or bulk sets (sitemap), parsed entirely in your browser.
Add a locale and URL above to see output. Runs entirely in your browser — nothing you paste is uploaded or stored. Anonymous run-level outcome counters may be used for aggregate research; URLs, domains, IPs, and identifiers are never included, and no statistic is released below 100 runs.
Fetch a page you've already deployed: we read its live hreflang annotations, then fetch each declared alternate (up to 25) to verify return links and self-references.
A US and UK English site, with a generic en fallback and an x-default,
produces head tags like:
<link rel="alternate" hreflang="en-US" href="https://example.com/us/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/" />
<link rel="alternate" hreflang="en" href="https://example.com/us/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" /> …and running that cluster through the built-in linter reports:
en-us or en-US —
the generator always emits the uppercase region form (en-US), so casing typos never
become a problem.en is what makes this clean. It catches English
speakers outside the US and UK who'd otherwise match nothing — see
regional variants without a generic fallback.x-default catches everyone else — see
missing x-default for what happens without it.en-uk instead of en-gb and the
linter flips to an error pointing at the fix — see code format.+ saves the current site or page. Use ☆ beside any saved site, page, or list to favorite it. Recent check history appears below.
Target filled from your local choices.
Saved targets, named lists, and recent check summaries remain only in this browser.
Checks run from our server; we fetch the URL you enter and don't keep the results. Anonymous aggregate outcomes feed our research posts; checked domains are counted once via an anonymized hash, never stored in the clear. Anonymous run-level outcome counters may be used for aggregate research; URLs, domains, IPs, and identifiers are never included, and no statistic is released below 100 runs.
Use it when: you control the HTML templates for ordinary web pages.
Usually the clearest choice: render the full same cluster in every page head.
Use it when: templates are hard to change or you manage many URL variants centrally.
Use xhtml:link entries consistently and keep the sitemap accessible to crawlers.
Use it when: the alternate is a PDF or another non-HTML resource.
This is the practical option for files that have no HTML head. Avoid mixing methods without a reason.
hreflang tells search engines which language/region versions of a page exist so each
searcher gets the right one. Three delivery methods are equivalent: <link
rel="alternate"> tags in the <head>, xhtml:link
entries in an XML sitemap, or HTTP Link headers (the only option for PDFs
and other non-HTML files). Pick one method per page — mixing them invites conflicts.
The two rules that break most implementations: every page must include a self-referencing entry, and every pair must be bidirectional — if A lists B, B must list A back or the pair is ignored. Because this generator emits the complete cluster on every page, both hold automatically.
If you publish en-US and en-GB but no plain en,
English speakers in Australia, Ireland, or India match nothing and Google picks for
them. Add a generic en entry (it can point at whichever regional page you
treat as the default).
x-default names the page for users who match no declared locale —
typically your language selector or your primary version. It's optional, and this tool
only warns about it, but explicit beats letting the algorithm choose.
A standalone language-selector page needs the annotations too: place the same head-tag
block on it — the x-default line is its self-reference, so the cluster
stays bidirectional. In the sitemap output, a selector URL that isn't one of the locale
pages automatically gets its own annotated <url> entry.
x-default is also a per-page annotation: pages in the same cluster may point at different x-defaults — the French page at a French-language selector, the English page at an English one. Use the per-row x-default column for that; when pages differ, the head-tag and Link-header output switches to one block per page, and each distinct selector gets its own annotated sitemap entry.
hreflang URLs must match the canonical URL exactly. If half your entries say
http:// or drop the trailing slash your site redirects to, those alternates
point through redirects — Google often discards them. Use the final, canonical form of
every URL.
A few ISO 639-1 codes were renamed and linger in old CMS exports: in →
id (Indonesian), iw → he (Hebrew),
ji → yi (Yiddish). Search engines mostly tolerate the old
forms, but use the modern codes.
Values are language or language-REGION: ISO 639-1 language
(two letters) plus optional ISO 3166-1 alpha-2 region. The classic trap is
en-uk — the United Kingdom's region code is GB. Script
subtags like zh-Hant / zh-Hans are also valid. Underscores
(en_US) are not. Matching is case-insensitive, so casing is cosmetic.
Search the ISO 639-1 language and ISO 3166-1 region codes the generator accepts. Deprecated language aliases are shown with their replacement.
Any of the three, and they are equivalent — but pick one method per page. Use <link rel="alternate"> tags in the HTML head, xhtml:link entries in an XML sitemap, or an HTTP Link header (the only option for non-HTML files like PDFs). Mixing methods on the same page invites conflicts.
x-defaultx-default is the reserved hreflang value that points to a fallback URL — the page Google shows when a user's locale doesn't match any of your other hreflang tags. It is optional and does not mean "English." names the page to serve users who match none of your declared locales — typically a language selector or your primary version. It is optional, but explicit is better than letting the algorithm choose, so it is recommended for most sites.
Almost always one of three things: the annotations are not bidirectional (page A lists B but B does not list A back), a page is missing its self-referencing entry, or the URLs do not match the canonical form (http vs https, or a trailing slashA trailing slash is the forward slash (/) at the end of a URL — example.com/page/ versus example.com/page. Except at the bare root domain, the two versions are different URLs to search engines, so you pick one format and enforce it. your site redirects) so they point through redirects. This generator emits the complete bidirectional cluster with self-references to prevent the first two.
They must agree. Each language version should have a self-referential canonical (pointing to itself, not to another language), and every hreflang URLHreflang is an annotation (in HTML, HTTP headers, or XML sitemaps) that tells search engines which language and optional region a page targets, and which alternate versions exist. It only works when every page in the cluster references all the others. must be the canonical form of that page. A hreflang that points at a non-canonical or redirecting URL is frequently dropped.
No. The region code for the United Kingdom is GB, so use en-gb. hreflang values are an ISO 639-1 language code plus an optional ISO 3166-1 alpha-2 region code; en-uk is the single most common mistake.
Upvote what you want most. New ideas can be submitted from the floating Feedback menu; requests appear here once approved, and the most-wanted rise to the top.
You won't be emailed about that request anymore.
Loading…
New requests are reviewed before they appear here.
Where this tool helps
Enter every locale version once and generate complete, self-referencing alternate sets for each page without hand-copying tags between templates.
Use the live linter to find mistakes such as en-uk, underscores, duplicates, missing generic-language fallbacks, and missing x-default coverage.
Produce equivalent HTML head tags, XML sitemap entries, HTTP Link headers, or framework snippets for Astro, Next.js, WordPress, and Shopify.
Define locale URL templates once, paste a path list, and generate full alternate clusters for every page set in bulk.
Paste CSV, TSV, or sitemap XML to prefill the matrix, inspect normalized output, and hand off a consistent replacement.
Watch the full workflow
If your site has the same page in several languages or countries, hreflang helps search engines understand which versions belong together. I’ll show you how to build the tags, catch a common mistake, choose an output format, and handle larger page lists.
Hreflang is a label that connects equivalent pages for different languages or regions. For example, it can connect a US English page with a UK English page. This tool builds the complete set of labels for you and checks the entries as you work.
This is useful before launching translated pages, when replacing hand-written tags, or when reviewing an existing setup. It can also catch invalid country codes, create tags for many pages at once, and format the result for your website or XML sitemap.
The three tabs match three jobs. "Single page" builds one group of matching pages. "Bulk" repeats a URL pattern across a page list. "Import" reads an existing spreadsheet or sitemap. We’ll begin with the single-page example.
Click "Try an example" to load a safe sample. Each row is one version of the same page: US English, UK English, and a general English version. The optional "x-default" URL is the fallback for visitors who do not match one of those choices.
The first column holds the language and optional country code. The second holds the full page address. Every row must describe an equivalent version of the same content. The tool then creates a complete set in which every version includes itself and the other versions.
The green result means the input has no known formatting problems. Under "Head tags", the code shows one alternate link for each version. Place the same complete block in every page in this group so each page points to itself and to all of its matches.
If changing page templates is difficult, select "Sitemap XML" instead. This expresses the same relationships inside a sitemap. Large results can be split into valid sitemap files automatically, so you do not need to divide them by hand.
The other formats solve different implementation problems. "Link headers" work for files such as PDFs that have no HTML head. "Snippets" provides starting code for Astro, Next.js, WordPress, and Shopify. Use one consistent method for a page instead of publishing conflicting versions.
Now I’ll type the common mistake "en-uk". The linter immediately explains that the United Kingdom’s official country code is "GB" and recommends "en-GB". This catches a value that looks reasonable but is not a valid hreflang code.
For a larger site, open "Bulk". The English and German templates contain a placeholder called "path". Paste each page path once, and the tool expands both templates for every row. Here, three paths become three complete English-and-German page groups.
If your URLs already live in a spreadsheet, use "Import". Paste a locale and URL on each row, then click "Import". The tool returns to the single-page view with those values loaded, where you can review the entries, fix warnings, and generate a consistent replacement.
After publishing, the live checker can inspect a public URL and the hreflang links it returns. That is a separate step because the generator only knows the information you entered. A live check is still a snapshot of the site at that moment, not proof that a search engine has processed it.
The guide below the tool explains where setups often break. The URLs in hreflang should match the pages’ preferred, or canonical, URLs. Small differences such as HTTP versus HTTPS, redirects, or inconsistent trailing slashes can make the relationship harder to verify.
To finish, copy or download the format your site uses. After deployment, confirm that every URL loads, points to its preferred URL, includes itself, and links back to the other versions. Correct tags describe the relationship, but they do not guarantee crawling, indexing, or rankings.
Once you add the output to your site, test every URL and make sure the matching pages link back to one another. The generator gives you a clean starting point, but the final check must happen on the live pages.