Hreflang Generator
Enter each language version (code and URL): the tool validates the codes, adds x-default and outputs the same block to paste on every version.
Privacy and cost
This tool runs in your browser. What you type or paste is not sent to our servers and it costs nothing to use.
How it works
- Add one row per version: a language-region code (fr-FR, en-GB, es…) and the full page URL.
- Enter the x-default URL, the fallback for languages you do not cover.
- Copy the result as HTML <link> tags, as an XML sitemap with xhtml:link, or as an HTTP Link header, to use on every version.
Example
Three versions (fr-FR, en-GB, es-ES) and the x-default URL https://example.com/ produce 4 tags: <link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/" />, then en-GB, es-ES and x-default. If you type "en-UK" the tool rejects the code and suggests "en-GB".
What the result means
hreflang tells Google which version of a page matches which language or region. Every version must list all the others and itself (return links), with absolute URLs, or the annotations are ignored. x-default marks the fallback version. Google treats hreflang as a signal, not a directive.
Common problems this tool helps with
- Made-up or misspelled codes (en-UK, fr_FR, jp) that search engines do not recognise.
- Versions that do not reference each other, or lack a self-reference.
- Relative URLs or fragments in href values.
- A hreflang set that is not identical on every page of the group.
Frequently asked questions
What does x-default mean?
It is the fallback page for users whose language or region matches no version: often a language selector or the main version. It is recommended but optional.
Should hreflang go in the HTML, the sitemap or the header?
One method is enough. HTML suits small sites, an XML sitemap suits big catalogues, and an HTTP header suits non-HTML files such as PDFs.
Can I use a country code alone, like "fr" for France?
"fr" is a language code (French). To target a country, combine language and region: fr-FR for France, fr-CA for Canada. A country on its own is not valid.
Related tools
- Hreflang ValidatorEnter a URL or paste the HTML: the tool reads the hreflang tags and the Link header, checks every code and spots the classic mistakes.Free · no account needed
- Language Tag Checker (BCP 47)Paste your codes, one per line: the tool validates them, fixes the casing, catches common mistakes and tells you whether hreflang accepts them.Free · runs in your browser
- International SEO URL PlannerList your markets (language-region) and answer five questions: the tool recommends a URL structure, proposes the addresses and compares the three options.Free · runs in your browser
- XML Sitemap GeneratorPaste your URLs, one per line: the tool outputs a valid, correctly escaped sitemap.xml and splits it with an index if you go over the limits.Free · runs in your browser
- Canonical Tag GeneratorPaste a page URL: the tool cleans it (https, tracking parameters, fragment, index file, trailing slash) and outputs the canonical tag and the HTTP header.Free · runs in your browser
- Hreflang Live AuditEnter a URL: the tool reads its hreflang tags (HTML and HTTP Link header), then visits up to eight alternates to confirm they respond and link back to your page.Free account · 3 live checks/day