Preferences

Privacy is important to us, so you have the option of disabling certain types of storage that may not be necessary for the basic functioning of the website. Blocking categories may impact your experience on the website. More information (Cookie Policy)

Accept all cookies

Free Hreflang Tag Generator - Build Correct Multilingual Tags

Generate hreflang tags for free. Build valid annotations for every language and region version of a page, with x-default, correct codes and reciprocal links.

Tools

Thibault Besson-Magdelain, founder of Sorank

About Author

Thibault Besson-Magdelain

Founder of Sorank, 7+ years of experience in SEO, GEO enthusiast.
On this page

Learn everything to know on Hreflang Tag Generator !

Created on
14/9/26
Last update:
15/9/26
Travellers with backpacks walking through a bright airport terminal

Summary

The free hreflang generator writes the <link rel="alternate" hreflang> tags for every language version of a page. Add one line per version, choose the language (27 available) and, if needed, the region (21 available), paste the full URL, pick the x-default page and generate the code. Then paste the same block in the head of every version: each page must list itself and all the others, with absolute URLs, or search engines ignore the set.

Want to go further? Ask

The hreflang generator solves a small problem that causes big ones: a French reader who lands on your English page, or a UK buyer sent to US prices. Hreflang tags tell Google that several pages are localized versions of the same content, so it can show each searcher the right one. Google is explicit that it does not use hreflang or the HTML lang attribute to detect the language of a page; hreflang only links the versions together (Google Search Central, localized versions of your pages).

Two small globes on a plain light background

How do you use the hreflang generator?

  1. Add one line per version of the page with "+ Add a language".
  2. Choose the language, and a region only if the version targets one country, such as en-GB for the United Kingdom or pt-BR for Brazil.
  3. Paste the full URL of that version, starting with https://.
  4. Tick x-default on the version to show visitors who match none of the others, or untick "Include x-default".
  5. Generate the code, copy it and paste it in the <head> of every version listed.

For three versions with an x-default, the tool returns four lines:

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

The code is the same on every page of the set: the English page, the French page and the Brazilian page all carry these four lines. Nothing is sent or stored; the code is built in your browser.

What are the rules of a valid hreflang set?

They come from Google's documentation and are the same whichever method you choose.

RuleWhat it meansWhat happens if broken
Self-referenceEach version lists itself as well as all other versionsThe set is incomplete
Return linksIf page A points to page B, page B must point back to AGoogle ignores tags that are not confirmed by the other page
Absolute URLshttps://example.com/foo, not //example.com/foo or /fooRelative addresses are not valid alternates
Language firstAn ISO 639-1 language code, then an optional ISO 3166-1 alpha-2 regionA region alone, such as hreflang="US", is invalid
Supported codes onlyCodes outside those two standards, such as es-419, are not supportedThe tag is ignored
In the headThe link tags sit inside a well-formed <head>Tags pushed into the body by broken HTML are not read

Return links exist for a reason: Google explains that it requires both pages to point to each other so that another site cannot name itself as an alternate version of your page. Alternates can sit on different domains, for example example.fr and example.de, as long as the links go both ways.

Which language and region codes should you use?

Use a language code alone unless the content really differs by country. A single Spanish page for all Spanish speakers is es; separate pages for Spain and Mexico, with different prices or spellings, are es-ES and es-MX. Language codes come from ISO 639-1 (Library of Congress, ISO 639 code list) and region codes from ISO 3166-1 alpha-2 (ISO 3166 country codes).

AudienceCorrect valueCommon mistake
English, United Kingdomen-GBen-UK (the assigned code of the United Kingdom is GB)
Portuguese, Brazilpt-BRbr (the language comes first; br is Breton)
German, Switzerlandde-CHch-de (order reversed)
Spanish, Latin Americaes, or one es-XX per countryes-419 (not supported by Google)
Any visitor not matchedx-defaultSeveral x-default values in one set

Google accepts upper and lower case, but writing the region in capitals, as the generator does, keeps the code readable.

Miniature globe on an office desk with soft lights behind it

Where should you put hreflang: head, HTTP header or sitemap?

Google treats the three methods as equivalent, so pick the one that is easiest to maintain and stick to it.

MethodBest forWatch out for
<link> tags in the headMost sites; the generator writes this formatEvery page carries the full set, so a new language means editing every version
HTTP Link headerNon-HTML files such as PDFsNeeds server configuration
XML sitemapLarge sites with many languagesEach URL entry lists all alternates, itself included

If you use the sitemap method, check the file with the sitemap checker after each change, or generate it with the XML sitemap generator.

Which mistakes break hreflang most often?

  • Pointing to a URL that redirects or returns an error. Each alternate should answer 200 directly; test doubtful ones with the redirect checker.
  • Hreflang and canonical in conflict. Each version should have a self-referencing canonical. If the French page names the English page as canonical, you are telling Google they are duplicates, not translations. Check it with the canonical checker.
  • Untranslated pages. Google only treats localized versions as duplicates when the main content stays untranslated; a page with a translated menu and English body text is not a real French version.
  • Automatic redirects by language. Google advises against redirecting users to another language version based on what you think their language is, because it can stop users and search engines from reaching all versions (Google, multi-regional and multilingual sites). Let visitors switch, and use x-default for the selector page.
  • One language per cookie. Google recommends a different URL for each language version rather than cookies or browser settings.

How do you check that your hreflang tags work?

  1. Open the source of each version and confirm that the same block appears in the head, with one line per version and the page itself among them.
  2. Follow every URL in the block. Each one should load directly, in the right language, without a redirect.
  3. Check the return links by opening a second version and making sure it points back to the first.
  4. Inspect the indexed page with the URL Inspection tool in Search Console. Its Google-selected canonical field shows which version Google treats as canonical; for a translated page, it should be the page itself (Search Console Help, URL Inspection tool).

If Google picks another language version as canonical, the content is probably too close to a duplicate, or the canonical tags contradict the hreflang set.

Does hreflang improve rankings?

Not directly. It does not make a page rank higher; it helps the right version appear for the right audience, and stops your language versions from competing for the same searches. Each version still has to earn its place with content written for its market, local links and the usual on-page work. Our glossary entries on hreflang and duplicate content go further.

How do you keep a multilingual site consistent?

Treat hreflang as part of publishing, not as a one-off task: every new page and every new language must update the whole set. Check a sample of pages every quarter, and after any change of URL structure. To grow traffic in each language and see where it comes from, the Sorank GEO and SEO dashboard follows your Google and AI traffic in one view, and the keyword research finds the queries each version can win.

A working hreflang set lists every version, itself included, with absolute URLs, valid codes and return links on every page. Generate your tags now, then see the Sorank plans to grow each language version on autopilot.

Frequently asked questions

How do I create hreflang tags?

Add one line per language version in the free hreflang generator on this page, choose the language and an optional region, paste each full URL and pick the x-default page. Copy the generated block and paste it in the head of every version listed.

Does every page need to reference itself in hreflang?

Yes. Google asks each language version to list itself as well as all the other versions, and every page it points to must point back. If two pages do not both point to each other, Google ignores those tags.

What does x-default mean in hreflang?

It marks the page to show visitors whose language or region matches none of your versions, often a language selector or your main international page. Use only one x-default per set; it is optional but recommended for selector pages.

Sources

Other Free SEO Tools

THEY TRIED SORANK BEFORE YOU

Testimonials from ambitious founders

Organic growthE-commerce

0 to 10000 visitors in 5 months

Celio Fabianomonrobotlavevitre.fr
Organic growthSoftware

0 to 5000 clients in 8 months

Thibault BMsorank.com
Organic growthLeisure and aviation

0 to 1104 clicks in 4 months

Dominiqueflight-sensations-idf.com
Organic growthMusic software

x30 clicks in 4 months

Valentin Cordiertiger-sounds.com
Organic growthHealth and wellness

x30 clicks in 4 months

Rodrigue Bretonalthevia.com