Hreflang Generator

Generate hreflang tags for multilingual and multi-regional websites

Language Versions

Add each language/region version of your page. Include a URL for every language, including the current page. Google recommends including an x-default for international users.

Usually your English or primary language version
Generated Code
HTML Link Tags
XML Sitemap Entry
HTTP Header

Privacy First

All tag generation happens locally in your browser. No URLs or data are sent to any server. Your website information remains completely private.

About Hreflang Tags

Hreflang tags tell search engines which language and regional version of a page to show to users based on their location and language preferences. This is essential for multilingual websites and websites targeting different countries.

When to Use Hreflang

Hreflang Format

The hreflang value uses ISO 639-1 language codes, optionally combined with ISO 3166-1 Alpha-2 country codes:

Implementation Methods

There are three ways to implement hreflang:

1. HTML Link Elements

<link rel="alternate" hreflang="en" href="https://example.com/en/page" />
<link rel="alternate" hreflang="es" href="https://example.com/es/page" />
<link rel="alternate" hreflang="x-default" href="https://example.com/page" />

2. XML Sitemap

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

3. HTTP Headers

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

Important Rules

  1. Hreflang must be reciprocal - each page must link to all versions including itself
  2. Use absolute URLs, not relative paths
  3. All linked pages must return 200 status codes
  4. Use consistent URL format across all versions
  5. Include x-default for a catchall fallback
  6. Don't use hreflang for content that's only slightly different

Related Utilities

Explore our other free tools: JSON Formatter, Base64 Encoder, Password Generator, UUID Generator, and QR Code Generator.