How do I set up two languages and hreflang correctly?

Each language needs its own stable URL, and both versions must point at each other. Google only accepts an `hreflang` group when it is reciprocal: if A points to B but B does not point back, the whole declaration is ignored and the two languages start competing with each other.

SeoScore

The mistake is almost always the same, and it is silent: hreflang is there, it looks right, and it does nothing. The reason is reciprocity.

Three rules are enough

Each version gets its own URL. /pricing and /en/pricing. Not ?lang=en: every parameter is another copy of the same page in the index.

Reciprocity. If the Lithuanian page declares its English version is /en/pricing, the English page must declare the Lithuanian one is /kainos. One mismatch is enough for the group to be dropped.

A pair only where one exists. A page without a translation should get no hreflang at all. Declaring an alternate that does not exist is worse than declaring none.

The most common mistake

Every page points at the home pages. This happens by itself when hreflang is written into a shared template: /pricing declares that its English version is /en rather than /en/pricing.

The result: no pair matches, the declaration is ignored, and Google decides which version to show. Often the wrong one.

How the code itself is written

The language code is a 2 characters ISO 639-1 value — lt, en, de. A region is added only when it is genuinely needed, and it is likewise a 2 characters ISO 3166-1 Alpha-2 value: en-GB, en-US, de-AT.

The most common writing mistake is en-UK. No such country code exists — the United Kingdom is GB in the ISO 3166-1 list, and Google silently ignores an invalid value exactly the way it ignores a one-sided pair.

Do not add a region without a reason. en-US and en-GB matter when the content really differs — prices, shipping, law. For a single English version en is enough.

x-default

x-default is for a visitor whose language you did not recognise. In practice point it at the English version: someone whose language is not on your list is probably not a local speaker.

What not to do

Do not switch language automatically by IP. Googlebot crawls almost entirely from US addresses, so a redirect means it never reaches the local version — and that version leaves the index. Google names this directly in its guidelines as something to avoid.

Offer instead: a bar at the top, once, with no redirect.

A free scan checks exactly this reciprocity: whether every pair matches from both sides.

Related articles

The same subject from another angle — each answers its own question:

How this feeds into the score is described under what we check.

Sources

What this article is based on — primary sources, not retellings:

Three rules, and they are enough — Every pair must be reciprocal; Every page also points at itself; x-default for a language you did not detect; Never switch language by IP.

Frequently asked

Does `hreflang` affect rankings?

Not directly. It helps Google show the right version to the right person, which affects clicks and behaviour indirectly.

Do I need `hreflang` if the languages are on different domains?

Yes. The rule is the same, only the URLs differ — reciprocity is required across domains too.

Is `sitemap.xml` enough?

It is: `hreflang` can be declared either in the HTML head or in the sitemap. What matters is not doing both with different values.

What about pages that exist in one language only?

Leave them without `hreflang`. That is normal and correct: some pages have a pair, some do not.

SEO →

Check yours

A free scan shows which of the things described here your site already does, and which it does not.

Scan a website →