Hreflang Tag Generator
hreflang tags, HTTP header and sitemap with code checks. Runs in your browser.
About this hreflang tag generator
This hreflang generator writes the tags that tell Google which language or country version of a page to show each searcher. Enter each version's code and URL, add an x-default fallback, and get HTML link tags, an HTTP Link header or XML sitemap entries.
Every code is checked against the standards Google uses: ISO 639-1 for the language, ISO 3166-1 for the country and ISO 15924 for the script. Mistakes that silently break hreflang, like en-UK, es-419 or a bare country code, are flagged with the fix. You also see the language name for every code, so bn-BD reads "Bangla (Bangladesh)".
For bigger sites, paste a spreadsheet of URLs and get a full hreflang sitemap. Everything runs in your browser and nothing is uploaded. Once hreflang is in place, the meta tag generator handles the rest of each page's head.
Features
Strict code validation
Each code is checked for a valid 2-letter language, an optional 4-letter script and an optional 2-letter country. Underscores are fixed (en_US to en-US), case is normalised, and withdrawn codes like iw are flagged with their replacement.
Three output formats
HTML <link rel="alternate"> tags for the page head, a Link header for PDFs and other files, and a sitemap where every page gets its own entry listing the whole set, including itself.
Set-level checks
Duplicate codes, relative URLs, a mix of http and https, the same URL used for two languages, a missing x-default, and country versions with no plain-language version to catch everyone else.
Many pages at once
Paste a grid from a spreadsheet: codes across the top, one row per page. You get a sitemap for the whole site or a block of HTML tags for each page.
Import and check existing tags
Paste the hreflang tags from a page's source, a Link header or a sitemap. They load into the editor and the checks run on them, which is the fastest way to audit a site someone else set up.
URL pattern fill
If your URLs follow a pattern like example.com/{lang}/pricing, type it once and every row is filled in. {code}, {lang} and {region} are supported.
How to use the hreflang tag generator
- 1Add each language version's code (en, en-GB, de) and URL, plus an x-default.
- 2Fix any code or URL the checker marks.
- 3Copy the HTML tags, HTTP header or sitemap XML and add it to every page in the set.
When to use it
Launching a second language
Your site is in English and you add German. Enter en and de with their URLs, add x-default, and paste the same two-plus-one tags on both pages.
Separate UK and US pages
Prices and spelling differ, so you target en-GB and en-US. Add plain en too, so readers in Ireland or Australia get a sensible match instead of the fallback.
Fixing Search Console errors
Search Console reports "no return tags" or "unknown language code". Import the tags from both pages and the checker shows which code is wrong or which URL is missing.
Moving hreflang into the sitemap
Templates are hard to change, but the sitemap isn't. Paste your URL grid and replace head tags with one hreflang sitemap, then build the rest of the sitemap for pages that have no translations.
What does hreflang do?
hreflang tells Google that several URLs are versions of the same content for different languages or regions. Google then shows the best match for each searcher: the German page in Germany, the French-Canadian page to French speakers in Canada. It doesn't change rankings. It changes which of your URLs appears.
Without it, Google may show your English page to Spanish speakers, or treat your US and UK pages as near-duplicates and pick one.
What is the correct hreflang format?
A language code, then optionally a script, then optionally a region, joined by hyphens. Google's documentation sets the standards:
- Language: ISO 639-1, two letters. en, de, bn, zh. Required.
- Script: ISO 15924, four letters. zh-Hant, zh-Hans, sr-Latn. Optional.
- Region: ISO 3166-1 alpha-2, two letters. en-GB, pt-BR, bn-BD. Optional.
- x-default: the page for everyone who matches none of the others.
- Not allowed: region alone (us), numeric regions (es-419), reserved codes (UK, EU).
Why is en-UK wrong?
Because UK isn't the United Kingdom's code in ISO 3166-1. The code is GB. Google's documentation names this exact mistake and says reserved codes like UK, EU and UN have no effect, so en-UK tags are ignored. Use en-GB.
Country codes and language codes are different lists, and they often don't match. Japanese is ja, not jp. Czech is cs, not cz. Danish is da, not dk. The checker flags these because jp, cz and dk aren't language codes. Two are sneakier: se is Northern Sami, not Swedish (sv), and kr is Kanuri, not Korean (ko). Both are valid codes, so no validator can tell you meant something else. Check the language name shown under each row.
HTML tags, HTTP header or sitemap: which should I use?
Google treats the three methods as equal, so pick the one that's easiest to keep correct. HTML tags suit most sites with a shared template. The HTTP header is the only option for PDFs and other non-HTML files. A sitemap is often easier on large sites, because you change one file instead of every template.
Use one method per set of pages. If the sitemap and the head tags disagree, you're giving Google two sets of instructions.
Whichever you choose, the same rule applies: every page lists every version including itself, and the links must go both ways. If page A lists page B, page B must list page A, or Google may ignore the pair.
Why use Mavros
| Mavros | Typical upload sites | |
|---|---|---|
| Code validation | ISO 639-1, 15924 and 3166-1 with fixes | Accepts en-UK and es-419 |
| Output | HTML, HTTP header and sitemap | HTML only, or HTML and sitemap |
| Sitemap structure | One entry per page, full set in each | Alternates listed once |
| Existing tags | Import and check | Build from scratch only |
| Many pages | Paste a spreadsheet grid | One page at a time |
| Privacy | Runs in your browser | URLs sent to a server |
Tips
- Use absolute URLs with https://. Relative paths in hreflang are ignored.
- Point hreflang at canonical URLs only. A tag pointing at a redirect or a noindex page is wasted.
- Add x-default. Your main version or a language picker are both fine choices.
- Add a plain language version when you target several countries in that language, so speakers elsewhere don't fall through to x-default.
- Check that each URL actually returns 200. A broken alternate breaks the whole pair; if you're moving pages, set up redirects and update hreflang to the new URLs.
- Translated slugs like /de/preise are fine. hreflang only cares about the URL, not what's in it. For the rest of an international launch, browse the other SEO tools.
Questions
Is hreflang a ranking factor?
No. hreflang doesn't make a page rank higher. It tells Google which of your existing versions to show to a given searcher, so the right language appears in the results.
Do I need x-default?
It isn't required, but it's recommended. x-default tells Google where to send people whose language and region match none of your versions, such as a language picker or your main site.
Should hreflang include a link to the page itself?
Yes. Each page lists every version in the set, including itself. Copy the same block onto every page in the set; that's simpler and it's what Google expects.
Is it en-GB or en-UK?
en-GB. The ISO country code for the United Kingdom is GB. UK is reserved, and Google ignores hreflang values that use it.
Can I use es-419 for Latin America?
No. Google doesn't support numeric region codes like 419. Use es for all Spanish speakers, or list the countries you target, such as es-MX and es-AR.
What does "no return tags" mean?
One page points to another with hreflang, but the other page doesn't point back. Links must go both ways. Add the full set to both pages, or fix the URL if it has a typo or redirects.
Can hreflang point to another domain?
Yes. Alternates can be on different domains, such as example.de and example.fr. Each domain needs the full set, and every URL must be absolute.
Should I put hreflang in the sitemap or in the HTML?
Either works equally for Google. HTML suits sites with one shared template, a sitemap suits large sites, and the HTTP header is for PDFs. Don't mix methods for the same pages.
Is my data uploaded?
No. Code checks use built-in lists and your browser's language data. Nothing is fetched or sent, so you can plan URLs for a site that isn't live yet.