Custom Web Audits
Run Audit Demo Audit Audit Types Free Tools Pricing What We Analyze 🔒 Login
← All free tools
🌍

Hreflang Tag Generator

Generate a correct hreflang tag template with x-default, ready to fill in with your language and region URLs so Google serves the right version to each visitor.

⚡ Interactive demo — sample data
Generated an hreflang template with x-default plus four example locales. Swap in your real translated URLs before publishing.
x-default tag created, pointing at the reference URL as the fallback Looks good
Language tags built with valid ISO 639-1 codes (en, es, fr) Looks good
Region example included with ISO 3166-1 code (en-gb) Looks good
All hrefs are absolute, canonical URLs — no relative paths Looks good
Reminder: add this block to every page in the set, each referencing all alternates including itself Warning

About this tool

Generate a correct hreflang tag template with x-default, ready to fill in with your language and region URLs so Google serves the right version to each visitor.

How it works

Enter the page URL
Paste the URL of a page that exists in more than one language or region. We use it as the canonical reference and build an hreflang block around it, including the all-important x-default entry.
Review the generated hreflang tags
You get a complete set of <link rel="alternate" hreflang="…"> tags — one per language/region plus x-default — with example locales filled in so you can see the exact pattern Google expects before you customize it.
Swap in your real URLs and add to your <head>
Replace the example locales and URLs with your actual translated pages, then paste the block into the <head> of every page in the set. Each page must list the whole set, including itself.

What we check

Common issues we catch

Where this matters

Frequently asked questions

What is hreflang?
Hreflang is an HTML annotation that tells search engines which language and region a page is for, and links it to its equivalents in other languages. It ensures a French user sees your French page and a UK user sees your UK page, and stops engines from treating translations as duplicate content.
What is the x-default tag for?
x-default specifies the fallback version to serve when none of your language/region tags match the user — for example a visitor whose language you don't publish. It's commonly set to a global English page or a language-selector landing page so you control that fallback rather than leaving it to chance.
Do I really need to list every page in the set on every page?
Yes. Hreflang must be bidirectional and complete: each page in a cluster references all the alternates, including itself. If even one page omits a return tag, search engines may distrust and ignore the whole cluster, so completeness matters more than anything else.
What's the difference between a language code and a region code?
The language code (ISO 639-1, like en or es) is required and identifies the language. The region code (ISO 3166-1 Alpha-2, like gb or mx) is optional and narrows it to a country, written as language-REGION such as en-gb. Use language alone unless you genuinely have country-specific content.
Where do I put the hreflang tags?
The simplest place is the <head> of each page, which is what this tool generates. You can alternatively put them in your XML sitemap or in HTTP headers — useful for non-HTML files or very large sites. Pick one method and apply it consistently across the whole set.
Why is my hreflang being ignored?
The usual culprits are missing return tags, invalid codes (like en-uk instead of en-gb), relative instead of absolute URLs, or a canonical tag pointing to a different language. Fix those, confirm every page references the full set, and re-test in Search Console's international targeting reports.
Does hreflang help my rankings?
It doesn't boost rankings on its own, but it ensures the right version ranks for the right audience and prevents your translations from competing with each other as duplicates. For international sites that's the difference between showing the correct page and showing the wrong one or none at all.
Can I generate hreflang for more than the example languages?
Yes. The output is a template with a few example locales — add as many <link rel="alternate"> lines as you have versions, each with the correct language (and optional region) code and that version's absolute URL. Just make sure every page in the set lists all of them.

This is one of several free SEO tools from Custom Web Audits. For a complete, prioritized analysis of your whole website, run a full audit.