Hreflang Tag Generator: link tags, HTTP headers and sitemap entries
Make hreflang tags for each language version of a page, with checks on codes, return links and x-default.
- Free to use
- Runs in your browser
- No sign-up
List your page groups to make the tags
You get the link tags for each page, the same set as HTTP headers and sitemap entries, and checks on the codes and URLs. Or press Try an example.
Embed this tool on your websiteFree. Paste one code; it runs in your visitors' browsers.
Copy this code into a page of your site. The tool sets no cookies and sends nothing your visitors type to us. Change height="760" if it needs more room.
About the Hreflang Tag Generator
List each page's language versions: a code such as en-IN or hi-IN and the full URL, plus an x-default page if you have one. The tool writes the tags in all three ways Google accepts (link tags for the page head, HTTP Link headers and sitemap entries), with every page listing itself and each other version. It checks the codes, corrects slips such as en_IN and en-UK, and flags pages in two groups, mixed http and https, and groups with only one version. It runs in your browser; nothing is uploaded.
How it works
-
Step 1
Type or paste each version as a code and a full URL, one per line, with an empty line between page groups, or pick the code under Add a version.
-
Step 2
Choose whether each group gets an x-default page, and fix any code or URL the checks flag.
-
Step 3
Copy the link tags into the head of every page in the group, or use the HTTP headers or the sitemap entries instead.
How Google reads hreflang
Google takes localised versions from link tags in the page head, from an HTTP Link header (handy for PDFs) or from a sitemap. Each version must list itself and every other version; when two pages do not point to each other, Google may ignore or misread the tags. URLs must be full, with http or https. Google's guide also says not to combine several versions into one link tag, so the tool writes one tag per version.
Which codes work
A code is a two-letter ISO 639-1 language code, optionally followed by a dash and an ISO 3166-1 alpha-2 region, such as hi-IN. A region on its own does not work, and Google does not guess the language from it. Codes outside those standards, such as es-419, are not supported, and UK has no effect: the code for the United Kingdom is GB. "in" is an old, withdrawn code for Indonesian, not India. x-default marks the fallback page for everyone else.
What this tool cannot do
It does not open your pages, so it cannot see the tags already on them or tell whether a URL works, redirects or is noindex. It knows a short list of common codes (12 Indian languages and a few others); other codes of the right form are kept and flagged for you to check. Google does not use hreflang to work out a page's language: it reads the visible text, so each version must really be in its language. It reads up to 1,000 versions in one run, a limit we set.
Frequently asked questions
Do I need hreflang for English and Hindi pages?
Use it when the same page exists in more than one language or region, for example a Hindi translation of an English page, so Google knows the versions belong together. A site in one language does not need it.
Should I use en or en-IN?
Both are valid. en means English for everyone, and en-IN means English for people in India. Our suggestion: add a region only when you have different versions for different countries, such as en-IN and en-GB pages with different prices. A region on its own, such as IN, does not work.
What is x-default and do I need it?
x-default names the page for visitors whose language matches none of your versions, such as a page where they pick a language. Google recommends it, but the other tags work without it. If you have no such page, you can point it at your main version (our suggestion).
Which of the three methods should I use?
One is enough. Our suggestion: link tags in the head suit most websites, HTTP headers suit files that are not web pages, such as PDFs, and sitemap entries suit sites where you cannot edit each page's head.
Why does every page need the full set of tags?
Google asks each version to list itself and all the other versions. If the Hindi page links to the English page but the English page does not link back, those tags may be ignored. That is why the tool gives one set per group: put the same set on every page in it.
Related reading
Rather have us do it for you?
Tell us about your business and what you want to fix. We reply within one business day.
Talk to us Our service: Technical SEO servicesMore free tools
All tools- Website SEO Audit Crawl up to 50 pages and get a health score, every issue and a 30-day plan.
- Redirect Checker Trace 301/302 redirects, chains and loops to the final URL.
- Robots.txt Tester Test a URL against robots.txt and see which rule blocks or allows it.
- AI Bot Log Analyzer See how AI crawlers crawl your site from your server access log.
Want us to fix what the tool found?
Tell us about your business and what you want to grow. We reply within one business day with next steps, not a sales script.
- A reply within one business day
- A quick look at your site and search visibility before we talk
- Your details are only used to answer your enquiry