Comprehensive country code information, including ISO 3166 codes, ITU dialing codes, ISO 4217 currency codes, and many others. Provided as a Simple Data Format Data Package. Data — Read more

Data Files

country-codes

Field Information

Field Name Order Type (Format) Description
name 1 string Country's official English short name
name_fr 2 string Country's offical French short name
ISO3166-1-Alpha-2 3 string Alpha-2 codes from ISO 3166-1
ISO3166-1-Alpha-3 4 string Alpha-3 codes from ISO 3166-1 (synonymous with World Bank Codes)
ISO3166-1-numeric 5 integer Numeric codes from ISO 3166-1 (synonymous with UN Statistics M49 Codes)
ITU 6 string Codes assigned by the International Telecommunications Union
MARC 7 string MAchine-Readable Cataloging codes from the Library of Congress
WMO 8 string Country abbreviations by the World Meteorological Organization
DS 9 string Distinguishing signs of vehicles in international traffic
Dial 10 string Country code from ITU-T recommendation E.164, sometimes followed by area code
FIFA 11 string Codes assigned by the Fédération Internationale de Football Association
FIPS 12 string Codes from the U.S. standard FIPS PUB 10-4
GAUL 13 string Global Administrative Unit Layers from the Food and Agriculture Organization
IOC 14 string Codes assigned by the International Olympics Committee
currency_alphabetic_code 15 string ISO 4217 currency alphabetic code
currency_country_name 16 string ISO 4217 country name
currency_minor_unit 17 integer ISO 4217 currency number of minor units
currency_name 18 string ISO 4217 currency name
currency_numeric_code 19 integer ISO 4217 currency numeric code
is_independent 20 string Country status, based on the CIA World Factbook

README

Comprehensive country code information, including ISO 3166 codes, ITU dialing codes, ISO 4217 currency codes, and many others. Provided as a Simple Data Format Data Package.

Data

Data comes from multiple sources as follows.

ISO 3166 offical English and French short names are from iso.org Note: ISO is no longer providing these code lists for free.

ISO 4217 currency codes are from currency-iso.org

Many other country codes are from statoids.com

Special thanks to Gwillim Law for his excellent statoids.com site (some of the field descriptions are excerpted from his site), which is more up-to-date than most similar resources and is much easier to scrape than multiple Wikipedia pages.

Preparation

This package includes a Python script to fetch current country information and output a JSON document of combined country code information. Per-country JSON documents may be keyed by any of the fields below.

CSV output is provided via the in2csv and csvcut utilities from csvkit

Run scripts/get_countries_of_earth.py --help for usage information

data/country-codes.csv

Install requirements:

pip install -r scripts/requirements.pip

Run the python script to generate json file:

python scripts/get_countries_of_earth.py -l

Convert json file to csv (and reorder columns):

in2csv data/country-codes.json > data/country-codes.csv
python scripts/reorder_columns.py

License

This material is licensed by its maintainers under the Public Domain Dedication and License.

Nevertheless, it should be noted that this material is ultimately sourced from ISO and other standards bodies and their rights and licensing policies are somewhat unclear. As this is a short, simple database of facts there is a strong argument that no rights can subsist in this collection. However, ISO state on their site:

ISO makes the list of alpha-2 country codes available for internal use and non-commercial purposes free of charge.

This carries the implication (though not spelled out) that other uses are not permitted and that, therefore, there may be rights preventing further general use and reuse.

If you intended to use these data in a public or commercial product, please check the original sources for any specific restrictions.

Related Projects at Open Knowledge