Home / Free tools / Hreflang Generator

Hreflang tag generator

Write the tags that connect your pages in different languages.

If the same page exists in more than one language, search engines have to be told the versions belong together. Hreflang does that, and it is easy to get wrong. The codes come from three separate standards. Every version has to point at every other version including itself, and a set with one missing return link is ignored in full rather than in part. Enter an address and a language code on each row, or enter one address and let the tool build the rest. Codes are read back in plain words as you type, so a mistake surfaces before it reaches a live page. The output is a block for the head of the page, an HTTP header for files that are not HTML, or entries for your sitemap.

Nothing here is saved or sent. The tags are built in your browser as you type.

      
Use one method rather than all three. Google treats them as equivalent.

Every version lists every version

A page that names an alternate has to be named back by it, or the annotation is ignored. That rule exists so that nobody on another site can name your page as an alternate version of theirs without your agreement. The set is identical on every address, so one block covers all of them.

The codes come from three standards

Language is ISO 639-1. Region is ISO 3166-1 alpha-2, and script, where a language needs one, is ISO 15924. A single code can carry all three, as in zh-Hans-US. Each part is checked on its own, which catches the codes that parse but mean something other than you intended. The clearest example is be, which is Belarusian rather than Belgium.

Pick one method and stay with it

Tags in the head of the page, a Link header in the response, or entries in the sitemap. Google treats them as equivalent, so using more than one adds maintenance without adding meaning. Tags suit most sites. The header exists for files that are not HTML, such as PDFs, and the sitemap keeps the markup out of every template.

The fallback points at a page you already have

x-default covers visitors whose language matches nothing else in the set. It points at one of the addresses you have already listed, usually a language selector or the main version. Tick Fallback on that row and the tag is written for you.

What it checks

Every part of every code, and the set as a whole.

Codes
  • Language from ISO 639-1
  • Region from ISO 3166-1 alpha-2
  • Script from ISO 15924
The set
  • Duplicate codes and addresses
  • More than one fallback
  • Mixed http and https
Output
  • Tags for the head
  • Link header for other files
  • Sitemap entries
Building the set
  • Subdirectory, subdomain or country domain
  • Query string addresses
  • One address expanded to every language
How to use it
1
List the versions
Enter the address of each language version and the code that goes with it. If your addresses follow a pattern, enter one and let the tool expand it across the codes you list.
2
Read the codes back
The line under each code says what it means. If it says something other than what you intended, the code is wrong, however plausible it looked when you typed it.
3
Clear the problems
Anything in red stops the set from working. Anything in amber is worth taking but will not break the annotation if you leave it.
4
Copy one output
Take the tags, the header or the sitemap entries, then put the same block on every address in the set.
Pricing and terms
Price
Free. No account, no trial and no limit on how many addresses you enter.
What it requires
A current browser. No sona.to account is needed.
Data handling
The addresses stay in your browser. Nothing is sent to Sonato LLC and nothing is stored. Get in touch through the contact form if you have a question.
Questions