Hreflang Generator

Last updated: October 16, 2026  •  Published by: NOFYI Editorial Team  •  Category: SEO Tools

Workspace

What is the Hreflang Generator?

The Hreflang Generator builds <link rel="alternate" hreflang="..."> tags that tell search engines which language or regional version of a page to show for a given audience. You paste the tags into the <head> of your page. Hreflang is a hint, not a redirect: it does not send visitors to another version by itself.

The workspace has two inputs: a Default URL and a Language Versions list. The tool outputs one hreflang line per language code plus an x-default line that points to the Default URL.

How to Use the Hreflang Generator

  1. Enter the Default URL, for example https://example.com/page. This is also used for the x-default line.
  2. In Language Versions, enter one entry per line in the form lang_code URL, for example en https://example.com/en/page.
  3. Click Process.
  4. Copy the Generated Code from the result panel.
  5. Paste the tags into the <head> of the corresponding page, and check every href before publishing (see Limitations).
  6. Click Clear to start over.

Worked Example

Input tested on this page: Default URL https://example.com/page; Language Versions en https://example.com/en/page, fr https://example.com/fr/page, es https://example.com/es/page.

Observed output:

<link rel="alternate" hreflang="en" href="https://example.com/page">
<link rel="alternate" hreflang="es" href="https://example.com/page/es">
<link rel="alternate" hreflang="fr" href="https://example.com/page/fr">
<link rel="alternate" hreflang="x-default" href="https://example.com/page">

Note that the output is sorted by language code (en, es, fr), not in the order typed.

Limitations

  • Bug observed: the tool ignores the URLs typed after each language code. It derives each href from the Default URL instead: en uses the Default URL itself, and other codes append /code to it (for example https://example.com/page/es). Do not assume your typed per-language URLs were used. Verify and correct every href before publishing.
  • It does not check that the language pages exist, return a successful response, or link back to each other. Hreflang works best when each version links to all other versions, including itself.
  • It does not validate language or region codes, canonical tags, or trailing-slash consistency.
  • It does not fetch pages, detect the page language, or confirm that the translated content matches.

Frequently Asked Questions

Does hreflang redirect visitors to their language?

No. Hreflang only signals to search engines which version to show in results. Redirects, language switchers, and server logic are separate.

What is x-default for?

The x-default line points to the fallback page shown when no language version matches the searcher. Here it points to the Default URL.

Do I need hreflang on every language version?

Yes, in practice. Each language version should carry the full set of hreflang tags for all versions, including itself, so search engines see a consistent cluster.

Will hreflang improve my ranking?

Not directly. It helps search engines show the right language version, which can reduce bounces from visitors landing on the wrong language, but ranking still depends on content, links, and other factors.