Hreflang Tag Generator
The Hreflang Tag Generator creates the correct set of hreflang link tags for multilingual and multi-regional websites. Add each language and region with its URL, set the x-default fallback, and the tool outputs HTML head tags, an XML sitemap fragment, or HTTP header format with validation for common errors.
Validation
- ok: Configuration looks valid for the fields you entered.
Output
<link rel="alternate" hreflang="en" href="https://example.com/">
<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/">
<link rel="alternate" hreflang="fr-FR" href="https://example.com/fr-fr/">
<link rel="alternate" hreflang="x-default" href="https://example.com/">Hreflang tells Google which version to show users in each region. Mistakes can cause wrong-language pages to rank. Validate implementation with Google Search Console.
How this tool works
The hreflang generator builds the complete cluster of link rel='alternate' hreflang tags required to tell search engines which language-country version of a page to serve to each locale. You enter each URL paired with its language-country code (en-US, es-MX, fr-FR, etc.) and the tool outputs the full tag set for that page. Every page in a hreflang group must include a tag pointing to all other pages in the group, including a self-referential tag pointing to itself. The tool enforces this requirement automatically. Language codes are validated against ISO 639-1 and country codes against ISO 3166-1; invalid combinations are flagged before the tags are generated. An x-default tag, pointing to the fallback URL for users who do not match any specific locale, is toggled separately. Key assumption: hreflang tags must be implemented on every version of the page in the group, not only the default; the tool generates the cluster for one page at a time and the implementation must be repeated across all localized pages. Edge case: hreflang mismatches, where Page A references Page B but Page B does not return-link to Page A, invalidate the entire cluster. Google ignores the tags on both pages. The return-link requirement is the most common implementation failure in hreflang deployments.
Worked example
A site serves English globally, US English with USD pricing, and French for France. Three rows are added plus x-default pointing to the global English page. The full hreflang block is pasted into every regional template so each page self-references and lists all alternates - a requirement Google enforces for hreflang to work correctly.
Frequently asked questions
What is hreflang?
Hreflang is an HTML attribute that tells Google which language and geographic region a specific page is intended for. It helps Google serve the correct language version to users in each market instead of showing a user in France your English page. Tracking this metric alongside conversion data gives a more complete picture of how changes affect actual business outcomes.
What is x-default and when should I use it?
x-default is a special hreflang value for the page shown when no other language or region match is found for a user. Typically this is your global English page or a language-selection landing page. It should be included in every hreflang set. Tracking this metric alongside conversion data gives a more complete picture of how changes affect actual business outcomes.
Where do hreflang tags go?
In the HTML head section of every page in the set, in your XML sitemap under each url entry, or in HTTP response headers. All three methods are accepted by Google. The HTML head method is the most common.
What language codes should I use?
Use ISO 639-1 two-letter language codes (en, fr, de) and optionally append ISO 3166-1 alpha-2 region codes (en-US, en-GB, pt-BR). Language codes are required; region codes are optional and used to distinguish markets that share a language.
What happens if I have a duplicate language code?
Google will ignore all hreflang signals for the affected pages and fall back to its own judgment about which version to serve. The tool flags duplicate language codes in your set before you copy the output.
Does hreflang affect rankings?
Hreflang does not directly improve rankings, but it prevents ranking dilution caused by Google indexing the wrong language version for each market. Getting the correct regional page to rank in each country is its primary benefit.