FREE SEO TOOLS, NO SIGN-UP NEEDED · MARKET ME GOOD

Hreflang Tag Generator

Hreflang Tag Generator

Build hreflang tags for every language and country version of a page, checked against Google’s rules. Get HTML tags, an XML sitemap or an HTTP header, and test tags you already have.

  • Free, no sign-up
  • 184 languages, 249 countries
  • HTML, sitemap or header
  • Checks Google’s rules

Add every language or country version of one page. Type a code like en, en-GB or zh-Hant, or pick one from the list.

Paste a list instead
One version per line: code and URL, separated by a space, comma or tab. Pasting from a spreadsheet works.

Your hreflang tags

Everything runs in your browser. Nothing you type is sent anywhere.

Step by step

How to use the hreflang generator

  1. Add each version of the page

    One row per language or country version: the hreflang code and the full URL. Paste a list from a spreadsheet if you have many. The generator checks every code and URL as you type and explains anything Google would ignore.

  2. Add an x-default URL

    Optional, but useful. It tells Google which page to show people whose language you have not listed, usually your main page or a language picker.

  3. Pick the format

    HTML tags for normal pages, an XML sitemap if you manage hreflang in your sitemap, or an HTTP Link header for PDFs and other files.

  4. Put the same set on every page

    Copy or download the result. Every page in the set needs the full list, including a tag pointing to itself. Then use Check tags to test what is live.

Formats

HTML tags, sitemap or HTTP header

Google reads hreflang in three places and treats them the same. Pick the one that is easiest to keep up to date. Google says there is no benefit to using more than one method, and doing so makes mistakes more likely.

MethodBest forHow
HTML tagsNormal web pagesPut the <link> tags in the <head> of every page in the set.
XML sitemapLarge sites, or when you cannot edit the headOne <url> entry per page, each listing all versions. The links do not count towards the sitemap URL limit.
HTTP headerPDFs and other files with no HTMLThe server sends a Link header with each file.

Codes

Hreflang language and region codes

An hreflang value starts with a two-letter language code from ISO 639-1, such as en, de or lv. You can add a two-letter country code from ISO 3166-1 Alpha 2 after a hyphen, such as en-GB, and a script code for Chinese, such as zh-Hans for Simplified and zh-Hant for Traditional. Google accepts upper or lower case, but the generator writes regions in capitals, as the standard does.

CodeWorksWhy
enYesEnglish, for every country
en-GBYesEnglish for the United Kingdom
zh-HantYesChinese in Traditional script
x-defaultYesAny language you have not listed
en-UKNoUK is not an ISO country code. Use en-GB
gb or usNoA country on its own is not allowed. Start with the language
engNoThree-letter language codes are not used. Use en
en_USNoUse a hyphen: en-US
es-419NoGoogle does not support number regions. Use es, or one tag per country
en-EUNoEU and UN are not countries. Google ignores them

If you have several regional English pages, such as en-GB and en-US, Google suggests also adding a plain en tag for English speakers in other countries. It can point to one of the pages you already have.

Rules

Self-reference, return links and x-default

  • Every page lists itself. Each version must list itself as well as all the others, so the block of tags is identical on every page in the set.
  • Return links. If page A points to page B, page B must point back to page A. Google ignores a pair that does not link both ways, so that another site cannot claim to be a version of your page. Pairs that do link both ways still count.
  • Full URLs only. Write https://example.com/uk/, not /uk/ or //example.com/uk/. Versions can sit on different domains.
  • One URL per code. Two different URLs for the same code confuse Google. One URL for several codes is fine.
  • x-default. Use it for the page people should land on when no listed language matches them. It was designed for language picker pages, but your main page works too.

These rules come from Google’s own guide, Tell Google about localized versions of your page. The generator applies all of them, and Check tags tests a page you already have.

FAQ

Questions about the tool

Do I put the same hreflang tags on every page?

Yes. Every version of the page carries the full set, including a tag pointing to itself. Generate the block once and paste it into the head of each version.

What is x-default and do I need it?

x-default is the page Google shows when none of your languages match the searcher, often your main page or a language picker. It is optional, but it is worth adding whenever you have a page that suits everyone else.

Is en-UK a valid hreflang code?

No. The ISO country code for the United Kingdom is GB, so use en-GB. Google says UK, EU and UN have no effect in hreflang. The generator flags them and offers a one-click fix.

Can I use a country code without a language?

No. The language always comes first. de means German, not Germany. For German speakers in Austria, use de-AT.

Which is better: HTML tags, a sitemap or HTTP headers?

None of them ranks better. Use HTML tags if you can edit each page’s head, a sitemap for large sites or when templates are hard to change, and HTTP headers for PDFs. Pick one and keep it up to date.

Can the versions be on different domains?

Yes. A set can mix example.com, example.de and example.lv. Each URL must be the full address of a page that returns content, not a redirect.

How do I check hreflang tags that are already live?

Open the page, view its source, and paste the head into Check tags. Add the page’s own URL to check that it lists itself. Repeat for each version to confirm the sets match.

Is my data sent anywhere?

No. The generator and the checker run in your browser. Nothing you type leaves your device.

  1. 01 Apply
  2. 02 Get your audit
  3. 03 Meet the team

Let's
make it
predictable.

90 minutes. We bring the data and the plan. You bring the goals.

Book a call → Contact us