Ads Growth Tools
SEOSEOPaid AcquisitionPaid acquisitionProgrammaticWebsite MonetizationProgrammaticApp UAApp MonetizationWebsite monetizationKeyword ResearchSearch IntentApp acquisitionROASCPAApp monetizationCPCLTVAffiliateeCPMRPMRetail MediaAttributionConversion TrackingCreative IntelMMPHeader BiddingDSPSSPRTBAd ViewabilityFill RateASOSKAdNetworkARPDAURewarded VideoAd MediationAffiliateCreative TestingA/B TestingRetargetingLookalike AudiencesCampaign OptimizationBrand SafetySupply Path
SEOSEOPaid AcquisitionPaid acquisitionProgrammaticWebsite MonetizationProgrammaticApp UAApp MonetizationWebsite monetizationKeyword ResearchSearch IntentApp acquisitionROASCPAApp monetizationCPCLTVAffiliateeCPMRPMRetail MediaAttributionConversion TrackingCreative IntelMMPHeader BiddingDSPSSPRTBAd ViewabilityFill RateASOSKAdNetworkARPDAURewarded VideoAd MediationAffiliateCreative TestingA/B TestingRetargetingLookalike AudiencesCampaign OptimizationBrand SafetySupply Path

Free SEO Tools

Hreflang 生成器 / 校验器

Free

Create and validate hreflang link tags for multilingual and multi-regional websites. The generator mode outputs a complete set of `<link rel="alternate" hreflang="...">` tags including x-default, while the validator mode checks your existing tags for common errors like incorrect language codes (en-UK instead of en-GB), duplicate hreflang values, missing x-default declarations, and missing self-referencing tags that cause Google to ignore the entire hreflang cluster.

Setuphreflanginternational SEOmultilingualmulti-regionaltechnical SEOx-default

Hreflang 标签生成器 / Hreflang Tag Generator

生成并验证国际 SEO 的 hreflang link 标签 / Generate and validate hreflang link tags for international SEO

生成的标签 / Generated Tags
<link rel="alternate" hreflang="en-US" href="https://example.com/en/" />
<link rel="alternate" hreflang="zh-CN" href="https://example.com/zh/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

将标签粘贴到 <head> 区域 · Paste tags inside <head> of every page listed

What Is Hreflang?

Hreflang is an HTML attribute — specifically, a <link rel="alternate" hreflang="..."> tag — that tells Google which version of a page to serve to users in specific language and region combinations. It solves a problem unique to multilingual and multi-regional websites: when you publish the same content in multiple languages or for multiple countries, Google needs to know which URL to rank for which audience. Without hreflang, Google may consolidate your URLs incorrectly, serve the wrong language version to users, or treat near-duplicate translated pages as content duplication.

Hreflang is Google's mechanism (Yandex also supports it; Bing does not). It is declared in one of three places: the <head> of each page as link tags, the HTTP response header, or your XML sitemap. This generator produces head <link> tags, the most universally supported implementation method.

For a comprehensive overview of how hreflang fits into broader site architecture decisions, see the technical SEO guide.

Language Codes and Region Codes: Getting Them Right

Hreflang values are composed of two parts: a language code (required) and an optional country code, separated by a hyphen:

hreflang="language-COUNTRY"

Language codes follow ISO 639-1, a two-letter standard:

LanguageCode
Englishen
Spanishes
Frenchfr
Germande
Japaneseja
Simplified Chinesezh
Portuguesept
Koreanko
Arabicar
Italianit

Country codes follow ISO 3166-1 alpha-2, also two letters but always uppercase:

CountryCode
United StatesUS
United KingdomGB
AustraliaAU
CanadaCA
GermanyDE
FranceFR
BrazilBR
MexicoMX
JapanJP
ChinaCN

The most prevalent hreflang error in the wild is en-UK — which is not a valid country code. The United Kingdom's ISO 3166-1 code is GB, not UK. Google silently ignores invalid codes rather than flagging them, which means a site running en-UK for years may never know why UK users keep landing on the wrong page.

The Four Most Common Hreflang Mistakes

1. Missing x-default tag

x-default is a special hreflang value that designates the fallback page for users who do not match any other language or region annotation. If a user in Nigeria visits a site with only en-US and en-GB hreflang tags, Google needs to know which page to serve them. Without x-default, Google makes its own choice — often incorrectly. The x-default URL is typically your homepage or a language-selector page.

<link rel="alternate" hreflang="x-default" href="https://example.com/" />

2. Missing self-referencing tags

Every page in an hreflang cluster must include a tag pointing to itself. If the French page references the English and Spanish versions but forgets to include a tag pointing to its own URL with hreflang="fr", Google considers the entire hreflang cluster invalid and ignores all the annotations. This is the most technically counterintuitive requirement — a page must annotate itself.

3. Non-reciprocal links

Every URL in an hreflang cluster must reference every other URL in the cluster, and every referenced URL must reference back. If the English page references the French page, but the French page does not reference the English page, the cluster breaks. Google calls this a "return tag" requirement — all relationships must be bidirectional.

4. Incorrect placement in sitemaps

When implementing hreflang via XML sitemap (an alternative to head link tags), the xhtml:link alternates must appear inside every <url> block in the sitemap, not just the canonical URL block. The XML Sitemap Generator supports hreflang alternate declarations in sitemap format for sites where head tag implementation is not practical.

Validator Mode: What It Checks

The validator tab on this tool scans an existing set of hreflang tags — paste the full <head> HTML or a URL — and checks for:

  • Invalid language codes (not in ISO 639-1)
  • Invalid country codes (not in ISO 3166-1 alpha-2)
  • en-UK pattern errors (flagged with the correct en-GB alternative)
  • Missing x-default tag
  • Missing self-referencing tag
  • Duplicate hreflang values (two tags with the same language-country combination)
  • Clusters with only one member (hreflang requires at least two URLs to be meaningful)

How to Use the Hreflang Tag Generator

Generator mode:

  1. Enter your URLs — add one row per language/region version of the page. Each row takes a URL, a language code, and an optional country code.
  2. Add x-default — designate which URL serves as the fallback. Usually your primary language homepage.
  3. Generate tags — the tool outputs a complete <link> tag block for every URL, including self-referencing tags for each entry.
  4. Copy and deploy — paste all generated tags into the <head> of every page in the cluster. The same tag block (covering all languages) goes on every version of the page.

Validator mode:

  1. Paste your existing head tags — copy the HTML source from your page's <head> and paste into the validator input.
  2. Run validation — the tool parses each hreflang value and checks against the checklist above.
  3. Review errors — errors are categorized as critical (will break the cluster) or warnings (best practice violations).
  4. Fix and re-test — correct the flagged issues in your CMS or template and re-paste to confirm the cluster is clean.

Keyword Research and Hreflang Strategy

A common misconception is that you can simply translate your top-performing English pages and hreflang them to other markets. In reality, keyword research for international markets often reveals that search demand patterns differ substantially by language. A term that drives 10,000 monthly searches in English may have no meaningful equivalent in German — or the equivalent term may require a completely different content structure to rank.

Before building out an hreflang cluster, validate that search demand exists in the target language and country. If it does not, hreflang tags cannot create organic traffic where no searches exist. International SEO works best when the content strategy is driven by per-market keyword data, not just translated from the primary market.

FAQ

When should I use language-only hreflang (en) vs. language-region (en-US)?

Use language-only tags (en) when you have a single English version intended for all English-speaking markets globally. Use language-region tags (en-US, en-GB, en-AU) only when you maintain genuinely distinct versions for different markets — for example, different pricing in USD vs. GBP, or regionally adapted content. Do not add region variants unless the pages are actually differentiated; mixing language-only and language-region tags for the same language in the same cluster causes ambiguity.

Does hreflang affect rankings within a specific country?

Hreflang tells Google which URL to serve to which audience — it is about URL selection, not ranking improvement. The correctly selected URL still needs to rank on its own merits: backlinks, content quality, page experience, and all the usual ranking factors. Hreflang prevents Google from serving the wrong language version; it does not make any version rank higher.

What happens if Google ignores my hreflang tags?

Google ignores hreflang clusters that contain errors (non-reciprocal links, missing self-references, invalid codes). When this happens, Google falls back to its own language/region detection based on page content, domain TLD, and geographic IP signals. If your pages are showing in the wrong markets, start by validating your hreflang implementation rather than assuming a rankings issue.

Concepts behind this tool

More tools: Free SEO Tools

Free

Robots.txt 测试器

A free robots-txt rule tester that replicates the RFC 9309 matching algorithm used by search engines and major AI crawlers — including GPTBot, ClaudeBot, PerplexityBot, and Google-Extended — to show exactly which paths are allowed or blocked for any user-agent. Paste your file contents, choose a user-agent, enter test URL paths one per line, and instantly see which specific directive controls each result, filling the gap left when Google deprecated its official testing tool in 2023.

Free SEO Tools
Free

Schema 生成器

Generate valid JSON-LD structured data for any page without writing code. Choose from Article, FAQPage, Product, Organization, LocalBusiness, or BreadcrumbList schema types, fill out the form fields, and copy the finished markup into your page head to unlock Google rich results and rich snippets. Every output includes a one-click link to the Google Rich Results Test for immediate compliance validation.

Free SEO Tools
Free

XML Sitemap 生成器

Generate a standards-compliant XML sitemap from any list of URLs without creating an account or uploading files anywhere. Paste URLs one per line, configure optional lastmod, changefreq, and priority values, and enable multilingual mode to add hreflang alternate links before downloading the finished file directly. The tool enforces the 50,000 URL Sitemaps protocol hard limit, highlights malformed or non-HTTP entries before export, and outputs valid XML that Google Search Console and Bing Webmaster Tools accept immediately.

Free SEO Tools