Hreflang generator
Generate and validate multilingual and multi-regional hreflang annotations for international SEO directly in your browser. Nothing is sent to any server or crawler. Map localized pages with ISO 639-1 language codes and optional ISO 3166-1 region codes, set x-default fallback landing pages, validate against common syntax errors, and export clean HTML tags, XML sitemap markup, or HTTP headers.
Client-only hreflang generation. All tags and validation rules are processed locally in your browser. No URLs or domains are sent anywhere.
Language and Regional Alternates
Define the language/region code (ISO 639-1 / ISO 3166-1) and full absolute URL for each alternate page.
<!-- Language and Regional Alternates (Hreflang) --> <link rel="alternate" hreflang="en" href="https://example.com/" /> <link rel="alternate" hreflang="es" href="https://example.com/es/" /> <link rel="alternate" hreflang="fr" href="https://example.com/fr/" /> <link rel="alternate" hreflang="de" href="https://example.com/de/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />
Hreflang Implementation Rules:
- Reciprocal Confirmation: Every alternate page in this cluster must contain the exact same set of hreflang tags, including a self-referencing tag for itself.
- Canonical Alignment: Each alternate page should canonicalize to its own self-referencing URL, not to the primary language page.
- x-default Purpose: Used when no user language or region matches the specific targets (e.g. international users or language selectors).
Example
Global SaaS landing page in English, Spanish, and French
Enter en (https://example.com/), es (https://example.com/es/), fr (https://example.com/fr/), and x-default (https://example.com/). The generator outputs 4 valid HTML link tags and an XML sitemap xhtml:link block with duplicate checks.
Related: Schema markup generator, UTM generator, Robots.txt generator
FAQ
- What is an hreflang tag in SEO?
- The hreflang attribute tells search engines (like Google and Bing) which language and regional version of a webpage to display to searchers based on their geographic location and browser language settings.
- What is the purpose of the x-default hreflang tag?
- The x-default annotation specifies a fallback page for users whose language or region is not specifically targeted, such as international users or an interactive country selector page.
- Are relative URLs allowed in hreflang?
- No. Search engines require fully qualified absolute URLs including the protocol (https://) and domain. Relative paths like /es/ or page.html are invalid in hreflang.
- What is the return link (reciprocal link) requirement?
- Hreflang annotations must be reciprocal. If Page A links to Page B as an alternate, Page B must link back to Page A. The easiest way to ensure compliance is to place the exact same set of hreflang tags on all alternate pages in the group.
- Why should I avoid using 'en-UK'?
- In the ISO 3166-1 standard, the country code for the United Kingdom is 'GB', not 'UK'. 'uk' in ISO 639-1 is actually the language code for Ukrainian. Use 'en-GB' for British English.
- Can hreflang be implemented in XML sitemaps instead of HTML head?
- Yes. For large multilingual websites, adding xhtml:link elements directly inside your XML sitemap avoids page weight overhead and simplifies maintenance across tens of thousands of pages.
- How do I create hreflang tags without this tool?
- For HTML: in the <head> of each alternate page, add <link rel="alternate" hreflang="[code]" href="[absolute_url]" /> for every language variant plus a self-referencing tag for the current page and an optional x-default tag. For XML sitemaps: nest <xhtml:link rel="alternate" hreflang="[code]" href="[url]" /> inside each <url> entry under the xhtml namespace.