Country & Region Codes
ISO 3166-1 country and region codes: Alpha-2, Alpha-3, numeric code and dialing code for China and major countries/regions.
How It Works
ISO 3166 assigns standard codes to countries and territories: two-letter (CN, US), three-letter (CHN, USA) and three-digit (156, 840). In data exchange they are more stable and shorter than spelled-out names.
The two-letter code drives country-code top-level domains (.cn/.us, ccTLDs) and underpins phone country prefixes and customs/shipping forms. Note it is a separate system from phone dialing codes and currency codes.
When to Use This Table
This table converts between country names and the alpha-2, alpha-3 and numeric codes. All four coexist in real systems: ISO 3166-1 alpha-2 appears in domains and code, alpha-3 in databases and statistics, numeric in flag emoji and legacy systems. Picking the wrong set fails silently — writing 156 where "CN" was expected passes every validation check.
When not to consult it: you are making geographic partitioning decisions. Country, region and continent are different things: ISO lists China as CN while Taiwan, Hong Kong and Macao have their own entries, and EU membership is not Europe. If the logic depends on those distinctions, use a mature geographic dataset instead of this table.
Rule of thumb: match alpha-2 for API contracts, alpha-3 for storage and interchange, numeric or emoji for flags and display. What matters most is never mixing two sets in one system without recording the mapping.
Mind that alpha-2 does not line up perfectly with top-level domains, and codes have changed historically (ZR for Zaire, DD for East Germany). These legacy codes still appear in older systems, so ingest external data by tolerating them rather than correcting them.
Boundaries and Common Pitfalls
Same name, different code: ISO is authoritative, not the name
There are entries sharing a name while differing in code, and codes that stay stable while official names change (Turkey to Türkiye, Czech Republic to Czechia). A country list keyed by name will inevitably break after a registry update; a list keyed by code will not. If you store names, keep the ISO official English name as a separate snapshot field and never as the key.
Flag emoji regional indicators only accept alpha-2
Joining two ISO 3166-1 alpha-2 code points produces a flag emoji (U+1F1E6 is A). Alpha-3 or numeric codes cannot; the usual path converts numeric to alpha-2 via String.fromCodePoint(127397 + n) first. A second trap: Windows sometimes renders the flag as two letters because the platform font is missing, which is not an encoding error.
ISO 3166-1 and UN M49 are not the same numbering
Statistics and population data usually use UN M49, whose area and sub-area codes broadly mirror but do not duplicate ISO 3166-1 numeric codes and add their own Area/Territory hierarchy. Mixing the two produces plausible-looking but misaligned aggregates in cross-border rollups. State which standard an interface uses and encode it in the field name.
How This Relates to Neighbours
For currency codes (ISO 4217), use the in-site currency page; currencies relate to countries but are not interchangeable with them.
For language codes (ISO 639 / BCP 47), use the language-codes page; country is not language, and many countries are multilingual.
For flags, time zones or dialling codes, use a dedicated dataset; this table covers only the three ISO 3166-1 code sets.
If the goal is a country picker or search, you need a multilingual name dataset — a single official name here is not enough.
Practical Snippet
Key points: (1) flag emoji can only be built from alpha-2; numeric codes must first be converted via 127397 + n; (2) Windows may render a flag as two letters due to a missing platform font rather than an encoding error, so production should use SVG assets instead of relying on an emoji font; (3) use codes rather than country names as the primary key for pickers and storage, since official names change (Türkiye, Czechia) and a name-keyed list breaks on every ISO revision.
// 数字代码 → alpha-2 → 国旗 emoji
function numericToAlpha2(numeric: number): string {
// UN M49 / ISO 3166-1 numeric 转 alpha-2:127397 是 'A' 的 regional indicator 码位
return String.fromCodePoint(127397 + numeric)
}
function flagOf(alpha2: string): string {
if (alpha2.length !== 2) throw new Error('flag needs alpha-2')
const base = 0x1f1e6 // 'A' 的 regional indicator
return String.fromCodePoint(
base + (alpha2.toUpperCase().charCodeAt(0) - 65),
base + (alpha2.toUpperCase().charCodeAt(1) - 65),
)
}
console.log(numericToAlpha2(156)) // CN
console.log(flagOf('cn')) // 🇨🇳
console.log(flagOf('de'), flagOf('jp')) // 🇩🇪 🇯🇵
// ⚠ Windows 上可能渲染成 "CN" 两个字母 —— 平台字体缺失,不是编码错误
// 生产环境应改用 <img src=".../cn.svg">,避免依赖 emoji 字体
// 下拉框的稳定主键:用 alpha-2,不要用国家名(会随 ISO 改版变化)
const options = [
{ code: 'CN', name: 'China' },
{ code: 'DE', name: 'Germany' },
]Practical Notes
- ISO 3166-1 keeps alpha-2, alpha-3 and numeric side by sideChina is CN / CHN / 156. Mixing them causes mistakes (CH is Switzerland, not China) and CN cannot be swapped for CHN. Pick one canonical form internally and convert only at boundaries, or joins will silently lose rows.
- "Country" and "region" are the same entity in the data modelISO 3166-1 includes dependencies alongside sovereign states (HK, TW appear as region codes). If a table is named country but stores regions, document the scope explicitly to avoid disputes over reporting definitions.
- Dialling codes are not country codes+1 covers the US, Canada and several Caribbean territories, and +7 covers both Russia and Kazakhstan. Any one-to-one mapping from country code to dialling code is wrong; parse phone numbers with a metadata-backed library such as libphonenumber.
Data Sources
- ISO 3166-1 (alpha-2 / alpha-3 / numeric)
- ITU-T E.164
Codes, names and definitions above come from public specifications; we claim no originality over the specification data itself. The arrangement, Chinese annotations and practical notes on this page are written by us.
| Country/Region | Alpha-2 | Alpha-3 | Numeric | Dial |
|---|---|---|---|---|
| China | CN | CHN | 156 | +86 |
| Hong Kong, China | HK | HKG | 344 | +852 |
| Macao, China | MO | MAC | 446 | +853 |
| Taiwan, China | TW | TWN | 158 | +886 |
| United States | US | USA | 840 | +1 |
| United Kingdom | GB | GBR | 826 | +44 |
| Japan | JP | JPN | 392 | +81 |
| South Korea | KR | KOR | 410 | +82 |
| Germany | DE | DEU | 276 | +49 |
| France | FR | FRA | 250 | +33 |
| Russia | RU | RUS | 643 | +7 |
| Canada | CA | CAN | 124 | +1 |
| Australia | AU | AUS | 036 | +61 |
| Brazil | BR | BRA | 076 | +55 |
| India | IN | IND | 356 | +91 |
| Italy | IT | ITA | 380 | +39 |
| Spain | ES | ESP | 724 | +34 |
| Netherlands | NL | NLD | 528 | +31 |
| Singapore | SG | SGP | 702 | +65 |
| Switzerland | CH | CHE | 756 | +41 |
Frequently Asked Questions
What is the difference between Alpha-2 and Alpha-3 in ISO 3166-1?
Both are two- and three-letter codes for the same country/region. Alpha-2 (e.g. CN) is shorter and used in TLDs and data exchange; Alpha-3 (e.g. CHN) is more readable and less ambiguous. The numeric code (e.g. 156) is script-independent, good for non-Latin systems.
What does the + mean before a dialing code?
"+" denotes the international access prefix, followed by the country code (e.g. +86). When dialing, "+" is replaced by the local prefix (00 in China, 011 in the US), e.g. +86 138... becomes 0086 138... from outside China.
Why do the US and Canada share +1?
The North American Numbering Plan (NANP) unifies the US, Canada and parts of the Caribbean under +1, distinguished by a 3-digit area code. So +1 is shared and does not uniquely identify the country.
Do the letter or numeric codes ever change?
Very rarely, but it happens: e.g. the breakup of Yugoslavia added new codes, and Sudan split into Sudan and South Sudan. The official list is maintained by ISO; refer to the latest version when needed.