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


12631.0.73 years ago4 years agoMinified + gzip package size for @datasets/country-list in KB


Important, commonly-used datasets in high quality, easy-to-use & open form as data packages

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.

This list is updated whenever a change to the official code list in ISO 3166-1 is effected by the ISO 3166/MA.

It lists 250 official short names and code elements as of Dec 2012.



npm install @datasets/country-list


const countries = require('@datasets/country-list');

Get name of the country

name = countries.getName('GB')

Get code of the country

code = countries.getCode('Great Britain')

Get list of all country names

names = countries.getNames()

Get list of all country codes

codes = countries.getCodes()

Get a key-value object of all countries using the name as key.

countryList = countries.getNameList()

Get a key-value object of all countries using the code as key.

countryList = countries.getCodeList()


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 their rights and licensing policy is 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 find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.