Skip to content

Hreflang Tag Generator

Tell Google which language version of a page to show to whom.

Report a problem

Don't include personal or sensitive information.

What happened, and what did you expect? (10–2000 characters) 0 / 2000

Your browser and system, screen size and recent error messages on this page. Never what you typed or your files. Privacy

What is sent
 

List each language or regional version of a page with its URL, add an optional x-default, and the generator writes the hreflang annotations in all three supported forms: <link rel="alternate" hreflang> tags for the HTML head, <xhtml:link> entries for your XML sitemap, and a Link: HTTP header for PDFs and other files.

It checks the codes as you type and catches the classic mistakes: kh instead of km for Khmer, jp for Japanese, en-UK instead of en-GB, relative URLs, duplicates and a missing x-default.

How to use the Hreflang Tag Generator tool

  1. Enter each language code (en, km, en-GB, zh-Hant…) and the full URL of that version.
  2. Add an x-default URL for visitors whose language you do not offer.
  3. Choose HTML tags, XML sitemap or HTTP header.
  4. Copy the result and add the same set to every language version of the page.

Why use ToolOrca Hreflang Tag Generator

  • HTML link tags, XML sitemap entries and HTTP Link header
  • Language suggestions including Khmer, Thai, Vietnamese and Chinese scripts
  • Validation of ISO language and region codes with fixes for common mistakes
  • Duplicate, relative-URL and x-default checks
  • Remembers your list in this browser

Rules that make hreflang work

Every version must list all versions, including itself, and the links must be returned: if the English page points to the Khmer page, the Khmer page must point back. Use full https:// URLs that answer 200 and are canonical. Missing return links are the most common reason Google ignores hreflang.

Codes are an ISO 639-1 language (en, km, th), optionally followed by an ISO 3166-1 region (en-GB, km-KH) or a script (zh-Hans). A region alone, such as kh or uk, is not valid.

HTML, sitemap or header?

All three are equivalent; pick one per site. HTML tags are easiest for small sites. For large sites the sitemap keeps pages lighter and is easier to generate. The HTTP header is the only option for non-HTML files such as PDFs.

Frequently asked questions

What is x-default?

The page to show when no listed language matches the visitor, usually a language picker or your main version.

Is the Khmer language code kh or km?

km. KH is the country code for Cambodia, so Khmer for Cambodia is km-KH, and plain Khmer is km.

Does hreflang help rankings?

It does not boost rankings; it makes Google show the right language version to each searcher, which improves clicks and avoids duplicate-content confusion.

Is anything sent to a server?

No. Everything is generated in your browser, so it works offline once the page has loaded and nothing you type leaves your device.