Simplify Your Workflow: Search MiniWebtool.
Add Extension
> Hreflang Tag Generator

Hreflang Tag Generator

Generate hreflang tags for multilingual and multiregional websites. Supports HTML link tags, HTTP headers, and XML sitemap formats with built-in validation and smart URL auto-fill.

Hreflang Tag Generator
Paste HTML source code containing <link rel="alternate" hreflang="..."> tags.
Language Code URL

Embed Hreflang Tag Generator Widget

6
Total Tags
5
Languages
x-default
3
Formats
<link rel="alternate" hreflang="en" href="https://example.com/product" />
<link rel="alternate" hreflang="ja" href="https://example.com/ja/product" />
<link rel="alternate" hreflang="ko" href="https://example.com/ko/product" />
<link rel="alternate" hreflang="zh-hans" href="https://example.com/zh/product" />
<link rel="alternate" hreflang="zh-hant" href="https://example.com/zh-tw/product" />
<link rel="alternate" hreflang="x-default" href="https://example.com/product" />
Link: <https://example.com/product>; rel="alternate"; hreflang="en",
      <https://example.com/ja/product>; rel="alternate"; hreflang="ja",
      <https://example.com/ko/product>; rel="alternate"; hreflang="ko",
      <https://example.com/zh/product>; rel="alternate"; hreflang="zh-hans",
      <https://example.com/zh-tw/product>; rel="alternate"; hreflang="zh-hant",
      <https://example.com/product>; rel="alternate"; hreflang="x-default"
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">

  <url>
    <loc>https://example.com/product</loc>
    <xhtml:link rel="alternate" hreflang="en"
               href="https://example.com/product" />
    <xhtml:link rel="alternate" hreflang="ja"
               href="https://example.com/ja/product" />
    <xhtml:link rel="alternate" hreflang="ko"
               href="https://example.com/ko/product" />
    <xhtml:link rel="alternate" hreflang="zh-hans"
               href="https://example.com/zh/product" />
    <xhtml:link rel="alternate" hreflang="zh-hant"
               href="https://example.com/zh-tw/product" />
    <xhtml:link rel="alternate" hreflang="x-default"
               href="https://example.com/product" />
  </url>

  <url>
    <loc>https://example.com/ja/product</loc>
    <xhtml:link rel="alternate" hreflang="en"
               href="https://example.com/product" />
    <xhtml:link rel="alternate" hreflang="ja"
               href="https://example.com/ja/product" />
    <xhtml:link rel="alternate" hreflang="ko"
               href="https://example.com/ko/product" />
    <xhtml:link rel="alternate" hreflang="zh-hans"
               href="https://example.com/zh/product" />
    <xhtml:link rel="alternate" hreflang="zh-hant"
               href="https://example.com/zh-tw/product" />
    <xhtml:link rel="alternate" hreflang="x-default"
               href="https://example.com/product" />
  </url>

  <url>
    <loc>https://example.com/ko/product</loc>
    <xhtml:link rel="alternate" hreflang="en"
               href="https://example.com/product" />
    <xhtml:link rel="alternate" hreflang="ja"
               href="https://example.com/ja/product" />
    <xhtml:link rel="alternate" hreflang="ko"
               href="https://example.com/ko/product" />
    <xhtml:link rel="alternate" hreflang="zh-hans"
               href="https://example.com/zh/product" />
    <xhtml:link rel="alternate" hreflang="zh-hant"
               href="https://example.com/zh-tw/product" />
    <xhtml:link rel="alternate" hreflang="x-default"
               href="https://example.com/product" />
  </url>

  <url>
    <loc>https://example.com/zh/product</loc>
    <xhtml:link rel="alternate" hreflang="en"
               href="https://example.com/product" />
    <xhtml:link rel="alternate" hreflang="ja"
               href="https://example.com/ja/product" />
    <xhtml:link rel="alternate" hreflang="ko"
               href="https://example.com/ko/product" />
    <xhtml:link rel="alternate" hreflang="zh-hans"
               href="https://example.com/zh/product" />
    <xhtml:link rel="alternate" hreflang="zh-hant"
               href="https://example.com/zh-tw/product" />
    <xhtml:link rel="alternate" hreflang="x-default"
               href="https://example.com/product" />
  </url>

  <url>
    <loc>https://example.com/zh-tw/product</loc>
    <xhtml:link rel="alternate" hreflang="en"
               href="https://example.com/product" />
    <xhtml:link rel="alternate" hreflang="ja"
               href="https://example.com/ja/product" />
    <xhtml:link rel="alternate" hreflang="ko"
               href="https://example.com/ko/product" />
    <xhtml:link rel="alternate" hreflang="zh-hans"
               href="https://example.com/zh/product" />
    <xhtml:link rel="alternate" hreflang="zh-hant"
               href="https://example.com/zh-tw/product" />
    <xhtml:link rel="alternate" hreflang="x-default"
               href="https://example.com/product" />
  </url>

</urlset>
Hreflang Tag Map
en en https://example.com/product
ja ja https://example.com/ja/prod…
ko ko https://example.com/ko/prod…
zh-hans zh-hans https://example.com/zh/prod…
zh-hant zh-hant https://example.com/zh-tw/p…
x-default Fallback https://example.com/product
Each page must include hreflang tags pointing to all other language versions (bidirectional).
📲

Install MiniWebtool App

Add to your home screen for instant access — free, fast, no download needed.

           

Want faster & ad-free?

About Hreflang Tag Generator

The Hreflang Tag Generator creates properly formatted hreflang annotations for multilingual and multiregional websites. It supports three implementation methods — HTML link tags, HTTP response headers, and XML sitemaps — and includes smart URL auto-fill, import from existing markup, language presets, and built-in validation to help you avoid common hreflang mistakes that can hurt your international SEO.

How to Use This Tool

  1. Add language versions — For each language version of your page, enter the hreflang language-region code (e.g., en, es, fr-ca) and the full URL. Use the autocomplete suggestions or type your own code.
  2. Use auto-fill (optional) — Enter a base URL and select "Subdirectory" or "Subdomain" pattern to automatically generate URLs for each language entry.
  3. Add x-default — Include an x-default entry pointing to your fallback page (usually your primary language version or a language-selector page).
  4. Generate tags — Click "Generate Tags" to produce output in all three formats. Review any validation warnings.
  5. Copy and implement — Use the tabbed output to copy the format you need. For HTML, paste the tags into the <head> of every language version. For XML sitemaps, download the file and upload it to your server.
👤
User in
Spain
🔍
Search
Engine
🏷️
Reads
hreflang
🇪🇸
Serves
Spanish page

Understanding Hreflang Attributes

Hreflang is an HTML attribute introduced by Google in 2011 to help webmasters indicate the language and geographic targeting of a webpage. When a site has content in multiple languages or regional variations (e.g., English for the US vs. English for the UK), hreflang tags tell search engines which version to display in search results based on the user's language and location.

The hreflang value follows the format language-region, where:

  • Language code — An ISO 639-1 two-letter code (e.g., en for English, es for Spanish, ja for Japanese)
  • Region code (optional) — An ISO 3166-1 Alpha 2 country code (e.g., us for United States, gb for United Kingdom, mx for Mexico)

Special codes like zh-hans (Simplified Chinese) and zh-hant (Traditional Chinese) use script subtags instead of region codes.

Implementation Methods Compared

HTML Link Tags Most Common

Place <link> elements in the <head> section of each page. Simple to implement and works for most websites.

<link rel="alternate"
hreflang="en"
href="https://example.com/" />

Best for: Standard HTML websites with a manageable number of language versions.

HTTP Headers For non-HTML

Send hreflang information in HTTP response headers. Useful for files that don't have an HTML <head>, such as PDFs.

Link: <https://example.com/>;
rel="alternate";
hreflang="en"

Best for: PDF files, non-HTML documents, and sites where you can configure server headers.

XML Sitemap For large sites

Add hreflang annotations to your XML sitemap using xhtml:link elements. Ideal for sites with many pages and language versions.

<xhtml:link rel="alternate"
hreflang="en"
href="https://example.com/" />

Best for: Large websites with hundreds or thousands of multilingual pages.

Common Hreflang Mistakes to Avoid

  • Missing reciprocal tags: Every page referenced in a hreflang tag must link back to all other language versions. If Page A references Page B, Page B must also reference Page A. Unreciprocated tags are ignored by search engines.
  • Missing self-referencing tag: Each page should include a hreflang tag pointing to itself. This confirms to search engines that the page is intentionally part of the hreflang set.
  • Forgetting x-default: Always include an x-default tag to handle users whose language/region doesn't match any specified hreflang tag. Without it, search engines have no fallback instruction.
  • Using wrong language codes: Use ISO 639-1 language codes and ISO 3166-1 Alpha 2 region codes. Common mistakes include using uk for English (UK) instead of en-gb, or jp instead of ja for Japanese.
  • Mixing protocols or domains: All hreflang URLs should use the same protocol (HTTPS preferred) and match the canonical URL exactly. Mismatches between hreflang URLs and canonical tags cause confusion for search engines.

Best Practices

  • Always use absolute URLs (including https://) in hreflang tags, never relative paths.
  • Include a self-referencing hreflang tag on every page.
  • Add the x-default tag pointing to your primary version or language-selector page.
  • Ensure hreflang URLs match the canonical URL of each page exactly.
  • Use only one implementation method per page (don't mix HTML tags with sitemap annotations for the same page).
  • Validate hreflang tags regularly using this tool, Google Search Console, or other SEO audit tools.
  • For pages targeting the same language in different regions (e.g., en-us and en-gb), always include both language and region codes.

Frequently Asked Questions

What are hreflang tags?

Hreflang tags are HTML attributes that tell search engines which language and regional version of a page to show to users. They use the rel="alternate" hreflang="x" attribute to indicate language alternatives, helping search engines serve the correct version to users based on their language and location.

Where should I place hreflang tags?

Hreflang tags can be placed in three locations: in the HTML <head> section as <link> elements, in HTTP response headers, or in an XML sitemap. The HTML head method is most common for standard websites, HTTP headers work well for non-HTML documents like PDFs, and XML sitemaps are ideal for large sites with many language versions.

What is x-default in hreflang?

The x-default value is a special hreflang attribute that designates the default or fallback page for users whose language or region does not match any of the specified hreflang tags. Google recommends always including an x-default tag pointing to your primary language version or a language selector page.

Do hreflang tags need to be reciprocal?

Yes, hreflang tags must be reciprocal (also called bidirectional). If page A links to page B with a hreflang tag, page B must also link back to page A with the corresponding hreflang tag. If the reciprocal link is missing, search engines may ignore the hreflang annotation entirely.

What is the difference between language and region in hreflang?

In hreflang tags, the language code (e.g., en, es, fr) uses ISO 639-1 format and specifies the content language. The optional region code (e.g., us, gb, mx) uses ISO 3166-1 Alpha 2 format and targets a specific country. For example, en-us targets English speakers in the US, while en-gb targets English speakers in the UK.

Reference this content, page, or tool as:

"Hreflang Tag Generator" at https://MiniWebtool.com// from MiniWebtool, https://MiniWebtool.com/

by miniwebtool team. Updated: 2026-03-10

Top & Updated:

Random PickerRandom Name PickerRelative Standard Deviation CalculatorLine CounterSort NumbersFPS ConverterMAC Address GeneratorBatting Average CalculatorRemove SpacesERA CalculatorMAC Address LookupFeet and Inches to Cm ConverterSum CalculatorWord to Phone Number ConverterFacebook User ID LookupPercent Off CalculatorRandom Truth or Dare GeneratorInstagram User ID LookupBitwise CalculatorRandom IMEI GeneratorRandom Quote GeneratorSHA256 Hash GeneratorLog Base 10 CalculatorFirst n Digits of PiNumber of Digits CalculatorSquare Root (√) CalculatorOutlier CalculatorCm to Feet and Inches ConverterSalary Conversion CalculatorRoman Numerals ConverterOn Base Percentage CalculatorQuotient and Remainder CalculatorRandom Number PickerOne Rep Max (1RM) CalculatorPhone Number ExtractorStandard Error CalculatorSaturn Return CalculatorMP3 LooperVideo to Image ExtractorCompound Growth CalculatorSlugging Percentage CalculatorBCD to Decimal ConverterDay of Year CalendarNumber to Word ConverterAI ParaphraserDecimal to BCD ConverterRandom Birthday GeneratorBinary to Gray Code ConverterAI Punctuation AdderText FormatterModulo CalculatorPercent Growth Rate CalculatorPER CalculatorCM to Inches ConverterMedian CalculatorFirst n Digits of eSun, Moon & Rising Sign Calculator 🌞🌙✨Random Superpower GeneratorRemove AccentDay of the Year Calculator - What Day of the Year Is It Today?SHA512 Hash GeneratorExponential Decay CalculatorReverse VideoTime Duration CalculatorAudio SplitterOPS CalculatorRemove Lines Containing...Random Activity GeneratorMaster Number CalculatorScientific Notation to Decimal ConverterBonus CalculatorMerge VideosLove Compatibility CalculatorCompare Two StringsRandom Movie PickerNumber ExtractorRandom Meal GeneratorSort Text By LengthGray Code to Binary ConverterOctal CalculatorBinary to BCD ConverterRandom Group GeneratorLeap Years ListRandom Object GeneratorVideo CropperRatio to Percentage CalculatorIs it a Prime Number?List of Prime NumbersConvolution CalculatorRemove Audio from VideoInvisible Text GeneratorLog Base 2 CalculatorCrossword Puzzle MakerIP Address to Hex ConverterAntilog CalculatorRandom Poker Hand GeneratorURL ExtractorVideo CompressorRandom Credit Card GeneratorPercentage Increase CalculatorEmail ExtractorAdd Prefix and Suffix to TextWHIP CalculatorSort Lines AlphabeticallyHex to BCD ConverterBCD to Binary ConverterLottery Number GeneratorBCD to Hex ConverterList RandomizerBreak Line by CharactersAverage CalculatorPVIFA CalculatorWAR CalculatorHypotenuse CalculatorActual Cash Value CalculatorAngel Number CalculatorRoot Mean Square CalculatorSum of Positive Integers CalculatorSHA3-256 Hash GeneratorAI Sentence Expander📅 Date CalculatorLbs to Kg ConverterHex to Decimal ConverterMAC Address AnalyzerRandom String GeneratorRemove Leading Trailing SpacesAmortization CalculatorMarkup CalculatorPVIF CalculatorName Number CalculatorDecimal to Hex ConverterDaily Time Savings CalculatorLorem Ipsum GeneratorReadability Score CalculatorKeyword Density CheckerBionic Reading ConverterText to Speech ReaderFancy Text GeneratorZalgo Text GeneratorUpside Down Text GeneratorASCII Art GeneratorList Difference CalculatorText Column ExtractorText to SQL List ConverterInvisible Character RemoverStock Average CalculatorPosition Size CalculatorMargin Call CalculatorShort Selling Profit CalculatorFutoshiki GeneratorHashi (Bridges) Puzzle GeneratorSlitherlink Puzzle GeneratorWord Search Puzzle GeneratorCryptogram GeneratorWord Scramble GeneratorWord Ladder GeneratorBingo Card GeneratorConnect the Dots GeneratorTip CalculatorCurrency Converter401(k) CalculatorRoth IRA CalculatorRetirement CalculatorSocial Security Benefits CalculatorPension CalculatorRMD CalculatorSIP CalculatorMutual Fund CalculatorStock Profit Loss CalculatorDividend Reinvestment CalculatorDollar Cost Averaging CalculatorBusiness Loan CalculatorPersonal Loan CalculatorDebt Payoff CalculatorDebt Consolidation CalculatorNet Worth CalculatorBudget CalculatorSavings Goal CalculatorEmergency Fund CalculatorMortgage Payoff CalculatorDown Payment CalculatorFHA Loan CalculatorHELOC CalculatorBreak-Even CalculatorBusiness Valuation CalculatorEmployee Cost CalculatorCrypto Profit/Loss CalculatorBitcoin Investment CalculatorIncome Tax CalculatorTax Bracket CalculatorTax Refund EstimatorCapital Gains Tax CalculatorSelf-Employment Tax Calculator1099 Tax CalculatorW-4 Withholding CalculatorProperty Tax CalculatorEstate Tax CalculatorChild Support CalculatorAlimony CalculatorTax-Equivalent Yield CalculatorRent vs Buy CalculatorRental Property CalculatorClosing Costs CalculatorReal Estate Commission CalculatorHouse Flipping Profit CalculatorHome Equity CalculatorIdeal Weight CalculatorBAC CalculatorProtein Intake CalculatorKeto CalculatorIntermittent Fasting CalculatorWeight Loss CalculatorGFR CalculatorCreatinine Clearance CalculatorBlood Pressure InterpreterHeight Percentile CalculatorLife Expectancy CalculatorBiological Age CalculatorBlood Type CalculatorBody Type CalculatorLean Body Mass CalculatorCarbohydrate CalculatorNet Carbs CalculatorHeart Disease Risk CalculatorCycling Speed CalculatorSwimming Pace CalculatorSteps to Distance CalculatorArmy Body Fat CalculatorStrength Standards CalculatorMarathon Pace CalculatorTriathlon Pace CalculatorBowling Score CalculatorGolf Handicap CalculatorVertical Jump CalculatorPace Zone CalculatorPregnancy Weight Gain CalculatorBaby Growth Percentile CalculatorBreastfeeding Calorie CalculatorGestational Age CalculatorPregnancy Calorie CalculatorRecipe ScalerCooking Unit ConverterRecipe Nutrition CalculatorCups to Grams ConverterMeat Smoking CalculatorTurkey Cooking Time CalculatorPizza Dough CalculatorSourdough CalculatorSous Vide CalculatorAir Fryer ConverterButter to Oil ConverterFresh to Dried Herb ConverterDog Food CalculatorMultiple Fraction CalculatorPuppy Weight PredictorChocolate Toxicity CalculatorDog Pregnancy CalculatorRaw Feeding CalculatorPet Insurance CalculatorDog Life Expectancy CalculatorJSON Formatter/ValidatorRegex TesterDiff CheckerJavaScript Minifier/BeautifierCSS BeautifierHTML BeautifierYAML Formatter/ValidatorCSV to JSON ConverterMarkdown EditorHTML to Markdown ConverterImage to Base64 ConverterCSS Box Shadow GeneratorIP Subnet CalculatorAPI TesterASCII Table ReferenceWebhook TesterSchema Markup GeneratorRobots.txt GeneratorXML Sitemap GeneratorOpen Graph CheckerDomain Age CheckerWHOIS LookupDNS LookupHeadline AnalyzerPage Speed CheckerRedirect CheckerHreflang Tag GeneratorDomain Trust CheckerBroken Link Checker
×

Do us a favor and answer 3 quick questions

Thank you for participating in our survey. Your input will help us to improve our services.

Where exactly did you first hear about us?

What is your favorite tool on our site?

if Other, please specify:

How likely is it that you would recommend this tool to a friend?

NOT AT ALL LIKELYEXTREMELY LIKELY

Likely score: (1-10)