hreflang Generator + Linter

Most broken hreflang deployments fail the same way: page A lists page B, but B never lists A back. Build the set here and every URL references every other and itself, so the set is bidirectional by construction — that mistake can't happen. A linter flags wrong codes, duplicates, and missing fallbacks as you type.

Example data — replace with your own

One row per locale version of the same page. Paste a URL with /de/ or a de. subdomain and the locale fills itself in. Use arrow keys to move between cells; Enter on the last row adds a new one. The optional per-row x-default lets each page point unmatched users somewhere different (e.g. a localized language selector) — leave it blank to use the shared one below.

hreflangURLx-default (optional, per page)Remove
What this result means ↓
Add a locale and URL above to see output.

Runs entirely in your browser — nothing you paste is uploaded or stored. Anonymous run-level outcome counters may be used for aggregate research; URLs, domains, IPs, and identifiers are never included, and no statistic is released below 100 runs.

Check a live URL

Fetch a page you've already deployed: we read its live hreflang annotations, then fetch each declared alternate (up to 25) to verify return links and self-references.

Sample report Example data — real, generator-verified result

A US and UK English site, with a generic en fallback and an x-default, produces head tags like:

<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" href="https://example.com/us/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

…and running that cluster through the built-in linter reports:

  • Codes are normalized for you. Type en-us or en-US — the generator always emits the uppercase region form (en-US), so casing typos never become a problem.
  • The generic en is what makes this clean. It catches English speakers outside the US and UK who'd otherwise match nothing — see regional variants without a generic fallback.
  • x-default catches everyone else — see missing x-default for what happens without it.
  • Bidirectionality isn't visible in one page's tags — but because this generator emits the same complete block on every page in the set, every listed URL also lists this one back, automatically.
  • Try breaking it: paste en-uk instead of en-gb and the linter flips to an error pointing at the fix — see code format.

How to use it

  1. Add a row per page and a column per locale, then fill in the URL for each language/region version.
  2. Optionally set an x-default (per row) and let the tool auto-detect locales from your URLs, or paste an existing sitemap to import a cluster.
  3. Copy the output in whichever form you need — head tags, sitemap XML, or HTTP Link headers. Every page gets the complete, bidirectional, self-referencing cluster.
  4. Paste your live markup (or check a URL) into the linter to catch the common mistakes before you ship.
Feedback
Report a bug

Found something broken in Hreflang Generator? Let us know what happened — this goes straight to a private triage queue, not a public list.

What will be sent
 No tool inputs, uploads, pasted source, complete results, query parameters, or URL fragments are attached automatically. You can edit or remove the selected passage above. Browser and anti-abuse metadata is processed for spam prevention. 

Checks run from our server; we fetch the URL you enter and don't keep the results. Anonymous aggregate outcomes feed our research posts; checked domains are counted once via an anonymized hash, never stored in the clear. Anonymous run-level outcome counters may be used for aggregate research; URLs, domains, IPs, and identifiers are never included, and no statistic is released below 100 runs.

How it works (and how hreflang breaks)

Choose a hreflang delivery format

HTML head tags

Use it when: you control the HTML templates for ordinary web pages.

Usually the clearest choice: render the full same cluster in every page head.

XML sitemap

Use it when: templates are hard to change or you manage many URL variants centrally.

Use xhtml:link entries consistently and keep the sitemap accessible to crawlers.

HTTP Link header

Use it when: the alternate is a PDF or another non-HTML resource.

This is the practical option for files that have no HTML head. Avoid mixing methods without a reason.

hreflang tells search engines which language/region versions of a page exist so each searcher gets the right one. Three delivery methods are equivalent: <link rel="alternate"> tags in the <head>, xhtml:link entries in an XML sitemap, or HTTP Link headers (the only option for PDFs and other non-HTML files). Pick one method per page — mixing them invites conflicts.

The two rules that break most implementations: every page must include a self-referencing entry, and every pair must be bidirectional — if A lists B, B must list A back or the pair is ignored. Because this generator emits the complete cluster on every page, both hold automatically.

Regional variants without a generic fallback

If you publish en-US and en-GB but no plain en, English speakers in Australia, Ireland, or India match nothing and Google picks for them. Add a generic en entry (it can point at whichever regional page you treat as the default).

Missing x-default

x-default names the page for users who match no declared locale — typically your language selector or your primary version. It's optional, and this tool only warns about it, but explicit beats letting the algorithm choose.

A standalone language-selector page needs the annotations too: place the same head-tag block on it — the x-default line is its self-reference, so the cluster stays bidirectional. In the sitemap output, a selector URL that isn't one of the locale pages automatically gets its own annotated <url> entry.

x-default is also a per-page annotation: pages in the same cluster may point at different x-defaults — the French page at a French-language selector, the English page at an English one. Use the per-row x-default column for that; when pages differ, the head-tag and Link-header output switches to one block per page, and each distinct selector gets its own annotated sitemap entry.

Mixed http/https and inconsistent trailing slashes

hreflang URLs must match the canonical URL exactly. If half your entries say http:// or drop the trailing slash your site redirects to, those alternates point through redirects — Google often discards them. Use the final, canonical form of every URL.

Deprecated language codes

A few ISO 639-1 codes were renamed and linger in old CMS exports: inid (Indonesian), iwhe (Hebrew), jiyi (Yiddish). Search engines mostly tolerate the old forms, but use the modern codes.

Code format

Values are language or language-REGION: ISO 639-1 language (two letters) plus optional ISO 3166-1 alpha-2 region. The classic trap is en-uk — the United Kingdom's region code is GB. Script subtags like zh-Hant / zh-Hans are also valid. Underscores (en_US) are not. Matching is case-insensitive, so casing is cosmetic.

Browse language and region codes

Search the ISO 639-1 language and ISO 3166-1 region codes the generator accepts. Deprecated language aliases are shown with their replacement.

Languages (188)

aaabaeafakamanarasavayazbabebgbhbibmbnbobrbscacechcocrcscucvcydadedvdzeeeleneoeseteufafffifjfofrfygagdglgngugvhahehihohrhthuhyhziaidieigiiikin → idioisitiuiw → hejaji → yijvkakgkikjkkklkmknkokrkskukvkwkylalblglilnloltlulvmgmhmimkmlmnmo → romrmsmtmynanbndnengnlnnnonrnvnyocojomorospapiplpsptqurmrnrorurwsascsdsesgsiskslsmsnsosqsrssstsusvswtatetgthtitktltntotrtstttwtyugukuruzvevivowawoxhyiyozazhzu

Regions (249)

ADAEAFAGAIALAMAOAQARASATAUAWAXAZBABBBDBEBFBGBHBIBJBLBMBNBOBQBRBSBTBVBWBYBZCACCCDCFCGCHCICKCLCMCNCOCRCUCVCWCXCYCZDEDJDKDMDODZECEEEGEHERESETFIFJFKFMFOFRGAGBGDGEGFGGGHGIGLGMGNGPGQGRGSGTGUGWGYHKHMHNHRHTHUIDIEILIMINIOIQIRISITJEJMJOJPKEKGKHKIKMKNKPKRKWKYKZLALBLCLILKLRLSLTLULVLYMAMCMDMEMFMGMHMKMLMMMNMOMPMQMRMSMTMUMVMWMXMYMZNANCNENFNGNINLNONPNRNUNZOMPAPEPFPGPHPKPLPMPNPRPSPTPWPYQARERORSRURWSASBSCSDSESGSHSISJSKSLSMSNSOSRSSSTSVSXSYSZTCTDTFTGTHTJTKTLTMTNTOTRTTTVTWTZUAUGUMUSUYUZVAVCVEVGVIVNVUWFWSYEYTZAZMZW

Frequently asked questions

Where do hreflang tags go — the head, the sitemap, or an HTTP header?

Any of the three, and they are equivalent — but pick one method per page. Use <link rel="alternate"> tags in the HTML head, xhtml:link entries in an XML sitemap, or an HTTP Link header (the only option for non-HTML files like PDFs). Mixing methods on the same page invites conflicts.

What is x-default and do I need it?

x-default names the page to serve users who match none of your declared locales — typically a language selector or your primary version. It is optional, but explicit is better than letting the algorithm choose, so it is recommended for most sites.

Why are my hreflang tags being ignored?

Almost always one of three things: the annotations are not bidirectional (page A lists B but B does not list A back), a page is missing its self-referencing entry, or the URLs do not match the canonical form (http vs https, or a trailing slash your site redirects) so they point through redirects. This generator emits the complete bidirectional cluster with self-references to prevent the first two.

Do hreflang and canonical tags conflict?

They must agree. Each language version should have a self-referential canonical (pointing to itself, not to another language), and every hreflang URL must be the canonical form of that page. A hreflang that points at a non-canonical or redirecting URL is frequently dropped.

Is en-uk a valid hreflang value?

No. The region code for the United Kingdom is GB, so use en-gb. hreflang values are an ISO 639-1 language code plus an optional ISO 3166-1 alpha-2 region code; en-uk is the single most common mistake.

Feature requests for Hreflang Generator

Upvote what you want most. New ideas can be submitted from the floating Feedback menu; requests appear here once approved, and the most-wanted rise to the top.

Loading…

➕ Request a feature

New requests are reviewed before they appear here.

Next stepSEO Incident Simulator — practice the same investigation on labeled fixtures.

حول الأداة

معظم hreflang deployments break لأن صفحة واحد روابط إلى B لكن B أبدًا روابط رجوع. بناء واحد bidirectional-by-construction مجموعة هنا, linted باعتباره أنت اكتب.

معظم معطّل hreflang deployments يفشل ال نفس way: صفحة واحد قوائم صفحة B, لكن B أبدًا قوائم واحد رجوع. بناء ال مجموعة هنا و كل عنوان URL إحالات كل آخر و نفسه, لذلك ال مجموعة هو ثنائي الاتجاه بواسطة construction — ذلك خطأ لا يمكن يحدث. واحد مدقق شكلي علامات خاطئ رموز, مكررات, و مفقود بدائل احتياطية باعتباره أنت اكتب.

الميزات

  • أنشئ مكتمل ثنائي الاتجاه, self-referencing hreflang عناقيد.
  • رأس وسوم, XML خريطة الموقع إدخالات, و HTTP رأس رابط مخرجات.
  • Single-page, bulk-template, و CSV أو خريطة الموقع استيراد سير عمل.
  • حي linting من أجل خاطئ لغة أو منطقة رموز, مكررات, و مفقود بدائل احتياطية.
  • اختياري x-default per صف مع تلقائي لغة اكتشاف.
  • Client-side إنشاء بالإضافة محدود حي عنوان URL تحقّق.

كيفية العمل

hreflang يخبر بحث محركات أي لغة و منطقة versions من واحد صفحة يوجد لذلك كل searcher يحصل ال الصحيح واحد. Three تسليم أساليب هي مكافئ: رابط وسوم في ال HTML رأس, xhtml:رابط إدخالات في واحد XML خريطة الموقع, أو HTTP رابط رؤوس من أجل PDFs و آخر non-HTML ملفات. كل صفحة يجب يشمل واحد self-referencing إدخال, و كل زوج يجب يكون ثنائي الاتجاه — إذا واحد قوائم B, B يجب قائمة واحد رجوع أو ال زوج هو متجاهل. لأن هذا مولّد يصدر ال مكتمل عنقود على كل صفحة, كلاهما يحتفظ تلقائيًا. ال مدقق شكلي يطبع لغة و منطقة رموز و علامات مكررات, مفقود بدائل احتياطية, و non-أساسي أو غير قابل للوصول عناوين عنوان URL قبل أنت إطلاق.

القيود

  • ال مولّد يصدر ال تعليقات أنت وفّر; إنه لا يمكن ينشئ واحد صفحة أساسي, قابل للوصول, translated, أو مؤهل من أجل واحد بحث نتيجة. بحث محركات ما زال يقيّم محتوى, إشارات العنوان الأساسي, عمليات إعادة التوجيه, و فعلي صفحة availability, و x-default هو اختياري بدلًا من واحد يضمن من اختيار.

الأسئلة الشائعة

حيث يفعل hreflang وسوم go — ال رأس, ال خريطة الموقع, أو واحد HTTP رأس?

أي من ال three, و هم هي مكافئ — لكن اختر واحد طريقة per صفحة. استخدم <رابط rel="بديل"> وسوم في ال HTML رأس, xhtml:رابط إدخالات في واحد XML خريطة الموقع, أو واحد HTTP رأس رابط (ال فقط option من أجل non-HTML ملفات مثل PDFs). Mixing أساليب على ال نفس صفحة يدعو تعارضات.

ما هو x-default و يفعل I يحتاج إنه?

x-default أسماء ال صفحة إلى يخدم مستخدمون من تطابق لا شيء من الخاص بك معلن locales — typically واحد لغة selector أو الخاص بك رئيسي إصدار. إنه هو اختياري, لكن صريح هو أفضل من letting ال خوارزمية اختر, لذلك إنه هو موصى به من أجل معظم مواقع.

لماذا هي my hreflang وسوم يكون متجاهل?

تقريبًا دائمًا واحد من three أشياء: ال تعليقات هي ليس ثنائي الاتجاه (صفحة واحد قوائم B لكن B يفعل ليس قائمة واحد رجوع), واحد صفحة هو مفقود الخاص به self-referencing إدخال, أو ال عناوين عنوان URL يفعل ليس تطابق ال أساسي form (HTTP vs HTTPS, أو واحد لاحق شرطة مائلة الخاص بك موقع عمليات إعادة التوجيه) لذلك هم نقطة من خلال عمليات إعادة التوجيه. هذا مولّد يصدر ال مكتمل ثنائي الاتجاه عنقود مع self-references إلى يمنع ال الأول اثنان.

يفعل hreflang و أساسي وسوم تعارض?

هم يجب يوافق. كل لغة إصدار ينبغي يحتوي واحد self-referential أساسي (إشارة إلى نفسه, ليس إلى آخر لغة), و كل hreflang عنوان URL يجب يكون ال أساسي form من ذلك صفحة. واحد hreflang ذلك يشير في واحد non-أساسي أو إعادة التوجيه عنوان URL هو frequently مسقَط.

هو en-uk واحد صالح hreflang قيمة?

لا. ال منطقة رمز من أجل ال متحد Kingdom هو GB, لذلك استخدم en-gb. hreflang قيم هي واحد ISO 639-1 لغة رمز بالإضافة واحد اختياري ISO 3166-1 alpha-2 منطقة رمز; en-uk هو ال مفرد معظم شائع خطأ.