List of all countries with their 2 digit codes (ISO 3166-1)

74,822
Updated:
Files:1
Size:3.83 kB
Formats:csv
License:ODC-PDDL-1.0

ISO 3166-1-alpha-2 English country names and code elements. This list states the country names (official short names in English) in alphabetical order as given in ISO 3166-1 and the corresponding ISO 3166-1-alpha-2 code elements.

Part of these Data Solutions

  • Global Country & Region Reference Data Solution

    Authoritative country codes, regions and location reference data to power your location-based solutions.

    Explore →
  • Logistics Data Solution

    Comprehensive reference for shipping codes, container standards and more.

    Explore →
  • Postal Codes Solution

    Every worldwide postal-code dataset in one bundle — the ultimate global reference for precise postal codes.

    Explore →

API Access

Access dataset files directly from scripts, code, or AI agents.

Browse dataset files
Dataset Files

Each file has a stable URL (r-link) that you can use directly in scripts, apps, or AI agents. These URLs are permanent and safe to hardcode.

/core/country-list/
https://datahub.io/core/country-list/_r/-/ATTRIBUTION.txt
https://datahub.io/core/country-list/_r/-/README.md
https://datahub.io/core/country-list/_r/-/data.csv
https://datahub.io/core/country-list/_r/-/datapackage.yml
Key Files

Start with these files — they give you everything you need to understand and access the dataset.

datapackage.yml— metadata & schema
https://datahub.io/core/country-list/_r/-/datapackage.yml
README.md— documentation
https://datahub.io/core/country-list/_r/-/README.md
Typical Usage
  1. 1. Fetch datapackage.yml to inspect schema and resources
  2. 2. Download data resources listed in datapackage.yml
  3. 3. Read README.md for full context

Data Files

Explore with AI

data


About this dataset

badge

ISO 3166-1 Country List

English country names and their ISO 3166-1 alpha-2 code elements, in one CSV file. The list is rebuilt from the ISO 3166-1 data in the pycountry package.

Column definitions and types are in datapackage.yml.

Data

data.csv has one row per country or territory, sorted by Name:

ColumnMeaning
NameEnglish short name, as pycountry gives it, for example Korea, Republic of. Names with a comma are in quotes, so they stay one column
CodeISO 3166-1 alpha-2 code: two upper-case letters, for example KR. Each code appears once

Known limitations

  • "NA" is a code, not a missing value. The code for Namibia is the two letters NA. Many tools read the text NA as "missing" by default. For example, pd.read_csv("data.csv") returns an empty value (NaN) for Namibia. To keep it, read the file with keep_default_na=False:

    import pandas as pd
    df = pd.read_csv("data.csv", keep_default_na=False)
    
  • Many names contain a comma, for example "Korea, Republic of" and "Virgin Islands, U.S.". They are in quotes in the file, and any CSV reader keeps each name in one column.

  • Names are formal short names, not always everyday usage. For example Holy See (Vatican City State), Taiwan, Province of China and Congo, The Democratic Republic of the. Match countries by Code, not by Name.

  • Names can change when the list is rebuilt, because the source updates its names. Codes change much less often, so use them as the key.

Data sources

  • pycountry, a Python package that gives the ISO 3166-1 country codes and English short names. It includes a copy of the data of the Debian iso-codes project, used as it is (the iso-codes site refuses scripts, so that link could not be checked automatically). Licence: LGPL-2.1 for the package and its data; ISO's position on the names is unclear (see License).

Changes made to the source data: the script takes each country's English name and alpha-2 code from pycountry and sorts the rows by name. Nothing else is changed. The names are the ones pycountry gives, not ISO's own style with brackets such as Bahamas (the).

Not endorsed by, or affiliated with, ISO, the United Nations, pycountry or the iso-codes project.

Preparation

You need Python 3.12 or greater. To rebuild the data from the repository root:

pip install -r scripts/requirements.txt
python scripts/process.py
python scripts/validate.py

The script prints the pycountry version it used and writes data.csv. It stops with an error if pycountry returns fewer than 200 countries or a repeated code.

A GitHub workflow runs the script on the first day of every month (at 00:00 UTC) and when started by hand. It checks data.csv against datapackage.yml with Frictionless (scripts/validate.py) and commits data.csv if it changed.

License

The names and codes come from pycountry, which is licensed under the LGPL-2.1 and includes iso-codes data. The LGPL is a software licence. We found nothing that puts LGPL terms on this CSV.

The licence of the ISO 3166-1 list itself is unclear. What we checked:

  • ISO states on its site: "ISO allows free-of-charge use of its country, currency and language codes from ISO 3166, ISO 4217 and ISO 639, respectively" (ISO 3166-1 page).
  • The same ISO site says: "Any use, including reproduction requires our written permission" (ISO copyright page).
  • ISO also says it does not define the names of countries: "this information comes from United Nations sources". We did not find the terms for those names.
  • We found no ISO page that says whether the full list, with the names, may be republished under an open licence. ISO's own site and the Online Browsing Platform refuse scripted requests, so the pages above were read on ISO's committee site.

We could not establish whether the full list with the names may be reused. Using the codes is free of charge according to ISO. We think the risk is low, but the position is unclear. If you plan to republish or sell the list, ask ISO for written confirmation first.

The maintainers place only their own work (the script, the selection and arrangement of the list and the file) under the Public Domain Dedication and License (PDDL). This does not cover the ISO codes or the names themselves. See also ATTRIBUTION.txt.