Docelora
ToolsAboutContact
SEO tools

Hreflang Generator

Tell search engines which language or regional version of a page to show each visitor. List each version’s language code and URL, and get correct hreflang annotations in the format you use.

Quick answer: enter one “language-code | URL” line per version (for example en-GB, fr, es-MX), add an x-default URL for everyone else, choose HTML, sitemap or HTTP header output, and add the same complete set to every version.

Hreflang Generator

HTML · XML sitemap · HTTP header · code checks

“code | URL” per line

Runs on your device: everything you type or open is processed in this browser tab. Nothing is uploaded to Docelora or anyone else.

Valid codes

CorrectWrongWhy
en-GBen-UKThe UK’s ISO country code is GB
jajpjp is a country, not a language
es-419es-LALatin America uses the UN code 419
zh-Hans / zh-CNcnLanguage first, then script or region
1. List every versionIncluding the page itself.
2. Add x-defaultThe fallback page or language selector.
3. Choose the formatHTML, sitemap or header.
4. Add to every versionEach page must link back to all the others.

The rules that break most setups

Related tools

Frequently asked questions

What is hreflang?

An annotation telling search engines which language or regional URL to show to which users.

Is the code language or country?

Language first (ISO 639-1), optionally followed by a region (ISO 3166-1), e.g. en-GB.

Can I use only a country?

No – a language is always required.

What is x-default?

The URL for users who match none of your listed languages.

Does every page need all tags?

Yes – each version lists all versions including itself.

HTML or sitemap?

Either works; sitemaps are easier for many pages, HTML for small sites.

When should I use HTTP headers?

For non-HTML files such as PDFs.

Does hreflang change rankings?

It helps the right version show in each market; it is not a ranking boost.

Does Bing support hreflang?

Bing relies more on the content-language meta tag and html lang attribute.

Is “en-UK” valid?

No – use en-GB.

Are codes case-sensitive?

No, but en-GB is the conventional form.

Can hreflang point to another domain?

Yes – versions can live on different domains or subdomains.

What if a version is noindex?

Remove it from the set; hreflang should list indexable pages only.

Do I need hreflang for one language?

No.

Why is Google ignoring my tags?

Usually missing return links, non-canonical URLs or invalid codes.

How do I add the sitemap namespace?

Add xmlns:xhtml="http://www.w3.org/1999/xhtml" to the <urlset> element.

Can I mix scripts like zh-Hant?

Yes – script subtags such as Hans and Hant are supported.

Is it free?

Yes – no sign-up, no limits and no watermark.

Does it work on a phone?

Yes, in current mobile browsers; the layout adapts to small screens.

Is my content sent anywhere?

No. The tool runs in your browser and nothing you type is uploaded.

Last reviewed: 8 November 2026.