Skip to content
Rankora
Free · runs in your browser

Hreflang Generator

Enter each language version (code and URL): the tool validates the codes, adds x-default and outputs the same block to paste on every version.

Privacy and cost

This tool runs in your browser. What you type or paste is not sent to our servers and it costs nothing to use.

How it works

  1. Add one row per version: a language-region code (fr-FR, en-GB, es…) and the full page URL.
  2. Enter the x-default URL, the fallback for languages you do not cover.
  3. Copy the result as HTML <link> tags, as an XML sitemap with xhtml:link, or as an HTTP Link header, to use on every version.

Example

Three versions (fr-FR, en-GB, es-ES) and the x-default URL https://example.com/ produce 4 tags: <link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/" />, then en-GB, es-ES and x-default. If you type "en-UK" the tool rejects the code and suggests "en-GB".

What the result means

hreflang tells Google which version of a page matches which language or region. Every version must list all the others and itself (return links), with absolute URLs, or the annotations are ignored. x-default marks the fallback version. Google treats hreflang as a signal, not a directive.

Common problems this tool helps with

  • Made-up or misspelled codes (en-UK, fr_FR, jp) that search engines do not recognise.
  • Versions that do not reference each other, or lack a self-reference.
  • Relative URLs or fragments in href values.
  • A hreflang set that is not identical on every page of the group.

Frequently asked questions

What does x-default mean?

It is the fallback page for users whose language or region matches no version: often a language selector or the main version. It is recommended but optional.

Should hreflang go in the HTML, the sitemap or the header?

One method is enough. HTML suits small sites, an XML sitemap suits big catalogues, and an HTTP header suits non-HTML files such as PDFs.

Can I use a country code alone, like "fr" for France?

"fr" is a language code (French). To target a country, combine language and region: fr-FR for France, fr-CA for Canada. A country on its own is not valid.