Now you can request additional data and/or customized columns!

Try It Now!

Comprehensive country codes: ISO 3166, ITU, ISO 4217 currency codes and many more

Certified

core

Files Size Format Created Updated License Source
2 1MB csv zip 6 years ago 3 years ago Open Data Commons Public Domain Dedication and License v1.0 United Nations Protocol and Liaison Service Unicode Common Locale Data Repository (CLDR) Project United Nations Department of Ecoonomic and Social Affairs Statistics Division SIX Interbank Clearing Ltd (on behalf of ISO) Statoids Geonames US Securities and Exchange Commission
Comprehensive country code information, including ISO 3166 codes, ITU dialing codes, ISO 4217 currency codes, and many others. Provided as a Tabular Data Package: view datapackage Data Data are fetched from multiple sources: Official formal and short names (in English, French, Spanish, Arabic, read more
Download Developers

Data Files

Download files in this dataset

File Description Size Last changed Download
country-codes 127kB csv (127kB) , json (518kB)
country-codes_zip Compressed versions of dataset. Includes normalized CSV and JSON data with original data and datapackage.json. 155kB zip (155kB)

country-codes  

Signup to Premium Service for additional or customised data - Get Started

This is a preview version. There might be more data in the original version.

Field information

Field Name Order Type (Format) Description
FIFA 1 string Codes assigned by the Fédération Internationale de Football Association
Dial 2 string Country code from ITU-T recommendation E.164, sometimes followed by area code
ISO3166-1-Alpha-3 3 string Alpha-3 codes from ISO 3166-1 (synonymous with World Bank Codes)
MARC 4 string MAchine-Readable Cataloging codes from the Library of Congress
is_independent 5 string Country status, based on the CIA World Factbook
ISO3166-1-numeric 6 string Numeric codes from ISO 3166-1
GAUL 7 string Global Administrative Unit Layers from the Food and Agriculture Organization
FIPS 8 string Codes from the U.S. standard FIPS PUB 10-4
WMO 9 string Country abbreviations by the World Meteorological Organization
ISO3166-1-Alpha-2 10 string Alpha-2 codes from ISO 3166-1
ITU 11 string Codes assigned by the International Telecommunications Union
IOC 12 string Codes assigned by the International Olympics Committee
DS 13 string Distinguishing signs of vehicles in international traffic
UNTERM Spanish Formal 14 string Country's formal Spanish name from UN Protocol and Liaison Service
Global Code 15 string Country classification from United Nations Statistics Division
Intermediate Region Code 16 string Country classification from United Nations Statistics Division
official_name_fr 17 string Country or Area official French short name from UN Statistics Divsion
UNTERM French Short 18 string Country's short French name from UN Protocol and Liaison Service
ISO4217-currency_name 19 string ISO 4217 currency name
Developed / Developing Countries 20 string Country classification from United Nations Statistics Division
UNTERM Russian Formal 21 string Country's formal Russian name from UN Protocol and Liaison Service
UNTERM English Short 22 string Country's short English name from UN Protocol and Liaison Service
ISO4217-currency_alphabetic_code 23 string ISO 4217 currency alphabetic code
Small Island Developing States (SIDS) 24 string Country classification from United Nations Statistics Division
UNTERM Spanish Short 25 string Country's short Spanish name from UN Protocol and Liaison Service
ISO4217-currency_numeric_code 26 string ISO 4217 currency numeric code
UNTERM Chinese Formal 27 string Country's formal Chinese name from UN Protocol and Liaison Service
UNTERM French Formal 28 string Country's formal French name from UN Protocol and Liaison Service
UNTERM Russian Short 29 string Country's short Russian name from UN Protocol and Liaison Service
M49 30 number UN Statistics M49 numeric codes (nearly synonymous with ISO 3166-1 numeric codes, which are based on UN M49. ISO 3166-1 does not include Channel Islands or Sark, for example)
Sub-region Code 31 string Country classification from United Nations Statistics Division
Region Code 32 string Country classification from United Nations Statistics Division
official_name_ar 33 string Country or Area official Arabic short name from UN Statistics Divsion
ISO4217-currency_minor_unit 34 string ISO 4217 currency number of minor units
UNTERM Arabic Formal 35 string Country's formal Arabic name from UN Protocol and Liaison Service
UNTERM Chinese Short 36 string Country's short Chinese name from UN Protocol and Liaison Service
Land Locked Developing Countries (LLDC) 37 string Country classification from United Nations Statistics Division
Intermediate Region Name 38 string Country classification from United Nations Statistics Division
official_name_es 39 string Country or Area official Spanish short name from UN Statistics Divsion
UNTERM English Formal 40 string Country's formal English name from UN Protocol and Liaison Service
official_name_cn 41 string Country or Area official Chinese short name from UN Statistics Divsion
official_name_en 42 string Country or Area official English short name from UN Statistics Divsion
ISO4217-currency_country_name 43 string ISO 4217 country name
Least Developed Countries (LDC) 44 string Country classification from United Nations Statistics Division
Region Name 45 string Country classification from United Nations Statistics Division
UNTERM Arabic Short 46 string Country's short Arabic name from UN Protocol and Liaison Service
Sub-region Name 47 string Country classification from United Nations Statistics Division
official_name_ru 48 string Country or Area official Russian short name from UN Statistics Divsion
Global Name 49 string Country classification from United Nations Statistics Division
Capital 50 string Capital city from Geonames
Continent 51 string Continent from Geonames
TLD 52 string Top level domain from Geonames
Languages 53 string Languages from Geonames
Geoname ID 54 number Geoname ID
CLDR display name 55 string Country's customary English short name (CLDR)
EDGAR 56 string EDGAR country code from SEC

Similar Datasets

Country list

core


CSV,JSON


View ›

Language codes

core


CSV,JSON


View ›

Airport codes

core


CSV,JSON


View ›

Continent codes

core


CSV,JSON


View ›

Integrate this dataset into your favourite tool

Use our data-cli tool designed for data wranglers:

data get https://datahub.io/core/country-codes
data info core/country-codes
tree core/country-codes
# Get a list of dataset's resources
curl -L -s https://datahub.io/core/country-codes/datapackage.json | grep path

# Get resources

curl -L https://datahub.io/core/country-codes/r/0.csv

curl -L https://datahub.io/core/country-codes/r/1.zip

If you are using R here's how to get the data you want quickly loaded:

install.packages("jsonlite", repos="https://cran.rstudio.com/")
library("jsonlite")

json_file <- 'https://datahub.io/core/country-codes/datapackage.json'
json_data <- fromJSON(paste(readLines(json_file), collapse=""))

# get list of all resources:
print(json_data$resources$name)

# print all tabular data(if exists any)
for(i in 1:length(json_data$resources$datahub$type)){
  if(json_data$resources$datahub$type[i]=='derived/csv'){
    path_to_file = json_data$resources$path[i]
    data <- read.csv(url(path_to_file))
    print(data)
  }
}

Note: You might need to run the script with root permissions if you are running on Linux machine

Install the Frictionless Data data package library and the pandas itself:

pip install datapackage
pip install pandas

Now you can use the datapackage in the Pandas:

import datapackage
import pandas as pd

data_url = 'https://datahub.io/core/country-codes/datapackage.json'

# to load Data Package into storage
package = datapackage.Package(data_url)

# to load only tabular data
resources = package.resources
for resource in resources:
    if resource.tabular:
        data = pd.read_csv(resource.descriptor['path'])
        print (data)

For Python, first install the `datapackage` library (all the datasets on DataHub are Data Packages):

pip install datapackage

To get Data Package into your Python environment, run following code:

from datapackage import Package

package = Package('https://datahub.io/core/country-codes/datapackage.json')

# print list of all resources:
print(package.resource_names)

# print processed tabular data (if exists any)
for resource in package.resources:
    if resource.descriptor['datahub']['type'] == 'derived/csv':
        print(resource.read())

If you are using JavaScript, please, follow instructions below:

Install data.js module using npm:

  $ npm install data.js

Once the package is installed, use the following code snippet:

const {Dataset} = require('data.js')

const path = 'https://datahub.io/core/country-codes/datapackage.json'

// We're using self-invoking function here as we want to use async-await syntax:
;(async () => {
  const dataset = await Dataset.load(path)
  // get list of all resources:
  for (const id in dataset.resources) {
    console.log(dataset.resources[id]._descriptor.name)
  }
  // get all tabular data(if exists any)
  for (const id in dataset.resources) {
    if (dataset.resources[id]._descriptor.format === "csv") {
      const file = dataset.resources[id]
      // Get a raw stream
      const stream = await file.stream()
      // entire file as a buffer (be careful with large files!)
      const buffer = await file.buffer
      // print data
      stream.pipe(process.stdout)
    }
  }
})()

Read me

goodtables.io

Comprehensive country code information, including ISO 3166 codes, ITU dialing codes, ISO 4217 currency codes, and many others. Provided as a Tabular Data Package: view datapackage

Data

Data are fetched from multiple sources:

Official formal and short names (in English, French, Spanish, Arabic, Chinese, and Russian) are from United Nations Protocol and Liaison Service

Customary English short names are from Unicode Common Locale Data Repository (CLDR) Project.

Note: CLDR shorter names “ZZ-alt-short” are used when available

ISO 3166 official short names (in English, French, Spanish, Arabic, Chinese, and Russian) are from United Nations Department of Ecoonomic and Social Affairs Statistics Division

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.

Capital cities, languages, continents, TLDs, and geonameid are from geonames.org

EDGAR codes are from sec.gov

Preparation

This package includes Python scripts to fetch current country information from various data sources and output CSV of combined country code information.

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

NOTE/TODO: currently, preparation requires manual process to download and rename 6 CSV files from https://unstats.un.org/unsd/methodology/m49/overview/

data/country-codes.csv

Install requirements:

pip install -r scripts/requirements.pip

Run GNU Make to generate data file:

make country-codes.csv

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.


Keywords and keyphrases: country codes, iso 4217, ISO 3166 codes, ITU dialing codes, Country or Area official names in different languages, Country Area names in Arabic, Country Area names in Chinese, Country Area names in English, Country Area names in Spanish, Country Area names in French, Country Area names in Russian, Alpha-2 Alpha-3 and Numeric codes from ISO 3166-1, ISO 4217 country name and currency number of minor units, ISO 4217 currency name and currency numeric code, UNTERM, CLDR display name, Distinguishing signs of vehicles, Country classification, EDGAR country code, FIFA codes, FIPS codes, GAUL codes, Geoname ID, Global Code and name, IOC, ITU, Intermediate Region Code, Intermediate Region Name, Land Locked Developing Countries, Least Developed Countries, Machine-Readable Cataloging codes, Region Code and Name, Small Island Developing States (SIDS), Sub-region Code and Name, Top level domain from Geonames, WMO, country status.
Datapackage.json

Request Customized Data


Notifications of data updates and schema changes

Warranty / guaranteed updates

Workflow integration (e.g. Python packages, NPM packages)

Customized data (e.g. you need different or additional data)

Or suggest your own feature from the link below