Get a Free Consultation

Hreflang Tags Generator (Advanced)

Add every language and region version of a page, then copy hreflang as HTML link tags, an HTTP header or XML sitemap entries. Includes x-default, bulk paste and checks for duplicate codes and broken URLs. Free, no sign-up, and nothing leaves your browser.

Updated 3 output formats, live validation

Your page versions

Jump to your hreflang code
1Language and region versions

Pick a language and an optional region, then paste that version’s full URL.

2Custom code for values not in the lists
3x-default

Blank uses the first valid version’s URL.

Bulk paste versions

One per line: a code, then the URL. Commas, spaces or pipes can separate them. Lines are added to your list.

What is hreflang?

Hreflang is an annotation that tells search engines which language or regional version of a page to show to which users. It does not translate content or redirect visitors. It links equivalent URLs together as a set, such as an English US page and a Hindi India page.

It suits multilingual sites and sites with regional versions that differ in language, currency, pricing or availability. Google treats hreflang as a signal rather than a command, so it helps but does not guarantee the version users see.

You can add hreflang as HTML link tags, an HTTP header, or XML sitemap entries. Use one method consistently for a set of pages.

Hreflang tag example

<link rel="alternate" hreflang="en-US"
  href="https://example.com/us/" />
<link rel="alternate" hreflang="en-GB"
  href="https://example.com/uk/" />
<link rel="alternate" hreflang="hi-IN"
  href="https://example.com/hi/" />
<link rel="alternate" hreflang="x-default"
  href="https://example.com/" />

Which hreflang method should you use?

All three are valid for Google. Pick the one that fits how your site is built.

Based on Google’s localized versions documentation. Last checked October 2026.
MethodWhere it goesBest for
HTML link tagsThe <head> of every versionMost sites with a few versions per page
HTTP headerThe server response for the URLPDFs and other non-HTML files
XML sitemapYour sitemap file, one entry per URLLarge sites with many pages and versions

Hreflang, canonical and the HTML lang attribute

Three tags that are easy to mix up. Multilingual sites often use all three.

TagPurposeExample
hreflangLinks localized versions of the same pageen-US, en-GB, hi-IN
rel="canonical"Names the preferred URL among duplicatesEach version points to itself
html langDeclares the language of the current page for browsers and assistive tools<html lang="en-GB">

Each localized page should usually have a canonical tag pointing to itself. Do not canonicalize every version to one URL, because that tells Google to ignore the others.

What are x-default and return tags?

x-default marks the fallback URL for users who match none of your languages or regions. It is often a language selector page or your main international page.

Return tags are the biggest source of errors. If page A points to page B, page B must point back to A, and each page should also list itself. When Google cannot confirm the return link, it may ignore the annotation.

Common code mistakes

en-UK   wrong, use en-GB
jp      wrong, use ja
en_US   wrong, use en-US
US      wrong, language is required
en-us   works, but en-US is standard

How do you implement hreflang correctly?

The generator writes the markup. These four steps cover the rest.

  1. List every version

    Add each language and region URL, including the page itself.

  2. Set x-default

    Choose the fallback URL, or let the tool use the first version.

  3. Copy the right format

    Use HTML tags, an HTTP header or sitemap entries.

  4. Paste on every version

    Add the same set to each page, then check indexing in Search Console.

Use fully qualified URLs that return a 200 status and are indexable. Hreflang pointing to redirected, blocked or noindex pages is usually ignored.

Hreflang questions, answered

Short answers on codes, x-default and common errors.

What is a hreflang tag used for?

A hreflang tag tells search engines which language or regional version of a page suits which users. It links equivalent URLs as a set so the right version can be shown in each market.

What is x-default and when should I use it?

x-default marks the fallback URL for users whose language or region does not match any other version. Use it for a language selector or a default international page.

Do hreflang tags have to be reciprocal?

Yes. Every page in the set should list itself and all the other versions. If a return link is missing, Google may ignore the annotation.

What is the difference between hreflang and canonical?

A canonical tag names the preferred URL among duplicates. Hreflang connects localized versions of a page. They solve different problems and are used together, with each version canonical to itself.

Can I use a language code without a region?

Yes. A value such as en targets all English speakers. Use en-US or en-GB only when you have distinct regional versions.

Why is en-UK wrong?

Hreflang regions use ISO 3166-1 alpha-2 country codes, and the United Kingdom is GB. Use en-GB. The generator flags en-UK so you can fix it.

Can I use hreflang in an XML sitemap or HTTP header?

Yes. Google accepts HTML tags, HTTP headers and XML sitemaps. Headers suit PDFs, and sitemaps suit large sites. Use one method per set of pages.

Why is Google ignoring my hreflang?

Common causes are missing return tags, invalid codes, URLs that redirect, are blocked or noindexed, and sets that differ between pages. Check that every URL works and every page lists the full set.

Is this hreflang generator free?

Yes. It is completely free, with no sign-up and no limit. Everything runs in your browser, so your URLs are never uploaded to a server.

Want international SEO handled for you?

Search Savvy’s technical SEO team plans and audits hreflang, sitemaps and multilingual site structure.

See our SEO services
5 ★★★★★ 9 Google reviews