What hreflang actually solves
It tells search engines that several URLs are the same page in different languages or for different regions, so the right one is shown to the right person. It does not affect ranking directly — it affects which of your existing pages appears.
The problem it prevents is real: without it, a search engine treats near-identical pages in English and American English as duplicates competing with each other, and picks one arbitrarily. With it, they are recognised as alternates of one another.
The [msm_tool slug="hreflang-generator"] produces the tags and flags the mistakes that make them silently useless.
The tags must be reciprocal
This is the rule that catches almost everyone. Every page in the set must list every page in the set, including itself.
If your English page points at the French one but the French page does not point back, search engines ignore the annotation entirely. Not partially — entirely. A one-way hreflang is the same as no hreflang, and because nothing breaks visibly, it can sit there for a year doing nothing.
Three languages means three pages each carrying four tags: one for each language plus the x-default. Six languages means six pages carrying seven tags each. The count grows quickly and it has to be complete.
Self-referencing is not optional
Each page includes a tag pointing at itself. It looks redundant and it is required — without it the set is incomplete and the same all-or-nothing rule applies.
The codes are not what people assume
- Language codes are ISO 639-1, two letters.
en, fr, de, ur.
- Region codes are ISO 3166-1 Alpha 2, and they are countries, not languages.
en-GB is English for the United Kingdom.
- The common error is using a language where a country belongs.
en-UK is invalid — the country code is GB. So is zh-CN meaning simplified Chinese; CN is China the country, and script is expressed as zh-Hans.
- Region alone is not valid. You cannot write
hreflang="GB". Language is mandatory, region is optional.
x-default is for everyone else
It marks the page shown to users whose language and region match none of your alternates. Usually that is an international English page or a language selector.
It is optional and almost always worth having. Without it, a visitor from a country you have not covered gets whichever page the search engine guesses at.
Absolute URLs, always
Relative paths do not work in hreflang. Every URL must include the protocol and the domain, and it must be the canonical version — the exact URL you want indexed, matching what your canonical tag says.
Two things follow. An hreflang pointing at a URL that redirects is broken. An hreflang pointing at a URL whose canonical points somewhere else is also broken, because you are giving contradictory instructions.
Where to put them
Three placements are valid: in the HTML head, in HTTP headers, or in an XML sitemap.
The head is simplest for a small site. The sitemap is far better for a large one — it keeps the tags in one place, avoids adding weight to every page, and makes the reciprocity easy to verify because the whole set is visible at once. For non-HTML files such as PDFs, HTTP headers are the only option.
What to check before shipping
- Every page lists every alternate, including itself.
- Region codes are countries, and
en-UK appears nowhere.
- Every URL is absolute, canonical, and returns 200 rather than a redirect.
- The language actually matches the content — a tag claiming French on an English page is worse than no tag.
- An x-default exists.