hreflang Generator
SEO Tools
Build the hreflang <link> tag set for a multilingual or multi-regional site. Validates BCP 47 codes and flags missing x-default.
Runs entirely in your browserAbout hreflang Generator
If your site serves users in multiple languages or regions, hreflang tags tell Google which URL to show each user. A French user shouldn't land on your English page when you have a French alternative; an Australian user shouldn't see your US page when you have an Australian one. Done right, hreflang routes search traffic to the localized URL that matches the user's language and location.
The tricky part is reciprocity — every variant in your cluster must reference every other variant, including itself. Miss one link and Google may ignore the entire group. This generator handles that by treating your list of variants as a complete cluster and producing a single `<link rel="alternate">` set that you place on every page in the cluster. It validates BCP 47 language tags, flags missing or duplicate codes, and requires exactly one x-default URL (the fallback for users whose language doesn't match any explicit variant). Output is plain HTML; everything happens in your browser.
How to use
- 1
Add a row for each language/region variant
Each row is one alternate URL. Use BCP 47 codes: 'en', 'en-US', 'es', 'es-MX', 'fr-CA', 'zh-Hant', etc. The datalist suggests common ones.
- 2
Pick exactly one x-default
Click the radio button on whichever URL should be the fallback for users whose language doesn't match any explicit row. Usually your English or generic page.
- 3
Watch the warnings
The validation panel flags duplicate codes, malformed BCP 47 tags, missing x-default, or too-small clusters (under 2 variants).
- 4
Copy the output to every page in the cluster
Paste the same tag set into the <head> of every URL in the variant set — including the page that lists itself. Reciprocity matters.
Examples
English + Spanish cluster
Output
<link rel="alternate" hreflang="en" href="https://example.com/">
<link rel="alternate" hreflang="es" href="https://example.com/es/">
<link rel="alternate" hreflang="x-default" href="https://example.com/">Region-specific (US, UK, Australian English)
Output
<link rel="alternate" hreflang="en-US" href="https://example.com/us/">
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/">
<link rel="alternate" hreflang="en-AU" href="https://example.com/au/">
<link rel="alternate" hreflang="x-default" href="https://example.com/">Frequently asked questions
Do I need hreflang if all my pages are in English?+
Not for language, but possibly for region. If you have separate `/uk/` and `/us/` versions because pricing or shipping differs, hreflang tags with `en-GB` and `en-US` keep Google from showing UK shoppers the US prices. Single-language single-region sites don't need it.
What's x-default and why is it required?+
x-default is the URL Google shows users whose language/region doesn't match any explicit variant. Without it, Google falls back to whichever variant ranks best for the query, which may not be what you want. Pick whichever URL is the safest default — usually your primary English version or a language-selector landing page.
Does hreflang only need to be in HTML?+
No — you can also declare hreflang in your sitemap.xml or via HTTP `Link:` headers. Choose one format and stick to it across your site to avoid contradicting yourself.
What if two variants point to the same URL?+
That's fine. Two regional variants of the same language often share a single canonical URL (e.g. `en-US` and `en-CA` both pointing to `/en/`). The tags are still informative.
Why do I need to include the current page's own hreflang?+
Reciprocity. Google validates that every page in the cluster lists every other page including itself. Missing self-references are the #1 reason hreflang clusters fail validation.
Can I use country-only codes like 'us' or 'gb'?+
No. hreflang requires language as the primary subtag. Use `en-US`, `en-GB`, etc. — language first, then optional region.
Related tools
Meta Tag Generator
Build a complete set of HTML meta tags — basic SEO, Open Graph, Twitter Cards, viewport — with character-count warnings.
SERP Snippet Preview
Preview how your title, URL, and meta description render in Google search results — desktop and mobile.
Readability Score
Score your content with six readability formulas — Flesch, Gunning Fog, SMOG, Coleman-Liau, ARI.
Keyword Density Analyzer
Analyze 1-, 2-, and 3-word phrase frequency and density in your content with stopword filtering.
Robots.txt Generator
Build a valid robots.txt visually with user-agent groups, allow/disallow rules, and sitemap URLs.
Robots.txt Tester
Test which URLs your robots.txt allows or blocks. Multi-path testing with rule-match explanation.