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.

Standards

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

  1. Internet domains — Country code top-level domains (ccTLDs) like .uk, .de, .jp are derived from alpha-2 codes
  2. HTML lang attributes<html lang="en-US">, <html lang="ja-JP">
  3. BCP 47 language tagsen-US, fr-CA, zh-CN combine language and country
  4. Currency codes — The first two letters of ISO 4217 currency codes are the alpha-2 country code (e.g., USD, GBP, JPY)
  5. Shipping labels — International mail and packages
  6. 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

Open full tool