ISO 3166-1 country code reference
ISO 3166-1 assigns each country and dependent territory three standardized codes: a two-letter alpha-2, a three-letter alpha-3, and a three-digit numeric code. These codes power locale identifiers, ccTLDs, currency tables, shipping systems and statistical datasets. This reference lets you search by country name or any code form and shows all three side by side.
How the three ISO code forms relate
Each country has one of each code type, kept in sync by the ISO 3166 Maintenance Agency:
- Alpha-2 — two uppercase letters (
GB,US,AM). Most widely used; the basis for ccTLDs and BCP 47 region subtags. - Alpha-3 — three uppercase letters (
GBR,USA,ARM). More mnemonic and less prone to collision; used in passports and ISO 4217 currency codes (the first two letters of a currency code are the country’s alpha-2). - Numeric — three digits (
826,840,051). Identical to the UN M.49 country code; script-neutral, which is useful where letters cannot be used.
To convert between forms you simply look the country up in the registry — there is no algorithm, the mapping is a fixed table. The region column groups countries by UN M.49 continental area for coarse segmentation.
Where each code type gets used in practice
Knowing which code form a specific system expects saves integration headaches:
| System or standard | Code type used |
|---|---|
HTML lang attribute, BCP 47 locale | Alpha-2 region subtag (en-GB) |
| Country code top-level domain | Alpha-2 (mostly; see exceptions) |
| Passport Machine Readable Zone | Alpha-3 |
| ISO 4217 currency codes | First two chars of currency code = alpha-2 of issuing country |
| UN statistical databases, M.49 | Numeric |
| Financial messaging (SWIFT, ISO 20022) | Alpha-2 or Alpha-3 depending on field |
| IANA language subtag registry | Alpha-2 |
Known exceptions and edge cases
A handful of codes trip up developers because the ISO registration and the real-world usage diverge:
- United Kingdom is
GB/GBR/826in ISO but.ukas a country domain (the.gbccTLD was registered but has never been widely used). - Switzerland is
CH/CHE/756, from the Latin Confoederatio Helvetica — nothing to do with the English name. - Greece is
GRbut.gr— straightforward, but the alpha-3 isGRC, notGRE. - Kosovo has no ISO 3166-1 entry as of recent years (recognition is not universal). It is commonly assigned
XK/XKXas a user-assigned code, not an official ISO one. - Timor-Leste is
TLin ISO, notTP(the old Portuguese Timor code). - Retired codes like
CS(Serbia and Montenegro) orYU(Yugoslavia) are reserved and will not be reused, but can still appear in old data.
Reading one country across all three forms
The United Kingdom illustrates every trap at once: ISO assigns GB / GBR /
826, yet the domain is .uk, licence plates use UK (since 2021), and
UK itself is an exceptionally reserved ISO code — reserved so nobody else
can take it, but not the official assignment. Armenia shows the numeric-code
gotcha: its numeric code is 051, and systems that store numeric codes as
integers silently turn it into 51, which then fails string comparisons.
Store numeric ISO codes as zero-padded three-character strings, never as
numbers.
Codes you can use without colliding with ISO
ISO 3166-1 deliberately sets aside user-assigned code space that the Maintenance Agency promises never to allocate. If you need internal placeholders (test data, “unknown country”, multi-country groupings), draw from these ranges and nowhere else:
| Form | User-assigned range |
|---|---|
| Alpha-2 | AA, QM–QZ, XA–XZ, ZZ |
| Alpha-3 | AAA–AAZ, QMA–QZZ, XAA–XZZ, ZZA–ZZZ |
| Numeric | 900–999 |
This is exactly why Kosovo is conventionally XK: it sits in the
user-assigned XA–XZ block, so the (unofficial) convention cannot collide
with a future official assignment. The same logic makes ZZ a common
“unknown/unspecified” sentinel in address and payment systems.
Separately, ISO keeps a small set of exceptionally reserved codes that
appear in the wild but are not country assignments: EU (used in ISO 4217 for
the euro and in TIN/VAT contexts), UK (reserved for the United Kingdom),
SU (legacy Soviet Union, still seen in the .su ccTLD), and FX
(historical “metropolitan France”). Accept them where your upstream data uses
them, but map them explicitly rather than treating them as ordinary entries.
Tips and notes
- The alpha-2 code is your safest default for web and locale work because it matches BCP 47 region subtags and most ccTLDs.
- For language tags, combine a language subtag with the alpha-2 region:
en-GB,hy-AM,pt-BR. - When building a shipping or payment form, confirm whether the API expects alpha-2 or numeric — both are common and confusing them causes silent validation failures.
- Reserved or transitional codes (
EU,UK,XK) appear in many datasets; treat anything outside the official list as user-defined or exceptional, and document the choice explicitly.
Sources and references
- ISO — Country Codes (ISO 3166) — the authoritative alpha-2, alpha-3, and numeric assignments
- ISO 3166 Maintenance Agency — Online Browsing Platform — searchable official code list, including reserved/retired codes
- UN Statistics Division — Standard country codes (M.49) — the numeric codes and region groupings
- IANA Language Subtag Registry — how alpha-2 codes are used as BCP 47 region subtags
Maintained by the Gera Tools editorial team. Codes are reassigned when countries form, dissolve, or rename; treat historical data with its date in mind and confirm current assignments on the ISO OBP. Last reviewed 2026-07-02.