FREE TOOL

Hreflang Tag Generator: Free Hreflang Code for Multilingual SEO

Use this free hreflang tag generator to build the code that tells Google which language or regional version of a page to show each searcher. Add every version of your page, pick an output format (HTML link tags, XML sitemap or HTTP header), click Generate and copy the result. Each set you build includes every version once, plus an optional x-default, so the same block can go on every page in the group.

Generate your hreflang tags
Quick start
1Add page variations
2Pick the output format
3Click Generate Hreflang Tags
4Copy the output
1

Page Variations

Add each language/region version of the same page. Include all variants — each page must link to all others, including itself.

2

Output Format

✅ Your Hreflang Tags


      
📋 How to use:
Paste these <link> tags inside the <head> section of each language version of your page.
Direct answer: What is a hreflang tag?
A hreflang tag is an annotation that tells Google a page has alternate versions for other languages or regions, and gives the URL of each. For example, hreflang="en-GB" marks the page for English readers in the United Kingdom. Google treats hreflang as a hint to serve the right version, not as a ranking boost.

What Hreflang Does, in Plain English

Suppose you run a store with an English page for India, an English page for the United States and a Hindi page. All three describe the same product. Without guidance, Google may show the US page to a user in Mumbai, or pick one version and ignore the others. Hreflang says: these URLs are the same page for different audiences, show each to the right one.

Two clarifications save a lot of confusion. First, hreflang does not make a page rank higher. It helps Google swap in the correct URL for the searcher, so the ranking you already earn goes to the right version. Second, translations are not penalised as duplicate content. Hreflang simply helps Google group them.

How to Use the Hreflang Tags Generator

  1. 1
    STEP 1 Add page variations. For each language or region version, choose the language code from the list and paste its full URL. The tool starts with example rows (en-US, en, es, fr, de and x-default). Use Add Language Version for more.
  2. 2
    STEP 2 Pick the output format. Choose HTML link tags, XML sitemap format or HTTP header format.
  3. 3
    STEP 3 Click Generate Hreflang Tags.
  4. 4
    STEP 4 Copy the output. For HTML, paste the same full block into the head of every page in the group. For a sitemap, add it to your sitemap file. For headers, set them on the server.
  5. 5
    STEP 5 Check the result. Open each URL, confirm it loads without redirecting, and confirm every page lists every other page and itself.
Generate your hreflang tags

Hreflang Code Format and Examples

A correct tag has three parts: rel="alternate", an hreflang value and a full URL. The value is a lowercase ISO 639-1 language code, optionally followed by a hyphen and an uppercase ISO 3166-1 alpha-2 country code. Examples are en, en-GB, fr-CA and zh-CN.

Hreflang valueTargetsTypical URL
enEnglish speakers anywhere/en/
en-USEnglish speakers in the United States/en-us/
en-GBEnglish speakers in the United Kingdom/en-gb/
en-INEnglish speakers in India/en-in/
hiHindi speakers anywhere/hi/
fr-CAFrench speakers in Canada/fr-ca/
x-defaultEveryone else, or a language selector page/

Language comes first. A region code alone is not valid, and en-UK is wrong because the country code for the United Kingdom is GB. The code for India is IN, and Hindi is hi.

The Three Rules That Make Hreflang Work

Rule 1: Every version must link back (reciprocity)

If your English page points to a French page, the French page must point back to the English page. Google documentation says that annotations without return links may be ignored. Build one complete block with all versions and place it on every page, and reciprocity takes care of itself.

Rule 2: Every page references itself

Each page lists its own URL in the set as well as the others. Google recommends self-references. The block you generate includes every version, so each page gets its own entry.

Rule 3: Use x-default as a fallback

x-default names the page to show when no listed language or region matches. It is usually a global homepage or a language selector. It is optional but wise on sites with several versions.

HTML, Sitemap or HTTP Header: Which Method?

MethodWhere it goesBest for
HTML link tagsIn the head of every pageSmall and mid-size sites, easy to check in page source
XML sitemapInside sitemap.xml using xhtml:link entriesLarge sites and teams that do not want to edit page templates
HTTP headerSent by the server with the responseNon-HTML files such as PDFs

Pick one method for a given set of pages and stick to it. Google accepts all three, but running different methods that disagree makes errors harder to find. If you use the sitemap route, the XML Sitemap Generator covers the basic file, and this tool produces the language entries.

Hreflang Mistakes That Break Implementations

MistakeWhy it failsFix
Missing return linksGoogle may ignore the annotationsPut the same full block on every version
No self-referenceThe set is incompleteInclude each page's own URL
Pointing to redirecting URLsTarget should be the final canonical URLUse the destination URL, with no redirect
Pointing to noindex or blocked pagesGoogle cannot use them as alternatesMake all versions indexable and crawlable
Wrong codes (en-UK, region only)Invalid values are ignoredUse ISO language, then ISO country
Canonical points to another languageConflicts with hreflangEach version canonicalises to itself
Relative URLsAnnotations need full URLsUse absolute URLs with https
Mixing methods inconsistentlyConflicting signalsUse one method per set

When You Need Hreflang, and When You Do Not

  • You need it if you publish the same content in several languages, or the same language with regional differences such as price, currency, spelling or shipping.
  • You may want it for an Indian brand with English and Hindi versions, or one that serves India and the Gulf with different offers.
  • You do not need it for a single-language, single-country site.
  • It will not help if the language versions are machine-translated duplicates with no real local value.

Who Uses a Hreflang Generator

International SEO teams

Building tags for new markets.

Ecommerce brands

Selling to India, the UK and the US with different currencies.

Publishers

Running English and regional-language editions.

Developers

Who need clean output to paste into templates.

Agencies

Auditing a client's existing hreflang set.

Honest Limits of This Tool

  • Hreflang is a hint. Google may still show a different version.
  • The tool builds code from the URLs you enter. It does not fetch those pages to check for redirects, noindex tags or canonical conflicts. Test them yourself.
  • It does not change page content. Each version still needs genuine, localised text, and the page language attribute should match.
  • Other search engines treat hreflang differently. Check each engine's own guidance if you target them.
  • After deployment, Search Console and a crawler are the right tools to audit the live set.

Privacy

The URLs you enter go into code that will be public in your page source, so only enter live public URLs. The tool builds the output in your browser.

Open the tool

Frequently Asked Questions

What is a hreflang tag?

A hreflang tag tells Google that a page has alternate versions for other languages or regions and gives their URLs. It helps Google show each searcher the right version. It is a hint, not a ranking factor.

Does hreflang improve rankings?

Not directly. It does not boost a page. It helps Google show the correct language or regional URL, so the right page earns the traffic you already deserve.

Do I need a self-referencing hreflang tag?

Yes. Each page should list itself along with its alternates. Google recommends self-references, and the generator includes every version you enter so each page gets its own entry.

What is x-default?

x-default names the fallback page for users whose language or region matches none of your listed versions. It is usually a global homepage or a language selector. It is optional.

What does "no return tags" mean?

It means page A points to page B as an alternate, but B does not point back to A. Google may ignore annotations without return links. Place the same full set on every page to avoid it.

Should I use HTML tags, an XML sitemap or HTTP headers?

Use whichever you can maintain best. HTML tags are simplest for small sites, sitemaps suit large sites, and headers are needed for non-HTML files such as PDFs. Use one method consistently per set.

What hreflang code should I use for India?

Use en-IN for English readers in India and hi for Hindi readers. Add hi-IN only if you need to separate Hindi in India from Hindi elsewhere.

Why is en-UK wrong?

The ISO country code for the United Kingdom is GB, so the correct value is en-GB. Google ignores invalid values.

Does hreflang prevent duplicate content problems?

Properly translated pages are not penalised as duplicates. Hreflang helps Google group the versions. Near-identical pages in the same language, such as en-US and en-GB, benefit most from it.

Is the hreflang generator free?

Yes. It is free, and you can generate as many sets as you need.

Ready to build your set?

Open the Hreflang Tags Generator, add your versions and paste the result. Then set the page language with the Meta Tag Generator.

Open the Hreflang Tags Generator
For contributors
Got something worth sharing? Write for us.

Original, well researched guides are always welcome here.

  1. 1Read the guidelines
  2. 2Send us your pitch
  3. 3Our editors review it