Hreflang tag generator
Valid hreflang annotations in three formats
Add every language version of the same page, including the one you are on. The generated block goes on all of them unchanged — that is what makes the annotations reciprocal.
Common questions
Do hreflang tags have to be reciprocal?
Yes. If page A points to page B, page B must point back to page A. Google ignores one-way annotations entirely. The simplest way to get this right is to generate one complete block containing every language version, including the page itself, and place that identical block on all of them.
Does every page need a self-referencing hreflang tag?
Yes. Each page must include a tag pointing at its own URL alongside the tags for its alternates. A block that lists only the other versions is invalid.
Is en-UK a valid hreflang value?
No, and it is the most common hreflang error. Region codes follow ISO 3166-1 alpha-2, where the United Kingdom is GB. The correct value is en-GB. Similarly, use ja for Japanese rather than jp, and el for Greek rather than gr.
What is x-default for?
It marks the fallback page shown to users whose language and region match none of your other versions. A global English page or a country selector is the usual choice. You can have at most one x-default in a set, and it is optional.
Should I use HTML tags, an XML sitemap, or HTTP headers?
All three are equally valid and you only need one. HTML link tags are simplest for small sites. XML sitemap markup scales better past a few hundred URLs and keeps the annotations out of your page weight. HTTP headers are the only option for non-HTML files such as PDFs.
Can I use a language code without a region?
Yes, and it is often the better choice. A bare language code such as es targets Spanish speakers anywhere, while es-MX targets Spanish speakers in Mexico specifically. Only add a region when you genuinely serve different content to that country.

