Hreflang Tag Generator

Hreflang tags tell search engines which localized version of a page to show each

Updated
Loading tool…

Hreflang tags tell search engines which localized version of a page to show each

How to use Hreflang Tag Generator

  1. Add a row for each language version: pick a language, an optional region, and paste that version's URL.
  2. Add an x-default row pointing to your fallback or global page, and choose HTML or XML sitemap output.
  3. Copy the generated tags and paste the full set into the head (or sitemap entry) of every listed page.
Try next →Article Schema Markup GeneratorThis tool builds schema.org structured data for articles as JSON-LD, the format

About Hreflang Tag Generator

Hreflang tags tell search engines which localized version of a page to show each visitor based on their language and region. This generator lets you list every version of a page — with an ISO 639-1 language code, an optional ISO 3166-1 region code, and its URL — and instantly builds the matching link tags. You can output them as HTML tags for a page's head or as xhtml:link entries for an XML sitemap.

The tool validates your codes and URLs as you type, warns about duplicate hreflang values, and flags more than one x-default. It does not crawl your site or check that the tags are reciprocal across pages — that check has to happen on the live site — but it does build a correct, self-referencing set you can paste onto each URL. Remember that every page in a group must list all versions, including itself, or search engines will disregard the annotations.

Everything runs entirely in your browser. No URLs, page content, or codes are uploaded anywhere, and there is no sign-up or network call — the tags are assembled locally from what you enter.

Frequently asked questions

What is the correct hreflang format?
Use a two-letter ISO 639-1 language code (like en), optionally followed by a hyphen and a two-letter ISO 3166-1 region code (like en-US). Region alone is never valid — hreflang="US" is wrong; it must include a language. Use x-default for the fallback page when no language or region matches.
Do I need to add these tags to every page?
Yes. Hreflang must be reciprocal and self-referencing: each localized URL has to list the full set of alternates, including a link to itself. If page A links to page B but B doesn't link back to A, search engines ignore the annotation. Paste the generated block on every URL in the group.
Should I put hreflang in the head or the sitemap?
Either works, but pick one method per site to avoid conflicts. HTML head tags are simplest for small sites. XML sitemap entries (xhtml:link) are cleaner for large sites because you manage them in one file instead of editing every page's head. This tool outputs both formats.
What does x-default do?
The x-default entry points to the page shown to users whose language or region you don't specifically target — often a language selector or your main/global version. It's optional but recommended. Only one x-default is allowed per group, and this tool warns you if you add more than one.
Is my data uploaded anywhere?
No. The tool runs 100% in your browser. Your URLs, language codes, and region codes are never sent to a server — the tags are generated locally with JavaScript. There is no sign-up and no network request.
Does this tool check that my tags actually work on the live site?
No. It builds correctly formatted, self-referencing tags from what you enter, but it can't verify that every page reciprocates or that the URLs return 200. After pasting the tags, validate the live pages with Google Search Console's international targeting report or a crawler.