Add each language or regional version of a page and generate valid hreflang <link> tags for your HTML <head>, or the equivalent XML sitemap block. Includes a common language/region code reference.
Add at least two URLs with language codes to generate hreflang tags.
Hreflang is an HTML and sitemap annotation, introduced by Google in 2011 and now supported by other major search engines as well, that declares the relationship between multiple URLs serving the same content in different languages or to different regions. Without it, a multilingual or multi-region site risks two related problems: search engines may show the wrong language version to a given searcher, and separate language versions of essentially the same content can end up competing against each other in search results or being flagged as duplicate content, diluting the ranking signal that would otherwise concentrate on a single, correctly-targeted version per audience.
A hreflang declaration is fundamentally about a set of URLs, not a single one — every page in the set must declare hreflang links to every other page in the set (and to itself), all agreeing on exactly the same URLs and language codes. Search engines use these mutual, reciprocal declarations to build a confirmed cluster of alternate-language pages; a one-sided declaration (page A claims page B as an alternate, but B doesn't confirm the relationship back) is generally disregarded, since search engines require mutual confirmation to trust the relationship rather than accepting an unverified one-directional claim.
Hreflang codes follow the ISO 639-1 standard for language (two-letter codes like en, es, fr) optionally combined with an ISO 3166-1 Alpha-2 region code (like US, GB, MX) joined with a hyphen. A plain language code applies broadly to every reader of that language regardless of location, while a language-region code narrows the targeting to a specific country or region — useful whenever content genuinely differs by region within the same language, such as currency, spelling conventions, or region-specific product availability. It's valid to mix both granularities on the same site: a general 'es' page can serve as a catch-all for Spanish speakers, while dedicated 'es-MX' and 'es-ES' pages handle two regions with meaningfully different content.
Implementing hreflang via HTML <link> tags means adding the relevant tags directly to the <head> of each page's HTML — straightforward for a small number of pages or a template-driven site where the tags can be generated dynamically per page, but potentially error-prone at scale if pages are hand-maintained independently. Implementing hreflang via the XML sitemap instead centralizes every relationship in one file, without needing to modify individual page templates at all — a common choice for very large sites, or sites where modifying every page's <head> is impractical. Both are equally valid to search engines; the right choice depends on which is easier to correctly and consistently maintain within your specific site's architecture.
The most frequent implementation errors are: missing the required self-referencing entry (every page needs to list itself among its own alternates), non-reciprocal links (page A references B, but B doesn't reference A back), inconsistent URLs (referencing a URL with a trailing slash in one place and without it elsewhere, which search engines treat as a different, mismatched URL), and invalid or misspelled language/region codes that don't correspond to real ISO codes. Because these relationships must stay perfectly consistent across every page in the set, many real-world hreflang bugs come from maintaining large sets of tags by hand across many separately-edited page templates — generating the full, consistent set in one place (as this tool does) and copying it out avoids the specific class of errors caused by manually keeping many interdependent tags in sync.
Hreflang Generator declares language and region alternates for the same content. These related SEO tools cover other structured markup and international SEO tasks.