Hreflang Tag Generator
Generates hreflang link tags for international and multilingual websites. Users add rows specifying language code (from a full list of 65+ languages), optional region code (from a list of 50+ countries), and the corresponding page URL. Supports both XHTML self-closing format and HTML5 format. Includes an x-default URL field for the fallback page shown to users whose language or region is not covered. Output shows ready-to-paste link tags for the HTML head section, one tag per language-region combination.
Tag format:
| Language | Region | Page URL | |
|---|---|---|---|
Generated tags (paste into <head>)
What Is a Hreflang Tag?
A hreflang tag is an HTML link element placed in the head section of a webpage that tells search engines which language and geographic region a page is intended for, and points to the equivalent pages in other languages or regions. The tag was introduced by Google in 2011 specifically to solve a problem that affects multilingual and multinational websites: search engines serving the wrong language version of a page to users in a particular country.
Without hreflang tags, a search engine encountering an English site with separate UK, US, and Australian versions has no reliable way to determine which version should appear in UK search results versus US or Australian results. It may treat the three versions as duplicate content and consolidate ranking signals onto a single version, or it may serve the wrong regional variant to users in each market, resulting in currency mismatches, incorrect shipping information, or content that does not match local legal requirements.
The hreflang attribute uses standard language codes from the ISO 639-1 standard (two-letter codes like en, fr, de) optionally combined with country codes from the ISO 3166-1 alpha-2 standard (two-letter codes like GB, US, FR) to create locale identifiers such as en-GB, en-US, and fr-FR. The x-default value is a special hreflang that designates the fallback page shown to users whose language or region is not covered by any of the specific hreflang values.
According to Google's documentation on hreflang, hreflang tags must be reciprocal: every page in the hreflang set must include a complete set of hreflang tags pointing to all other pages in the set, including a self-referential tag pointing to itself. A partial implementation where some pages in the set lack hreflang tags will cause Google to discount or ignore the signals. The W3C guidance on language tags provides the authoritative reference for correct language code formation.
Hreflang tags are one of three methods Google accepts for indicating alternate language versions: HTML link tags in the head section (which this tool generates), HTTP headers (for non-HTML files like PDFs), and XML sitemap entries. The HTML head approach is the most widely used because it can be added through any CMS that allows head injection without server configuration changes.
How to Use the Hreflang Tag Generator
- Select the tag format: XHTML self-closing (with />) for XHTML documents, or HTML5 (without closing >) for standard HTML5 pages. If unsure, use the XHTML format as it is compatible with both.
- For each language version of your page, add a row: select the language from the dropdown, select the region if applicable (leave blank for language-only targeting), and enter the full absolute URL of that version.
- Enter the x-default URL. This should be your main international homepage or a language selector page. It is shown to users whose language and region do not match any specific hreflang value.
- Click Add language to add more rows for additional language and region combinations.
- Copy the generated tags using the Copy Tags button. Paste them into the head section of every page in your hreflang set, not just one page. Each page must contain the full set of tags including a self-referential tag pointing to itself.
- Validate the implementation using Google's URL Inspection tool in Search Console after deploying, or use a hreflang validation tool to check for missing reciprocal tags.
Hreflang Implementation Methods Compared
| Method | Where Tags Go | Best For | Limitation |
|---|---|---|---|
| HTML head tags (this tool) | Head section of each HTML page | Most websites; CMS with head injection | Must be added to every page individually |
| HTTP headers | Server response headers | PDFs and non-HTML files | Requires server configuration access |
| XML sitemap | Sitemap file submitted to Search Console | Large sites with many URL variants | Sitemap must be kept up to date and submitted |
| No hreflang (relying on URL signals) | None | Single-language sites only | Google may serve wrong version for multi-region sites |
When to Use the Hreflang Tag Generator
The E-Commerce Developer Building a Multinational Store
A developer is building a Shopify store for a UK-based retailer expanding into the US and Australian markets. The store uses three separate storefronts under one domain: example.com/uk/, example.com/us/, and example.com/au/. Each storefront has localised pricing, currency, and shipping information. Without hreflang tags, Google serves the UK version to US and Australian searchers because it has the most domain authority. The developer uses the generator to create hreflang tags for the homepage and top ten category pages, setting en-GB, en-US, and en-AU with the US homepage as the x-default. The tags are added through Shopify's theme.liquid head section and validated in Search Console within a week.
The Multilingual Content Manager Launching French and German Versions
A content manager is expanding a B2B SaaS knowledge base from English-only to include French and German translations of the top 30 articles. Each translated article lives at a separate URL: /en/article-slug/, /fr/article-slug/, and /de/article-slug/. She uses the generator to create hreflang sets for each of the 30 articles: en pointing to the English URL, fr to the French URL, de to the German URL, and x-default pointing to the English version. The tags are pasted into the CMS's article head template so they are automatically applied. After deployment she monitors Google Search Console's International Targeting report to confirm the three language versions are being recognised as a unified hreflang set.
The Technical SEO Auditing a Misconfigured International Site
A technical SEO is investigating why a travel booking site's Spanish pages are being outranked in Spain by the English pages. On inspection, she finds that the existing hreflang implementation is missing reciprocal tags: the English pages point to the Spanish pages but the Spanish pages do not point back to the English pages. This breaks the reciprocal requirement and causes Google to discount the hreflang signals entirely. She uses the generator to produce a complete corrected tag set for both language versions with full reciprocal tags, and the corrected implementation is deployed across both URL sets.
The Local Business Owner Targeting English Speakers in Multiple Countries
A software consultant based in Singapore targets English-speaking clients in the UK, Australia, and Singapore. His site has one English-language domain but different service pages for each market with localised pricing and case studies. He uses the generator to create en-GB, en-AU, and en-SG hreflang tags for each service page, which ensures Google serves the Singapore-specific service page to Singapore searches rather than the UK version which had been dominating despite being less relevant for local searches.
Advanced Hreflang Implementation Patterns
Implementing hreflang at scale on a site with hundreds or thousands of pages requires a systematic approach. For large WordPress or CMS-based sites, the best approach is typically to implement hreflang through the XML sitemap rather than manually adding head tags to each page. The sitemap method uses the same hreflang attribute syntax but placed inside sitemap loc and xhtml:link elements, allowing a single sitemap update to propagate the hreflang signals across the entire site without touching individual page templates. The sitemap must be submitted to Google Search Console to ensure it is processed promptly.
For sites using Next.js, Nuxt, or other JavaScript frameworks with server-side rendering, hreflang tags can be injected into the head of each page through the framework's head management system. In Next.js, the generateMetadata function or the Head component handles this. In Nuxt, the useHead composable manages head content. The advantage of the programmatic approach is that hreflang tags can be generated dynamically based on the available translations for each page, avoiding the problem of including hreflang references to pages that do not yet exist or have been deprecated.
Maintaining hreflang tag sets when pages are added, removed, or have their URLs changed is one of the most common ongoing maintenance challenges with international SEO. When a URL changes in one language variant, the hreflang tags across all other variants must be updated to reference the new URL. Leaving stale hreflang references pointing to redirected or deleted URLs breaks the reciprocal linking requirement and causes Google Search Console to report errors. A process for auditing hreflang tag validity after site changes, ideally automated through a post-deployment check, prevents these errors from accumulating undetected.
Geographic targeting through Search Console provides an additional layer of international SEO configuration that works alongside hreflang tags. For sites using generic top-level domains such as .com or .org, Google Search Console allows you to set a country target for the entire property or for individual subfolders. This geographic targeting signal reinforces the regional intent communicated by the country code in hreflang tags. For sites using country code top-level domains, the ccTLD provides its own strong geographic signal and the Search Console geographic targeting setting is less relevant, though hreflang tags for language targeting remain valuable regardless of the domain structure.
Monitoring hreflang implementation health through Google Search Console's Index Coverage and International Targeting reports should be part of any ongoing international SEO workflow. The International Targeting report shows the current geographic targeting setting for the property and lists any hreflang errors detected during crawling, including missing return tags, invalid language or country codes, and URLs that return errors or redirects. Reviewing this report monthly catches implementation drift before it affects rankings. The URL Inspection tool can be used to check the hreflang tags on specific pages by examining the rendered HTML that Google sees, which may differ from the source HTML on sites using JavaScript-driven head injection.
Common Hreflang Mistakes to Avoid
Missing reciprocal tags is the single most common and most damaging hreflang error. Every page in a hreflang set must include tags pointing to all other pages in the set, including itself. If the English page points to the French page but the French page does not include a tag pointing back to the English page, Google treats the signal as unreliable and may ignore the entire hreflang implementation. The self-referential tag pointing to the page's own URL must also be present.
Using relative URLs instead of absolute URLs in hreflang tags causes implementation failures. Hreflang href values must be complete absolute URLs including the protocol and domain: https://example.com/fr/ not /fr/ or example.com/fr/. Search engines cannot resolve relative URLs from the hreflang tag context in the same way browsers can. Absolute URLs also ensure the tags remain valid if the page is referenced from outside the domain.
Targeting language without region when region is needed leads to imprecise targeting. Using en for a page intended specifically for UK visitors means all English-language users worldwide may be served that page. If you have separate versions for different English-speaking markets, use en-GB, en-US, en-AU, and en-CA rather than a single en tag. The language-only code is appropriate when you have one version that serves all speakers of a language regardless of country.
Implementing hreflang only on the homepage while leaving all other pages without tags creates an incomplete signal that Google discounts. Hreflang must be implemented on every page that has an equivalent in another language or region, not just the homepage. For large sites, the XML sitemap method is often more practical than manually adding head tags to every page individually.
S. Siddiqui
Founder & Editor-in-Chief, YourToolsBase
How I implemented hreflang tags across 40 country pages and stopped Google from showing the wrong language version to international visitors
In March 2026 I was reviewing the international performance of a client's e-commerce site. The site sold the same product range in the UK, Ireland, Australia, and Canada, with separate URLs for each market containing localised pricing, shipping information, and currency. Google was consistently serving the UK version to Australian and Canadian visitors, resulting in confused users landing on pages showing GBP prices and UK-only delivery terms.
I checked the page source for the UK homepage and discovered that hreflang tags were entirely absent. The developer who had built the international site structure had assumed that the ccTLD approach would be sufficient signal for Google, but the site used subfolders rather than country-specific domains, making explicit hreflang annotation essential.
I used the hreflang tag generator to create the correct tag set for all four markets: en-GB for the UK version, en-IE for the Irish version, en-AU for the Australian version, and en-CA for the Canadian version, with the UK homepage set as the x-default. I generated tags for the homepage, the main category pages, and 40 product pages that differed significantly between markets.
The tags went into the CMS head injection field and were live within a day. Over the following four weeks, Google Search Console's international targeting report showed all four country sites correctly configured. Within six weeks, Australian and Canadian search traffic to their respective correct versions had increased by 34 percent, as Google began reliably serving the right language and regional version to users in those markets.
Frequently Asked Questions
What is the x-default hreflang value?
Do I need hreflang tags if I use separate country domains (ccTLDs)?
How many hreflang tags can I have on one page?
Should hreflang tags use canonical or non-canonical URLs?
How long does it take for hreflang tags to take effect?
What language codes should I use for Chinese?
Can I use hreflang for pages with the same language but different content for different regions?
Do hreflang tags affect rankings?
What happens if my hreflang tags contain errors?
Should every page on my site have hreflang tags?
Rate This Tool
Was this tool helpful?
Be the first to rate this tool
About the Author
S. Siddiqui is the founder and editor-in-chief of YourToolsBase, overseeing all content, tool accuracy, and editorial standards.
View full profileRelated Tools
Authoritative Sources
Formulas and data in this tool are based on guidelines from the above sources.