SEO Tools

Hreflang Tag Generator

Create alternate-language link annotations from locale and URL pairs.

Fill in the fields below. The tool processes your input in this browser and explains what its result can and cannot tell you.

Preparing the tool…

How this tool works

Parses locale and absolute URL pairs and formats alternate link elements, including an optional x-default entry.

How to use it

  1. List each language or regional variant with its locale code and URL.
  2. Include the current page in the alternates and verify reciprocal references.
  3. Check that canonical and hreflang signals agree.

Limits to keep in mind

The tool cannot check reciprocal annotations, language targeting, redirects, or canonical conflicts across your site.

Frequently asked questions

Does hreflang replace canonical tags?

No. They address different relationships and may be used together for regional variants.

Can the tool validate all pages?

No. It formats your input only; inspect the live pages and reciprocal links.

What does x-default mean?

x-default marks the fallback page for users whose language or region is not covered, often a language selector or the main version. It is optional but useful for international sites.

Which language and region codes should I use?

Use ISO 639-1 language codes, optionally followed by an ISO 3166-1 region code, such as en, en-GB or pt-BR. Each page in the set must link back to all the others.

What hreflang is for

Hreflang annotations tell search engines that several pages are versions of the same content for different languages or regions. They help the right version appear for the right user, for example showing the UK English page to visitors in the United Kingdom and the German page to German speakers. Hreflang does not translate content, boost rankings, or replace good localization.

The Hreflang Tag Generator takes a list of locale codes with their absolute URLs and formats alternate link elements for them. It can include an optional x-default entry for visitors who do not match any listed version. It builds the HTML for you, but it does not visit your pages or check how they relate to each other. The accuracy of the set depends on the information you provide.

Map real language and regional alternatives

Only use hreflang for pages that are true equivalents of one another. A page in French and a page in English with the same content are alternates. Two unrelated pages are not. Start by listing every version of the page you actually have, rather than versions you plan to build, because annotations that point to missing pages cause errors.

Language codes follow ISO 639-1, such as en, fr and de. You can add a region with an ISO 3166-1 alpha-2 country code, giving values like en-GB, en-US or pt-BR. A region cannot be used without a language. Choose the level of detail that matches your content. If your English page is the same for every country, a plain en is enough, and splitting it into regions adds work without benefit.

Create reciprocal alternate sets

Hreflang must be reciprocal. If page A lists page B as an alternate, page B must also list page A. Without return links, search engines may ignore the annotations. Each page should also include a self-reference, meaning it lists itself in its own set along with all other versions.

In practice, every page in a group carries the same complete block of alternate links. Generate the block once, then add the identical set to the head of each page in the group. If you have three language versions, each of the three pages contains three link elements, one for each version, including itself. When you add a new language later, update every existing page in the group, not only the new one.

Use x-default correctly

The x-default value marks the fallback version for users whose language or region does not match any of your listed alternates. It is often a language selector page or your main international version. It is optional, but it is useful for sites that serve a global audience.

Only one x-default should appear in a set, and it should point to a page that makes sense for any visitor. If your homepage automatically redirects users based on location, remember that search engines crawl from specific locations and may not see all versions, so keep the alternate URLs reachable directly. Avoid forced redirects that stop crawlers from reaching each language version.

Coordinate with canonical tags

Hreflang and canonical tags must agree. Each language version should usually have a canonical pointing to itself, and the hreflang annotations should use those same canonical URLs. If a French page canonicalizes to the English page, the French version is effectively removed from consideration and its hreflang is likely to be ignored.

Check that every URL in the set returns a successful response, is indexable, and is not redirected. Pointing hreflang to redirected or noindex pages is one of the most frequent causes of errors in international SEO. The alternate URLs should also use the exact protocol and host that you declare as canonical, so that the same address is used everywhere.

Where to place the annotations

The generator outputs link elements for the head of an HTML page. This is one of three supported methods. The other two are sending the annotations in HTTP headers, which suits non-HTML files such as PDFs, and listing them in an XML sitemap, which can be easier to maintain for very large sites. Choose one method for each set of pages and keep it consistent, because mixing methods makes errors harder to find.

If you use a CMS or a translation plugin that already generates hreflang tags, check the rendered source before adding your own. Duplicate or conflicting annotations can cause search engines to ignore them. For a small site with a handful of language versions, adding generated tags by hand in the template is perfectly reasonable.

Validate and maintain the language map

After publishing, check the source of several pages in each language to confirm that the full set is present and that the URLs match. Common errors to look for are wrong codes, such as en-UK instead of en-GB, missing return links, links to redirected pages, and typing mistakes in URLs. Search Console and third-party crawlers can help spot problems across a whole site.

The tool cannot check reciprocal annotations, language targeting, redirects or canonical conflicts for you. It formats what you type. Keep the language map up to date whenever you add, remove or move pages, and review it after migrations and URL changes. Hreflang is a maintenance task, and a small, accurate set is better than a large, outdated one.

More SEO Tools · Browse the tools catalogue