In short. BCP 47 language tags identify content languages, with optional subtags for useful script and regional distinctions.
Definition: BCP 47 language tags identify the language of content, including text in web documents. A tag consists of subtags, components separated by hyphens that can specify a language and, where needed, its script or regional variety.
Key facts
- The IETF's RFC 5646, Tags for Identifying Languages, published in September 2009, defines tag construction and forms BCP 47 together with RFC 4647.
- W3C's language tag overview gives
fr-CAfor French used in Canada andes-419for Spanish used in Latin America. - W3C's HTML language declaration guidance places the document's default language in the
langattribute on thehtmlelement. - W3C's tag selection guidance recommends adding subtags only when the distinction matters in the content's context.
How do language, script and region fit together?
RFC 5646 gives different subtag types fixed positions. A script subtag identifies a writing system and contains four letters. A region subtag follows the language and any script subtag; it contains two letters or three digits. Tags are case insensitive.
W3C's overview illustrates these components with zh-Hans, Chinese written in Simplified script, and zh-Hant-HK, Traditional Chinese used in Hong Kong. The latter combines language, script and region in that order. Conventional capitalization uses lowercase for the language, an initial capital for the script and uppercase for alphabetic regions.
A region can cover several countries: 419 identifies Latin America in es-419. A script subtag makes the writing system explicit, while a region subtag expresses a regional linguistic distinction.
When is a regional subtag useful?
W3C's selection guidance gives en-GB as a useful distinction for spell-checking. It recommends keeping tags short: ja is sufficient for Japanese unless the context calls for distinguishing Japanese used in Japan from Japanese used elsewhere.
The same guidance treats script subtags similarly. The registry field Suppress-Script: Latn for English indicates that Latin script is ordinarily implicit. Adding a script or region therefore depends on the distinction the document needs to express.
How is a tag applied to a web document?
W3C's HTML guidance uses this declaration for an English page:
<html lang="en">
Elements inside the document inherit that language. A passage in another language receives its own declaration on the surrounding element, as in this example adapted from the same guidance:
<p>The title is "<span lang="fr">Le Bon Usage</span>".</p>
Here the span identifies the French words within the English paragraph. The root declaration belongs on html, which also covers text in the document's head.
Related terms
FAQ
Where can I check a subtag?
W3C's selection guide directs you to the IANA Language Subtag Registry. Search the language name, check the record's Type, and use its Subtag value; review Deprecated and Preferred-Value fields before adopting an existing code.
Does capitalization change the language?
RFC 5646 treats tags as case insensitive. You can follow conventional capitalization to make their components easier to read.
Can I declare a different language inside a page?
Yes. W3C's HTML guidance places a language attribute on an element surrounding the passage, overriding the inherited language for that content.
Sources
- IETF, "Tags for Identifying Languages", September 2009
- W3C, "Language tags in HTML and XML", accessed 17 October 2026
- W3C, "Declaring language in HTML", accessed 17 October 2026
- W3C, "Choosing a Language Tag", accessed 17 October 2026
Check how a page reads to answer engines. Open the GEO score analyzer