ISO 3166-1 Alpha-2 Codes — The Two-Letter Country Standard
Complete guide to ISO 3166-1 alpha-2 two-letter country codes. Learn how they are assigned, where they are used, and how they differ from alpha-3.
Detailed Explanation
What Are Alpha-2 Codes?
ISO 3166-1 alpha-2 codes are two-letter country codes maintained by the International Organization for Standardization. They are the most widely used country code format in technology and everyday life.
How Codes Are Assigned
The ISO 3166 Maintenance Agency (ISO 3166/MA) assigns alpha-2 codes based on country names in one of the official UN languages (English, French, and sometimes others). The mapping is not always obvious:
| Country | Alpha-2 | Origin |
|---|---|---|
| Germany | DE | Deutschland |
| Spain | ES | España |
| Switzerland | CH | Confoederatio Helvetica |
| Japan | JP | Japan |
| South Africa | ZA | Zuid-Afrika |
Where Alpha-2 Codes Are Used
- Internet domains — Country code top-level domains (ccTLDs) like
.uk,.de,.jpare derived from alpha-2 codes - HTML lang attributes —
<html lang="en-US">,<html lang="ja-JP"> - BCP 47 language tags —
en-US,fr-CA,zh-CNcombine language and country - Currency codes — The first two letters of ISO 4217 currency codes are the alpha-2 country code (e.g., USD, GBP, JPY)
- Shipping labels — International mail and packages
- Passport machine-readable zones — ICAO uses alpha-3, but many systems cross-reference alpha-2
Reserved and Exceptional Codes
Some alpha-2 codes have special status:
- AA, QM-QZ, XA-XZ, ZZ — Reserved for user-defined or private use
- EU — Exceptionally reserved for the European Union
- UK — Exceptionally reserved for the United Kingdom (official code is GB)
- AC, CP, DG, EA, IC, TA — Exceptionally reserved for various territories
Code Stability
Alpha-2 codes rarely change, but it does happen when countries rename or merge. When a code is retired, it is not reassigned for at least 50 years to prevent confusion. For example, CS was used for Czechoslovakia until 1993 and later reassigned to Serbia and Montenegro in 2003.
Use Case
A web developer building a country selector dropdown for a registration form uses alpha-2 codes as option values. The same codes configure i18n locale routing, generate hreflang tags for SEO, and match the user's browser language preference.
Try It — Country Code Reference
Related Topics
Alpha-3 vs Alpha-2 Country Codes — When to Use Each
Standards
ISO 3166-1 Numeric Country Codes — Language-Independent Identifiers
Standards
Country Code Top-Level Domains (ccTLDs) — Using Country Codes in DNS
Web & DNS
Using Country Codes in REST APIs and GraphQL
Programming
Country Codes in Address Forms — Building International Address UIs
Historical