Home / Hreflang Tags Generator

Hreflang Tags Generator

Show Google which page is for which language

Hreflang tells Google which version of a page to show for each language and country. List every version and get the code. The tool flags any wrong codes before you copy.

How to use it

Do this once for each set of pages that are translations or local versions of each other.

01

Add every version

Put in the full URL of each language or country version, including the page you're on. You can paste a list. The tool often reads the code from the URL, like /fr-ca/.

02

Set the language codes

The language comes first, then an optional country, so British English is en-GB. Type a code or a name like Spanish. Then set an x-default page for everyone else.

03

Copy one format

Use the HTML tags in the head of every version, the entries in your XML sitemap, or the Link header for PDFs. You only need one of them.

Hreflang questions

What does an hreflang tag do?+
It tells Google that a page has other versions for other languages or countries, and which URL goes with which. Google uses that to show each person the version that fits their language and location. It isn't a ranking boost.
What is x-default?+
x-default is the page for people whose language or country doesn't match any version you listed. Most sites point it at their main page or at a page where visitors pick a language. x-default is optional. It's still worth adding, so the tool warns you when there isn't one.
Does every page need to list all the others?+
Yes. Each version should list every version in the set, itself included. If the French page points to the English page and the English page doesn't point back, Google can ignore that pair. That's why the sitemap output repeats the full set under every URL.
Which language and country codes can I use?+
The language is a two-letter ISO 639-1 code, like en, fr or ja. You can add a country after it with a hyphen, using an ISO 3166-1 alpha-2 code, like en-GB or es-MX. A country can't be used on its own. Watch out for common guesses that are wrong. The United Kingdom is GB, not UK, and Japanese is ja, not jp.
Should I use HTML tags, the sitemap or HTTP headers?+
Any of the three works, and you only need one. HTML tags are the simplest on a small site. A sitemap keeps the markup out of your pages, which helps when you have lots of versions. The HTTP Link header is for files that have no HTML head, like PDFs.
Do the URLs have to be full URLs?+
Yes. Use the whole address with https:// and the domain. Relative paths like /fr/ don't work in hreflang. Each URL should also be the canonical version of that page, not one that redirects or points its canonical tag somewhere else.

Running a site in more than one language?

Hreflang points Google to the right version. Each version still needs its own content and links to rank in its country. Our international SEO team can plan that with you.

Book a discovery call