hreflang
hreflang is an HTML attribute that tells search engines which language and region a particular version of a page is intended for. If you run your website in several languages or for several countries, hreflang links the matching versions to one another. This way each user group is served the right version instead of a wrong language or country version.
Why hreflang matters
As soon as you offer content for several languages or countries, a problem arises: Google and other search engines do not automatically know which version fits which user. Without hreflang, an Austrian might land on the US page with dollar prices, or a French user sees the English version. That costs trust and revenue. hreflang ensures the right version is served in the right market. At the same time, you prevent very similar language versions (for example German for Germany and for Switzerland) from being counted as duplicate content and weakening each other in ranking. Internationally positioned companies in particular gain noticeably in visibility this way and deliver every visitor a clean, locally fitting experience.
How hreflang works technically
hreflang is specified via language codes following the ISO standard, for example "de" for German or "de-AT" for German in Austria. You can place it in three spots: in the HTML head of the page, in the HTTP header, or in the XML sitemap. What matters is the principle of reciprocity: if the German page points to the English one, the English one must also point back to the German one. If this return link is missing, search engines ignore the specification. There is also the value "x-default" for a default version that applies when no language fits, such as a language selection page. Each version should also include a reference to itself, so that the assignment stays complete and unambiguous.
Common mistakes
The classic mistake is the missing return link: A points to B, but B does not point back to A. Google treats such one-sided specifications as invalid. Just as common are wrong country codes, some confuse language and country codes or invent codes like "en-UK" instead of the correct "en-GB". A contradiction between hreflang and the canonical tag also causes damage: if a page's canonical points to a different language version, you cancel out your hreflang signals. Further pitfalls are references to redirected or non-indexable URLs. Therefore check your markup regularly with a testing tool, because errors often go unnoticed for a long time and quietly cost reach.
Relation to AI recommendations
AI assistants like ChatGPT, Perplexity, or Google AI Overviews increasingly draw on web content to generate answers. Cleanly marked-up language versions help these systems understand which version of your content fits a query. If someone asks about a product in German, it is more likely that the German version is cited and recommended when hreflang makes the assignment clear. For your AI visibility this means: hreflang is not a mere SEO sideshow but part of a technically clean foundation. Contradictory or missing language signals increase the risk that the wrong version of your brand, or none at all, appears in generative answers. A clear structure therefore pays directly into citability and recommendations.
Example
An online furniture retailer sells in Germany, Austria, and Switzerland. All three countries speak German, yet prices, currency, and shipping conditions differ. With hreflang, the retailer sets up three versions: "de-DE", "de-AT", and "de-CH". Now when a customer from Zurich opens the site via Google, they get the Swiss version with franc prices instead of the German one with euros. Without this markup, the three almost identical pages would compete, and customers would often land in the wrong country version.
Common questions
Do I need hreflang even with just one language?
No. hreflang is only necessary if you offer several language or country versions. If your website has only one language and one target market, you do not need the attribute.
Is hreflang a ranking factor?
hreflang does not directly improve your ranking but ensures the right version is served. This indirectly increases click-through rate and user satisfaction and prevents language versions from weakening one another.