Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Chinese Two Letter Language Code: What Is It?

· 5 min read · Home Tech

In this article
  1. Where the Code "zh" Comes From
  2. Chinese Is a Macrolanguage
  3. Simplified vs. Traditional Script: zh-Hans and zh-Hant
  4. Where You Will Actually Use the Code
  5. Common Problems and Mistakes
  6. Chinese Language Code Reference Template
  7. Frequently Asked Questions

The two-letter language code for Chinese is zh. It comes from ISO 639-1, the international standard that assigns a unique two-letter code to each of the world's major languages, and you will see it in web addresses like zh.wikipedia.org, in HTML attributes like lang="zh", and in most software localization files.

Where the Code "zh" Comes From

ISO 639-1 is maintained by the International Organization for Standardization and is the oldest and shortest layer of the ISO 639 language-code family. Its codes are always two lowercase letters, drawn from the language's name — in this case the zh comes from the pinyin reading of Zhōngwén, the Chinese word for the Chinese language. That is why the code is "zh" and not something based on the English word "Chinese," which trips up many people looking for a "ch" or "cn" code.

A common point of confusion: "zh" is a language code, not a country code. China's two-letter country code under ISO 3166-1 is CN, which is a completely separate standard used for things like top-level domains. Language codes and country codes answer different questions, and mixing them up is one of the most frequent mistakes in internationalization work.

Chinese Is a Macrolanguage

One genuinely unusual thing about "zh" is that it is classified in ISO 639-3 as a macrolanguage. This means the single code "zh" covers a family of related language varieties that are not always mutually intelligible when spoken. The three-letter ISO 639-3 code for the macrolanguage is zho, and beneath it sit individual codes such as:

  • cmn — Mandarin Chinese, the variety with the most speakers and the basis of Standard Chinese
  • yue — Yue Chinese, which includes Cantonese
  • hak — Hakka Chinese
  • nan — Min Nan Chinese, including Hokkien
  • wuu — Wu Chinese, including the Shanghainese variety

In everyday practice, most software, websites, and documents simply use "zh" and treat Chinese as one language, because the written standard is shared far more than the spoken varieties are.

Simplified vs. Traditional Script: zh-Hans and zh-Hant

Because written Chinese exists in two main scripts, the bare code "zh" is often extended with a script subtag following the rules of BCP 47 (the IETF standard for language tags). This produces two tags you will meet constantly:

  • zh-Hans — Chinese written in Simplified script, used in mainland China and Singapore
  • zh-Hant — Chinese written in Traditional script, used in Taiwan, Hong Kong, and Macau

You will also see region variants such as zh-CN (Chinese as used in mainland China), zh-TW (Taiwan), and zh-HK (Hong Kong). Technically, zh-CN implies Simplified script and zh-TW or zh-HK imply Traditional, but the script subtags (Hans/Hant) are the more precise and recommended way to indicate writing system, while the region subtags are better reserved for regional vocabulary and formatting differences.

Where You Will Actually Use the Code

Two-letter codes appear in a surprisingly wide range of everyday technical situations:

  • HTML and web pages — the lang attribute, e.g. <p lang="zh-Hans"> tells browsers, screen readers, and translation tools which language a section is in
  • URLs — language editions of multilingual sites, such as zh.example.org
  • HTTP headers — the Accept-Language header a browser sends can include zh, zh-CN, or zh-TW to request content in Chinese
  • Software localization files — translation management systems typically name Chinese resource files with zh, zh-Hans, or zh-Hant
  • Library catalogs and databases — bibliographic records use ISO 639 codes to mark the language of a work

Common Problems and Mistakes

A few pitfalls come up repeatedly when people work with the Chinese language code:

  • Using "cn" or "ch" — neither is a language code. "CN" is the country code for China; there is no "ch" code for Chinese ("ch" is not assigned to Chinese in ISO 639-1).
  • Assuming one script fits all — sending Simplified Chinese text to a Traditional-script audience (or the reverse) is a real usability problem, not just a stylistic one. Choose zh-Hans or zh-Hant deliberately.
  • Confusing language with locale — a full locale tag like zh-Hant-TW combines language, script, and region. If you only need to say "this text is Chinese," "zh" is enough; if formatting dates, currency, or sorting order matters, use the fuller tag.
  • Case sensitivity confusion — language tags are conventionally lowercase for the language part (zh) and capitalized for script and region (Hans, CN), but matching is usually case-insensitive in practice.

Chinese Language Code Reference Template

When you are setting up a multilingual document, website, or translation workflow, it helps to keep a simple reference sheet of the Chinese language tags you plan to support. The blank template below can be filled in for your own project; the sample row shows how a completed entry looks with fictional details.

TagScriptRegion (optional)Intended audienceWhere used
zh
zh-Hans
zh-Hant

Sample entry: zh-Hans | Simplified | CN | General mainland audience | Homepage lang attribute

Frequently Asked Questions

Is the Chinese language code "zh" or "cn"?

"zh" is the language code; "CN" is the country code for China under a different standard (ISO 3166-1). If you are tagging a language — in HTML, files, or metadata — use zh.

What is the difference between zh-Hans and zh-Hant?

zh-Hans marks Simplified Chinese script and zh-Hant marks Traditional script. The choice depends on your audience's writing system, not on dialect: Simplified is standard in mainland China and Singapore, Traditional in Taiwan, Hong Kong, and Macau.

What is the three-letter code for Chinese?

In ISO 639-3, the macrolanguage code is zho, with individual codes like cmn (Mandarin) and yue (Cantonese/Yue) beneath it. Two-letter ISO 639-1 codes exist only for a limited set of major languages; the three-letter standard covers thousands.

Should I use zh, zh-CN, or zh-Hans-CN?

Use plain "zh" when you only need to identify the language. Add the script subtag (zh-Hans or zh-Hant) when the writing system matters, and add a region subtag when regional vocabulary or formatting conventions matter. The most specific sensible tag is usually the best choice for localized content.

Does "zh" cover Cantonese?

Spoken Cantonese falls under the Chinese macrolanguage, so "zh" is acceptable in broad contexts, but ISO 639-3 gives it its own code, "yue." If you are providing specifically Cantonese audio or written Cantonese content, "yue" is the more accurate tag.

Why is the code "zh" and not "ch"?

ISO 639-1 codes are typically derived from the language's own name for itself rather than the English name. "Zh" reflects the Zh- of Zhōngwén, the Chinese name for the Chinese language.