Home » SEO Tools » Hreflang Tag Generator

Hreflang Tag Generator

Create hreflang tags for multilingual pages, so search engines know which language version to show to which audience.

Last updated 13 November 2026

Use the tool

Hreflang tags tell search engines that a page has versions in different languages or for different regions. They help search engines show the right version to the right audience, instead of showing the wrong language version.

This tool builds hreflang tags from language codes and URLs you enter. Paste the tags into the head of each language version, and make sure each version points to all the others.

How to Use This Tool

  1. Enter a language code and URL per version: use codes like en, es or fr, or region codes like en-us.
  2. Add more versions if needed: click Add Language for each extra version.
  3. Add a default URL if you want one: the default version is shown when no language version matches.
  4. Click Generate Tags: copy the output into the head of each version.

Good Practice Tips

  • Point every version to every version: each language page should list all versions, including itself.
  • Use full URLs: partial addresses do not belong in hreflang tags.
  • Match language codes carefully: a wrong code can point searchers to the wrong version.
  • Only use it for real versions: do not add hreflang tags for language versions that do not exist.

What Is Hreflang

Hreflang is a signal that tells a search engine a page exists in more than one language, or for more than one region. Each version carries a small tag that names its own language and region and points to every other version, so a searcher in Spain sees the Spanish version instead of the English one. Without hreflang, pages in different languages can look like duplicate content.

Three Ways to Add Hreflang

There are three ways to put hreflang on a site, and you only need one of them for each page. HTML tags in the head suit most sites, and that is the method this tool outputs. Hreflang entries inside an XML sitemap suit large sites. HTTP headers sent by the server suit files that are not HTML pages. This tool builds the first method only. It does not build sitemap entries or HTTP headers. If you use the sitemap method instead, the XML Sitemap Generator builds the sitemap file, and you add the hreflang entries to it by hand.

Language and Region Codes

A hreflang value is built from two codes. The language part comes from ISO 639-1 and uses two lower case letters, such as en, es and de. The region part is optional and comes from ISO 3166-1, using two upper case letters, such as US and GB. Together they read en-US and en-GB.

The most common mistake is en-UK. It looks right, but the ISO country code is GB, not UK, so en-UK is not a valid hreflang value. Always write en-GB for British English. A region on its own is never valid either: US by itself says nothing about language. Some languages add a script code, such as zh-Hant-TW.

Every Page Must Point Back

Hreflang works in both directions. If the English page points to the Spanish page, the Spanish page must point back to the English page, and both pages must list themselves too. A one way link is ignored, so a cluster only works when every page carries the full set. Generate the tags once, then paste the whole block into the head of each language page.

Hreflang and Canonical Tags

Hreflang and canonical tags do different jobs, and a page needs both when it has language versions. The canonical tag says which URL is the main copy of that one version, so each language page should point its canonical tag at itself. Never point the canonical tags of all versions at the English page, because that tells the search engine the other versions are duplicates to ignore. The Meta Tag Generator page covers the meta tags that go with them.

Common Mistakes

Most hreflang problems come from a small list of errors: wrong codes, such as en-UK instead of en-GB; missing return links; a missing self reference; relative URLs, since hreflang needs full URLs such as https://botixtech.com/hex-to-decimal; canonical conflicts, where all versions point at one page; and tags for pages that do not exist, or that redirect.

When You Do Not Need Hreflang

Hreflang only helps when a site has the same content in more than one language, or the same language aimed at more than one region. A site in one language for one audience does not need it, and adding tags for versions that do not exist will only create errors.

Worked Example

Here is a site with an English page for the United States, an English page for the United Kingdom, a Spanish page for Spain, and a default page for everyone else. All four pages carry the same four tags:

<link rel="alternate" hreflang="en-us" href="https://botixtech.com/hex-to-decimal" />
<link rel="alternate" hreflang="en-gb" href="https://botixtech.com/gb/hex-to-decimal" />
<link rel="alternate" hreflang="es-es" href="https://botixtech.com/es/hex-to-decimal" />
<link rel="alternate" hreflang="x-default" href="https://botixtech.com/hex-to-decimal" />

The x-default tag is the fallback shown when no language version matches the searcher. Type the four codes and URLs above into the tool, click Generate Tags, and it produces exactly these four lines. See also the FAQ Schema Generator and the Article Schema Generator.

Frequently Asked Questions

What is the default version for?

The default version is the fallback version shown when no language version matches the searcher. It is optional.

Should every language page list all versions?

Yes. Each version should point to all versions, including itself, so search engines can map the full set.

Do hreflang tags affect rankings on their own?

No. They help search engines pick the right language version. Rankings still depend on content, links and page quality.

Is my input uploaded to a server?

No. Everything runs in your browser on your own device, so your text never leaves your computer.

Is en-UK a valid hreflang code?

No. The ISO country code for the United Kingdom is GB, not UK, so the valid code is en-GB. The code en-UK is not valid and a search engine may ignore a tag that uses it. Always check the ISO 3166-1 list instead of guessing from a familiar abbreviation.

Can I use a region code on its own?

No. A region code such as US says nothing about language, so it is not a valid hreflang value by itself. Always start with a language code from ISO 639-1, such as en, and add the region after it, such as en-US.

Does hreflang replace the canonical tag?

No. They do different jobs. Hreflang says which language version to show, while the canonical tag says which URL is the main copy of that one version. Each language page should point its canonical tag at itself, and the URL in a hreflang tag should match that canonical URL.

Should I use tags in the head, a sitemap, or an HTTP header?

Any one method works, and you only need one per page. HTML tags in the head suit most sites and are what this tool builds. A sitemap suits large sites or pages where you cannot edit the head, and an HTTP header suits files that are not HTML pages, such as PDFs. Do not mix methods on the same page unless the sets match exactly.

How do I add hreflang on WordPress?

Multilingual plugins such as WPML and Polylang add hreflang tags for you when you link the translated versions of a page. If you do not use a plugin, generate the tags with this tool and paste the block into the head of each version, the same as on any site.

↑