Skip to content

Hreflang tag generator

Free hreflang tag generator powered by Rext AI lets you build accurate, ready-to-use hreflang tags online in just a few seconds.

Language versions

Hreflang best practices

  • •Use valid language and region codes such as en-US, en-GB, or fr-FR.
  • •Add reciprocal hreflang tags so each language or regional page references the others.
  • •Use complete, absolute URLs with the correct HTTPS version of each page.
  • •Add x-default when needed to point users without a matching language or region to a suitable fallback page.
  • •Make sure every alternate page is accessible to search engines and returns the correct URL.

The basics

What is a hreflang tag generator?

Why a hreflang tag generator matters

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.

What a hreflang tag generator does

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.

What Rext AI provides

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

How to use our hreflang generator tool

Use the tool
  1. 1

    Add your page URLs

    Enter the full, absolute address (starting with https://) for every language or regional version of the page.

  2. 2

    Type the language code

    Choose the correct ISO language code for each URL, such as en for English or es for Spanish.

  3. 3

    Add a region for each version:

    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.

  4. 4

    Add your x-default URL

    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.

  5. 5

    Generate your tags

    Rext AI Hreflang tag generator free builds the complete hreflang set, including the reciprocal links between every version.

  6. 6

    Review the validation warnings:

    The generator checks for invalid codes, duplicate entries, missing self-references, and other common issues before you publish anything.

  7. 7

    Copy and implement

    Copy the HTML tags and paste them into the head of each version.

Examples

Hreflang generator examples

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.

02 Example 2

Same language, different countries

  • <link rel="alternate" hreflang="en-gb" href="https://example.com/uk/" />
  • The region code after the language tells Google which English page to show in the UK and which in the US, when prices, spelling or shipping differ.

03 Example 3

Language + country

  • <link rel="alternate" hreflang="es-mx" href="https://example.com/mx/" />
  • A language code alone covers every country that speaks it; adding the country narrows the page to one market, here Spanish speakers in Mexico.

04 Example 4

x-default

  • Use x-default when you have a genuine fallback page in mind for visitors outside your listed locales, often a language-selector page or a main international homepage. Skip it if you're comfortable letting Google choose a version on its own.

Features

Key features of our free hreflang generator tool

Multiple language versions

You can use the Hreflang tag generator online for several localized pages from one screen, instead of switching tabs for every language.

Language and region codes

Build full language-region combinations like de-DE or de-AT, depending on what the page actually targets.

x-default support

Set a single fallback page for visitors whose language or location doesn't match anything you've listed.

Reciprocal tag structure

Our free Hreflang tag generator tool builds one set that lists every version; paste it into each version's head.

HTML output

Get ready-to-paste hreflang link tags for the head of each page.

Validation checks:

Catch invalid codes, duplicate locales, and missing self-references before you publish, not after Google quietly drops the annotation.

Hreflang tag generator FAQ

Is hreflang a ranking factor?

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.

How do I generate hreflang tags?

Add your page URLs to the Rext AI hreflang generator, enter a language and a country code for each one, then generate the tags.

How do I add hreflang tags in WordPress?

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.

What is x-default in hreflang?

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.

Can I use hreflang for different countries that speak the same language?

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.

Is en-UK a valid hreflang value?

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.

Should hreflang URLs be absolute?

Yes, always. Use the full URL including https://, not a relative or shortened path; relative URLs are a frequent cause of broken hreflang setups.

Can hreflang work with canonical tags?

Yes, and it should. Each localized page should have a canonical tag pointing to itself, alongside its hreflang set pointing to the other versions.

Where should I put hreflang tags?

 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.

Start with one keyword.

Run 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