01 Example 1
Two language versions (English + Spanish)
- <link rel="alternate" hreflang="es" href="https://example.com/es/" />
- Each version lists itself and every other version, so the English page carries the same pair of tags as the Spanish one.
The basics
A hreflang tag is a short piece of code that tells search engines like Google which language, and sometimes which country, a page is written for. If your site has separate pages for English, French, and German visitors, or separate US and UK pages, hreflang tags link all of those versions together so Google can show each searcher the one that actually fits them.
A hreflang tag generator builds this code for you. Instead of typing out every tag by hand, you enter your page URLs and pick the right language and region for each one, and the tool puts together the full, correctly linked set.
Rext AI's hreflang tag generator builds the tags for you, because one small mistake can break the whole setup: one typo, one missing return link or one invalid code. Google won't always flag it in Search Console.
How it works
Enter the full, absolute address (starting with https://) for every language or regional version of the page.
Choose the correct ISO language code for each URL, such as en for English or es for Spanish.
Enter a country code for each version, alongside its language, such as fr-FR for France. If it's built specifically for Canada, use fr-CA.
Pick the fallback page you want shown to visitors whose language or location doesn't match any version you've listed, usually your main or default-language page.
Rext AI Hreflang tag generator free builds the complete hreflang set, including the reciprocal links between every version.
The generator checks for invalid codes, duplicate entries, missing self-references, and other common issues before you publish anything.
Copy the HTML tags and paste them into the head of each version.
Examples
01 Example 1
02 Example 2
03 Example 3
04 Example 4
Features
You can use the Hreflang tag generator online for several localized pages from one screen, instead of switching tabs for every language.
Build full language-region combinations like de-DE or de-AT, depending on what the page actually targets.
Set a single fallback page for visitors whose language or location doesn't match anything you've listed.
Our free Hreflang tag generator tool builds one set that lists every version; paste it into each version's head.
Get ready-to-paste hreflang link tags for the head of each page.
Catch invalid codes, duplicate locales, and missing self-references before you publish, not after Google quietly drops the annotation.
No, hreflang can’t help with ranking because Google says its only role is deciding which existing, already-ranking version of a page to show a given searcher.
Add your page URLs to the Rext AI hreflang generator, enter a language and a country code for each one, then generate the tags.
WordPress doesn't generate hreflang tags on its own, so the simplest route is a multilingual plugin like WPML, Polylang, or TranslatePress. Once you set up your languages and link your translated pages together, these plugins add and update the hreflang tags automatically, including the self-referencing entry on each page. One thing worth knowing: Polylang doesn't always add x-default by default, so it's worth checking Languages > Settings > Hreflang and setting it manually if it's missing.
It marks the fallback page shown to visitors whose language or location doesn't match any version you've explicitly listed. It's optional, and only useful with a genuine fallback page in mind.
Yes, this is one of the most common uses, such as separate en-US, en-GB, and en-AU pages that share English but differ in spelling, pricing, or availability.
No. It looks right but isn't a real region code. The correct code for the United Kingdom is GB, making en-GB the valid value.
Yes, always. Use the full URL including https://, not a relative or shortened path; relative URLs are a frequent cause of broken hreflang setups.
Yes, and it should. Each localized page should have a canonical tag pointing to itself, alongside its hreflang set pointing to the other versions.
In the <head> section for HTML implementation, in your sitemap.xml for the sitemap method, or in the HTTP response header for non-HTML files like PDFs.
Keep going
Keep every localized page pointed at itself so it never contradicts your hreflang setup.
Try it freeBuild an XML sitemap of your localized pages.
Try it freeConfirm crawlers can actually reach every language version you've built.
Try it freeRun it on your own site. Read the sources. Decide with the article in front of you, not a promise.
No card to start · Cancel anytime
Not ready? Twenty-one free tools, no account. All twenty-one