SEO · Free tool

Hreflang tag generator

This hreflang tag generator turns a list of language and region versions into the matching annotations: HTML link tags, sitemap xhtml:link entries or an HTTP Link header. It checks every code against the ISO lists, gives every page the full set including itself, and reports the mistakes Google ignores. It runs in your browser.

Runs in your browser. Nothing you type is sent to us.Last checked 2 November 2026

What this tool does not do

  • It does not visit your pages, so it cannot tell whether an address loads, redirects, or really holds a translation.
  • It builds the set from the list you type. It cannot know which pages are true equivalents, or whether your canonical tags and redirects agree with them.
  • It checks codes against the ISO 639-1 and ISO 3166-1 lists. It does not judge whether a language or country is worth a version, and it checks script codes only for their four-letter shape.
  • It cannot make Google show a particular version. Google decides what a searcher sees, and nothing in its documentation presents hreflang as a ranking boost.
  • It does not crawl a live site or compare what is deployed with what you typed here. That check needs a crawler.
On this page
01

What is a hreflang tag generator?

A hreflang tag generator builds the annotations that tell Google which pages are the same content in different languages or for different regions. You supply each version with its language code and address; the generator writes the full set once and applies it to every page in the group, which is the part people get wrong by hand.

The reason a tool helps is bookkeeping, not syntax. A single hreflang line is easy. The difficulty is that every version must list every other version and itself, with identical content on each page, so adding one market to a five-market site means touching six sets. Generating all of them from one list removes that class of mistake.

This tool also checks as it builds. It rejects codes Google does not support, repairs the ones it can repair safely (such as en-UK becoming en-GB, with a message saying so), refuses addresses that are not fully qualified, and leaves out any line it cannot fix, so the output never contains a tag Google would quietly ignore. For the underlying rules in plain English, our guide to hreflang goes through them one at a time.

The point

For the underlying rules in plain English, our guide to hreflang goes through them one at a time.

02

How do I use the hreflang tag generator?

Type or paste one version per line, choose an output method and copy the result. The steps below take about two minutes for a single page, and the same input format handles many pages at once if you separate each page with a blank line.

  • Write one line per version: the language code, a bar, then the full address, for example en-GB | https://www.example.com/uk/. Spaces, commas and tabs work as separators too.
  • Include the page you are on. Each page must list itself, so the English page appears in its own set. The tool then writes the identical set for every page.
  • Add an x-default line if you have a fallback page, such as a language selector. If you have not, use the x-default option to add the first version, or an address you type.
  • Several pages at once: leave a blank line between pages. Each blank-line group becomes its own set, and a page that appears in two groups is reported.
  • Already have tags? Paste them, one link element per line. The tool reads the hreflang and href values and re-checks them.
  • Choose the output: HTML link tags, a sitemap, or an HTTP header. Pick one method and keep to it.
  • Read the messages above the output. Anything marked as a fix was left out of the result; anything marked as corrected was changed and told to you.
  • Copy or download the result, deploy it, then confirm on the live pages that every address in the set loads and lists the others back.
03

Which output should I choose: HTML tags, a sitemap or an HTTP header?

Choose the method that is least work to keep correct on your site. Google treats the three as equivalent, and says that using more than one gives no extra benefit in Search, so the decision is about maintenance. The table sets out what each one suits.

MethodWhere it goesSuitsWatch for
HTML link tagsInside the head of every page in the setSites where you can edit the page template, and small sets of pagesThe same lines must appear on every version. Google asks for the tags to sit in a well-formed head, and says not to add other attributes such as media to the same tag.
Sitemap xhtml:linkIn an XML sitemap, under each page's loc entryLarge sites, or sites where editing every head is impracticalThe sitemap needs the xhtml namespace declared. Google says a sitemap can only list addresses under the directory where it is hosted. The xhtml:link children do not count towards the sitemap's address limit.
HTTP Link headerIn the response header sent with each filePDFs and other files with no HTML headEach address must be wrapped in angle brackets, entries are separated by commas, and the value must be identical on every version.
04

What does the tool do with language and region codes?

Hreflang values take a language, then an optional script, then an optional region. Google supports ISO 639-1 language codes and ISO 3166-1 Alpha 2 region codes only, reads the value without regard to case, and ignores a few codes people often try. This is how the tool treats each case.

What you typeWhat the tool doesWhy
en-GB, de, fr-CAAccepts, and tidies the capitalisation if needed (en-gb becomes en-GB)Lower-case language and upper-case region is the convention. Google says the value is case-insensitive.
en-UKChanges to en-GB and tells youThe code for the United Kingdom is GB. Google says UK has no effect in hreflang.
en_GBChanges the underscore to a hyphen and tells youHreflang values are joined with hyphens.
GB on its ownRefuses, and suggests en-GBA region cannot stand alone. The first part must be a language.
eng or deuRefuses, and suggests the two-letter codeGoogle supports ISO 639-1 two-letter codes. Three-letter codes are not on the list.
en-EU or fr-UNRefusesGoogle says EU and UN have no effect as regions. Name a country, or use the language alone.
es-419RefusesGoogle says codes such as es-419 are not supported. Use es, or a country such as es-MX.
zh-Hant, zh-Hans-CNAccepts a four-letter scriptGoogle supports script codes such as Hans and Hant. The tool checks only the four-letter shape, not the full ISO 15924 list.
ukAccepts, with a warninguk is the valid code for Ukrainian. It is often typed by someone who means the United Kingdom, who needs en-GB.
05

Why does every page need the full set, including itself?

Because Google ignores annotations unless the pages link back to each other. Its documentation says each version must list itself and every other version, and that the pages must reference each other, which stops another site from claiming your pages are its alternates. One-way links do nothing.

This is why the generator writes one set per group and lists the pages that must carry it. The set is identical on every page, so the English page, the German page and the fallback page all receive the same lines. If you ever hand-edit one page's head, you have broken the symmetry that makes the annotation trustworthy.

The x-default page deserves a note. If it is a separate address, such as a language selector at the root of the site, that page is part of the cluster and needs the whole set too. The tool counts it as a member for exactly that reason, which is why a four-line input shows four pages rather than three. Google describes x-default as the fallback for visitors whose language matches none of your versions, and suggests it particularly for language selectors and for home pages that redirect automatically. It is optional.

Do not redirect visitors between versions by guessing their language or location. Google advises against automatic redirects between language versions, because they can stop both users and search engines seeing all of them. A visible link to the other versions does the job without the risk.

The point

Do not redirect visitors between versions by guessing their language or location.

06

What are the common mistakes, and which can this tool catch?

Most hreflang faults are mechanical, and a tool built on fixed rules catches the ones that live inside the text you give it. It cannot catch faults that live on your server. The first group below is caught here; the second needs a crawler or a manual check.

  • Caught: an invalid or unsupported code, a region with no language, UK in place of GB, an underscore in place of a hyphen.
  • Caught: a relative address, an address with no protocol, an address with spaces, and a host name that looks incomplete.
  • Caught: the same code used twice in one set, a set with fewer than two versions, and one page appearing in two sets.
  • Caught: sitemap values that need escaping. Ampersands, apostrophes, quotation marks and angle brackets are converted as the sitemap protocol requires.
  • Not caught: an address that returns an error or redirects. A set that lists a page that no longer loads cannot be reciprocal in practice.
  • Not caught: a version whose main content was never translated. Google says localised versions count as duplicates if only the boilerplate is translated and the main content is not.
  • Not caught: conflicting signals. If a canonical tag on the German page points at the English page, you are telling Google the German page is a copy, which contradicts the annotation. Google advises specifying a canonical page in the same language. Check this on the live pages.
  • Not caught: a plugin or template that writes its own hreflang as well as yours. Choose one source of truth and switch the other off.
07

How does hreflang fit with sitemaps, robots.txt and indexing?

Hreflang assumes the pages can be crawled and indexed. A version that is blocked in robots.txt or carries a noindex tag cannot be shown to searchers, so listing it in a set achieves little. Before you deploy, make sure none of the addresses is blocked; the robots.txt guide explains how to check, and the robots.txt generator builds a file that does not shut anything out by accident.

If you choose the sitemap method, the file follows the usual sitemap rules. The protocol requires UTF-8, entity escaping for five characters, an address under 2,048 characters, and no more than 50,000 addresses or 50MB uncompressed in one file. If you only need a plain sitemap with no language annotations, the XML sitemap generator is the simpler tool, and what a sitemap is covers the basics.

If a language version is missing from search after you deploy, treat hreflang as one suspect among several. Pages that are not indexed are not rescued by annotations, and why a site is not indexed walks through the usual causes. Address structure matters too: Google describes country domains, subdomains and subdirectories as workable and URL parameters as not recommended, and a tidy structure starts with the address itself, which the URL slug generator can help with.

The point

If a language version is missing from search after you deploy, treat hreflang as one suspect among several.

08

When is a free tool not enough?

A free generator is enough for a handful of pages. It stops being enough when you have thousands of pages, when a platform writes tags automatically, or when a migration is about to move addresses. Then the question is not how to write the tags but how to keep them correct as the site changes.

Large and changing sites need the set generated from the same data that builds the pages, and need a crawl after each release to read every annotation back and compare partners. International SEO work includes writing that specification and testing it by crawl. If the real concern is that a migration will break annotations, website migration SEO and the migration checklist cover where they get lost.

If you are unsure whether your site is ready for several markets at all, start with an SEO audit; what an audit includes shows where international markup sits among the other checks. Hreflang is one part of technical SEO. If you want a second pair of eyes on a multi-language plan, you can describe the site and the markets and we will say plainly whether the structure or the annotations come first.

The point

If you are unsure whether your site is ready for several markets at all, start with an SEO audit; what an audit includes shows where international markup sits among the other checks.

09

Sources

Statements about Google's behaviour come from Google Search Central documentation. Statements about sitemap files come from the sitemaps.org protocol. The tool applies these rules with fixed logic in your browser and no model is involved.

  • Google Search Central, Tell Google about localized versions of your page, supports the three methods, return links, self-reference, fully qualified addresses, x-default, supported language, script and region codes, UK having no effect, header and sitemap syntax. developers.google.com/search/docs/specialty/international/localized-versions, checked 2 November 2026.
  • Google Search Central, Managing multi-regional and multilingual sites, supports the URL structure options and the advice to avoid automatic redirects. developers.google.com/search/docs/specialty/international/managing-multi-regional-sites, checked 2 November 2026.
  • Google Search Central, How to specify a canonical URL, supports the advice to specify a canonical page in the same language and the treatment of hreflang clusters as a canonicalisation signal. developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls, checked 2 November 2026.
  • sitemaps.org, Sitemaps XML format, supports UTF-8, entity escaping, the 2,048 character limit for an address and the 50,000 address and 50MB limits. www.sitemaps.org/protocol.html, checked 2 November 2026.

Questions people ask about this tool

What does a hreflang tag generator do?

It takes your list of language and region versions and writes the annotations that tell Google they are equivalent pages. This one outputs HTML link tags, sitemap entries or an HTTP header, gives every page the same full set including itself, and checks each code against the ISO lists before it builds anything.

Does this tool send my web addresses anywhere?

No. It runs entirely in your browser, and nothing you type is sent to us or to anyone else. The tool makes no network requests, stores nothing between visits and uses no model. The output is built with fixed rules on your own device. Closing the tab clears everything you entered.

Does hreflang improve my rankings?

Google describes hreflang as a way to tell it about localised versions of a page so it can serve the suitable one. Its documentation does not present hreflang as a ranking boost. Tags that are correct stop wrong-language results; they are not a promise of higher positions or more traffic.

Should I use en-GB or en-UK?

Use en-GB. Hreflang regions follow ISO 3166-1 Alpha 2, where the United Kingdom is GB, and Google says UK has no effect in hreflang. If you type en-UK, the tool changes it to en-GB and says so in the messages, so you can fix the same mistake wherever else it appears.

Do I still need x-default?

It is optional. Google describes x-default as the fallback for visitors whose language matches none of your versions, and suggests it for language selector pages and for home pages that redirect automatically. If you have no obvious fallback page, many sites simply omit it. Add it only when you have a page that suits it.

Can I use HTML tags and a sitemap together?

You can, but Google says using more than one method gives no extra benefit in Search, so it only adds places to keep correct. If the two ever disagree, you create the very conflict hreflang is meant to avoid. Choose one method for each set of pages and stay with it.

Why did the tool leave one of my lines out?

It leaves out a line when the code or address cannot be repaired safely, such as a relative address, a three-letter language code or a region on its own. The message above the output gives the line number and the fix. Correct the line and it returns to the result straight away.

Can it check hreflang that is already live on my site?

Only in a limited way. You can paste existing link tags and the tool re-checks the codes and addresses, but it cannot visit the pages or confirm that each one links back. For that you need a crawler, or a manual look at the source of each version.

More free tools

When a tool is not enough

Read next