Country codes and internet domains

Country codes and internet domains. Compare ISO codes, calling codes and ccTLDs. The page must give the reader a usable method, checklist or decision rule, not

Identifying a country via its codes

When you need to identify a country for a web form, database lookup, or international transaction, you will encounter three systems that work together: ISO 3166-1 codes, ITU-T E.164 calling codes, and ccTLDs. Each serves a distinct purpose, and knowing which one to use in a given situation saves time and prevents errors.

The three ISO 3166-1 code formats

The International Organization for Standardization (ISO) maintains the 3166-1 standard, which assigns every country and territory a stable set of three codes (ISO, latest revision):

  • Alpha-2 (two letters): Used for general-purpose identification, such as on passports, vehicle registration plates, and as the base for internet domain names. Example: JP for Japan, DE for Germany, US for the United States.
  • Alpha-3 (three letters): Used when a two-letter code would be ambiguous or when the format requires three characters. Example: JPN, DEU, USA. The United Nations uses alpha-3 for its standard country coding (UN/LOCODE, UN/CEFACT).
  • Numeric (three digits): Used in systems that do not support Latin script or where numeric codes are preferred for data processing. Example: 392 for Japan, 276 for Germany, 840 for the United States. The numeric code is identical to the UN Statistical Division’s M49 code.

Decision rule: Use alpha-2 in web forms and consumer-facing applications. Use alpha-3 in data exchanges with international organisations. Use numeric when the system cannot handle letters or when integrating with UN statistical databases.

ITU-T E.164 country calling codes

The International Telecommunication Union (ITU) assigns telephone country codes under the E.164 standard (ITU, 2026 update). These are 1 to 3 digits long. The calling code does not always match the ISO alpha-2 code. For example, the United States has alpha-2 US and calling code +1, while Kazakhstan has alpha-2 KZ and calling code +7. The calling code is tied to the telephone numbering plan, which sometimes spans multiple countries (e.g., +1 serves the US, Canada, and many Caribbean territories).

Decision rule: When dialling, use the calling code. When identifying a country in a database, use ISO alpha-2 or alpha-3, not the calling code, because one calling code can cover multiple countries.

ccTLDs: country code top-level domains

The Internet Assigned Numbers Authority (IANA) delegates a two-letter ccTLD for each country or territory, matching the ISO 3166-1 alpha-2 code (IANA, updated annually). For example, .de for Germany, .jp for Japan, .us for the United States. A ccTLD is not always controlled by the corresponding national government; many are managed by private registries under contract with IANA.

Key exceptions: - The United Kingdom uses .uk instead of its ISO alpha-2 GB. The .gb domain exists but is rarely used. - The European Union uses the reserved .eu domain, which is not an ISO 3166-1 code. - Some territories have ccTLDs that do not match their ISO code because the territory’s ISO code changed after the domain was established (e.g., .ac for Ascension Island, whose ISO code is AC).

Decision rule: Use the ccTLD for web addresses. For data processing, always use the ISO alpha-2 code, not the ccTLD, because of these exceptions.

How to look up a country’s codes

  1. Find the ISO alpha-2 code: Check the official ISO 3166-1 list (available from ISO or the United Nations Statistics Division). The CIA World Factbook also publishes a complete table.
  2. Derive the alpha-3 and numeric codes: The alpha-3 code is the three-letter version of the same standard. The numeric code is the UN M49 code.
  3. Find the calling code: Consult the ITU’s E.164 country code list. The World Factbook and many telecom reference sites maintain a combined table.
  4. Find the ccTLD: IANA’s root zone database lists every delegated ccTLD and its sponsoring organisation.

Common mistakes when using country codes

  • Confusing calling codes with ISO codes: A form that asks for a “country code” may mean either. Always check the field’s label. If it says “phone,” use the calling code. If it says “country,” use ISO alpha-2.
  • Using the wrong code for a territory: Territories (non-sovereign areas) have their own ISO codes and often their own ccTLDs. For example, Puerto Rico has ISO alpha-2 PR and ccTLD .pr, but its calling code is +1 (shared with the US). Do not assume a territory uses the parent country’s code.
  • Assuming a ccTLD is the same as the ISO code: The .uk exception is the most common trap. Always verify the ccTLD against the IANA database, not against the ISO list.
  • Mixing code formats in a single dataset: If you store alpha-2 in one field and numeric in another, ensure they refer to the same revision of the standard. Codes are stable, but countries do occasionally change (e.g., South Sudan added in 2011, code SS).

What else do you need to know about a country?

Once you have identified the country by its codes, the following attributes provide a fuller picture. Each is defined here with its source and a note on how to interpret it.

Population

The United Nations Department of Economic and Social Affairs (UN DESA) publishes annual population estimates for all countries and territories (UN DESA, 2024 revision). The figure is a mid-year estimate, not a census count. Censuses are conducted every 5-10 years; the most recent census year varies by country. For example, Japan’s 2020 census counted 126.1 million, but the 2024 UN estimate is 123.9 million due to population decline. Do not compare census figures from different years without adjusting for population growth or decline. The UN estimate is the most consistent basis for cross-country comparison.

Capital

The capital city is the seat of a country’s government. It is not always the largest city. Examples: Canberra (capital) vs Sydney (largest city) in Australia; Brasília (capital) vs São Paulo (largest city) in Brazil. The CIA World Factbook and national government websites are the primary sources. Some countries have multiple capitals (e.g., South Africa has three: Pretoria, Cape Town, Bloemfontein) or a capital that is disputed (e.g., Jerusalem). In disputed cases, neutral sources like the UN Geospatial Information Section note the de facto seat of government.

Currency

Every country or territory uses a currency, but not every currency is unique. The World Bank and the IMF maintain lists of official currencies. Many countries share a currency (e.g., the West African CFA franc is used by eight countries). The ISO 4217 standard assigns a three-letter currency code (e.g., EUR for the euro, JPY for the Japanese yen). Exchange rates fluctuate daily; use the IMF’s International Financial Statistics or the central bank of the issuing country for current rates. Do not assume that the currency name (e.g., dollar) means the currency is interchangeable; one Canadian dollar is not the same as one US dollar.

Language

A country may have one or more official languages, and the most widely spoken language at home may differ from the official language. UNESCO’s World Atlas of Languages and national census data provide the most reliable information. For example, India has two official languages at the union level (Hindi and English) and 22 scheduled languages; the most spoken first language is Hindi, but English is the primary language of business and higher education. Do not assume that an official language is spoken by the entire population. Literacy rates in that language may also vary.

Visa

Visa policies change frequently and differ by nationality. No single source covers every country-pair. The IATA Travel Centre (managed by the International Air Transport Association) provides the most comprehensive database of entry requirements, but it is a commercial service. Every government’s foreign ministry publishes official visa information for its own citizens. The US State Department, UK Foreign, Commonwealth & Development Office, and similar agencies issue travel advisories that include visa requirements. This page does not provide visa advice. Always verify current requirements with the destination country’s embassy or consulate and with your own government’s travel advisory.

How to compare countries responsibly

The goal of country comparison is not to produce a single winner, but to understand genuine differences. Follow this checklist:

  1. Use the same source for both countries. Comparing the UN population estimate for Japan with the World Bank population estimate for Germany introduces methodology differences. Stick to one source per attribute.
  2. Check the reference year. A 2020 census figure from one country cannot be directly compared with a 2024 estimate for another. Use the same reference year or adjust for growth.
  3. Note the definition. “Literacy rate” may mean different things in different countries. UNESCO’s definition is the most standardised, but national definitions vary. Always read the source’s methodology note.
  4. Look for within-country variation. A national average masks huge differences. For example, life expectancy in the US is 77.5 years (WHO, 2024), but varies by more than 10 years between the richest and poorest counties. Check subnational data when available.
  5. Account for disputed territories. Some countries include disputed areas in their statistics, others do not. The UN and World Bank typically use de facto boundaries. For example, data for Cyprus excludes the Turkish Republic of Northern Cyprus; data for Israel includes East Jerusalem. Be aware of what is included.

Frequently Asked Questions

What is the difference between ISO alpha-2 and alpha-3 codes?

Alpha-2 is two letters, used for general identification and as the base for ccTLDs. Alpha-3 is three letters, used by the UN and in data exchanges where two letters could be ambiguous. Both refer to the same country in the ISO 3166-1 standard.

Why does the UK use .uk instead of .gb?

Historically, `.uk` was delegated before the ISO 3166-1 standard assigned `GB` to the United Kingdom. The `.gb` domain exists but is not used. IANA continues to delegate `.uk` as the primary ccTLD.

Can I use a calling code to identify a country in a database?

No. One calling code can cover multiple countries (e.g., `+1` covers the US, Canada, and many Caribbean territories). Use ISO alpha-2 or alpha-3 for database identification.

How often do country codes change?

ISO 3166-1 codes change only when a country merges, splits, or changes its name. The last major change was South Sudan (added 2011). Calling codes change less frequently. ccTLD delegations are updated by IANA as new countries or territories are recognised.