Hreflang Tag Generator Web & SEO
Generate a valid, reciprocal set of hreflang tags for a page in several languages.
Hreflang Tag Generator is a free online tool that generate a valid, reciprocal set of hreflang tags for a page in several languages. It runs entirely in your web browser using plain JavaScript, so files are processed on your own device and never uploaded to a server. There is no sign-up, no file size limit imposed by the site, no watermark and no paid tier.
- Price
- Free — no account, no quota, no watermark
- Category
- Web & SEO
- Where it runs
- In your browser, on your device
- Files uploaded
- None
- Technology
- plain JavaScript
- Settings
- 4
- Works offline
- Yes, after the first visit
About Hreflang Tag Generator
Hreflang is the most reliably misconfigured piece of technical SEO there is, and nearly all of it reduces to two rules. The set must be reciprocal: every page in the group has to list every other page, including itself, or search engines ignore the lot. And the code is language first, region optional — `en-GB` is valid, `gb-en` is not, and a bare `uk` is not a language at all. Both are checked here, and the codes are validated as you type.
How to use it
- Enter page url pattern, language codes, one per line and x-default points at.
- Adjust the remaining 1 setting if the defaults do not fit your case.
The 4 settings
| Setting | What it does | Default |
|---|---|---|
| Page URL pattern | For example: use {lang} where the code goes | https://example.com/{lang}/pricing/ |
| Language codes, one per line | Free text. | en
en-GB
fr
de
es-ES
ja |
| x-default points at | For example: the language selector or fallback page | https://example.com/ |
| Output as | Choose from 3: <link> tags for <head>, HTTP Link headers, XML sitemap entries. | <link> tags for <head> |
Under the hood
| Runs on | plain JavaScript — runs the whole thing |
| Controls | Page URL pattern, Language codes, one per line, x-default points at, Output as |
Questions
What is x-default for?
The page shown to anyone whose language you do not have a version for. A language selector, or your primary market’s page. It is optional, and worth setting — without it, an unmatched visitor gets whichever version the engine guesses.
Does every page really need to list itself?
Yes. A self-referencing hreflang is part of the specification, and omitting it is the single most common reason a correct-looking set is ignored. The output here includes it.
Head tags, HTTP headers or sitemap?
All three are equally valid; pick one and use it consistently. The sitemap form scales best, because the reciprocal set lives in one file rather than being repeated across every page — which is also the version hardest to get out of sync.
Can I use hreflang for pages that are not translations?
It is for the same content in a different language or for a different region. Two genuinely different pages are not alternates, and marking them as such tells engines something untrue about your site.