A language code, in web and SEO use, is a short identifier for a language, usually the two-letter code from ISO 639-1 such as de, en or fr. It appears in hreflang annotations, in the lang attribute and in language tags.
How is a language code built?
On the web, language tags follow BCP 47, published as RFC 5646. A tag consists of a language subtag and optional further subtags for script and region. For languages that have a two-letter ISO 639-1 code, only that code is defined in the IANA registry. The RFC recommends lowercase for language codes, a capitalized first letter for script codes such as Cyrl, and uppercase for region codes. Tags are treated as case insensitive.
Google’s hreflang format takes the language code in ISO 639-1 format followed by an optional region code in ISO 3166-1 Alpha 2 format. Specifying the region alone is not valid. Google adds that it does not rely on code-level language attributes to determine a page’s language, so the visible content has to be in that language.
Examples
| Value | Meaning |
|---|---|
de |
German |
en-GB |
English for users in the United Kingdom |
zh-Hant |
Chinese in Traditional script |
zh-Hans-US |
Simplified Chinese for users in the US |
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/" />
Common mistakes
- Using a region alone, such as
GB, in hreflang. Google calls this invalid. - Using
UKfor the United Kingdom. Google ignores it, and the region code isGB. - Using
EUorUN, which Google ignores as reserved values.
FAQ
What is the difference between a language code and a country code? A language code names the language and a country code names the region. In hreflang the language code comes first and the region follows.
Is a language code without a region enough?
Yes. de is valid and covers German in general.
Sources
- Tell Google about localized versions of your page – Google Search Central (updated 21.09.2026)developers.google.com
- RFC 5646 – Tags for Identifying Languages (BCP 47), September 2009rfc-editor.org
- Managing multi-regional and multilingual sites – Google Search Centraldevelopers.google.com
- ISO 639-1 – Wikipedia (secondary)en.wikipedia.org
Last updated: