Back to Trending
RepositoryRuby
LU

lukes/ISO-3166-Countries-with-Regional-Codes

ISO 3166-1 country lists merged with their UN Geoscheme regional codes in ready-to-use JSON, XML, CSV data sets

2.5kstars
3.3kforks
8issues
5views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: iso3166-1

#1 Repository of the week

1
TINIX TRENDING·Topic: iso3166

#1 Repository of the week

1
TINIX TRENDING·Topic: region-codes

#1 Repository of the week

ISO-3166 Country and Dependent Territories Lists with UN Regional Codes

These lists are the result of merging data from two sources, the Wikipedia ISO 3166-1 article for alpha and numeric country codes, and the UN M49 Standard country or area codes for statistical use data for countries' regional, and sub-regional codes. In addition to countries, it includes dependent territories.

The International Organization for Standardization (ISO) site provides partial data (capitalised and sometimes stripped of non-latin ornamentation), but sells the complete data set as a Microsoft Access 2003 database. Other sites give you the numeric and character codes, but there appeared to be no sites that included the associated UN-maintained regional codes in their data sets. I scraped data from the above two websites that is all publicly available already to produce some ready-to-use complete data sets that will hopefully save someone some time who had similar needs.

What's available?

The data is available in

  • JSON
  • XML
  • CSV

3 versions exist for each format

  • all.format - Everything I can find, including regional and sub-regional codes
  • slim-2.format - English name, numeric country code and alpha-2 code (e.g., NZ)
  • slim-3.format - English name, numeric country code and alpha-3 code (e.g., NZL)

What does it look like?

Take a peek inside the all, slim-2 and slim-3 directories for the full lists of JSON, XML and CSV.

Using JSON as an example:

all.json

[
  {
    "name":"Nigeria",
    "alpha-2":"NG",
    "alpha-3":"NGA",
    "country-code":"566",
    "iso_3166-2":"ISO 3166-2:NG",
    "region":"Africa",
    "sub-region":"Sub-Saharan Africa",
    "intermediate-region":"Western Africa",
    "region-code":"002",
    "sub-region-code":"202",
    "intermediate-region-code":"011"
  },
  // ...
]

slim-2.json

[
  {
    "name":"New Zealand",
    "alpha-2":"NZ",
    "country-code":"554"
  },
  // ...
]

slim-3.json

[
  {
    "name":"New Zealand",
    "alpha-3":"NZL",
    "country-code":"554"
  },
  // ...
]

Caveats

  1. Please check the data independently for accuracy before using it in any system and for any purpose
  2. Although I've tried to ensure the data is as accurate as possible, the data is not authoritative, and so should not be considered accurate

scrubber.rb

scrubber.rb is a dirty Ruby script I used to generate these files. You can run it yourself if you wish to re-generate the files fresh from the sources.

To install the gems in the Gemfile:

bundle

To run:

bundle exec ruby scrubber.rb

Timestamp

  • UN Statistical data retrieved 19 June 2024
  • Wikipedia data retrieved 19 June 2024, from a document last revised 6 June 2024

Revisions

  • 30 June 2024 - tag 10.0
  • 8 December 2020 - tag 9.0
  • 19 March 2019 - tag 8.0
  • 25 July 2018 - tag 7.0
  • 10 April 2018 - tag 6.0
  • 26 August 2016 - tag 5.0
  • 28 August 2015 - tag 4.0
  • 20 April 2014 - tag 3.0
  • 13 June 2012 - tag 2.0
  • 18 May 2011 - tag 1.0

Similar Projects

Discover other similar projects and AI models.

Repository
SheetJS/sheetjs

📗 SheetJS Spreadsheet Data Toolkit -- New home https://git.sheetjs.com/SheetJS/sheetjs

36.3k
Apr 18, 2024
RepositoryPHP
mledoze/countries

World countries in JSON, YAML, CSV and XML. Any help is welcome!

6.3k
Nov 17, 2026
RepositoryRuby
countries/countries

All sorts of useful information about every country packaged as convenient little country objects. It includes data from ISO 3166 (countries and states/subdivisions ), ISO 4217 (currency), and E.164 (phone numbers).

2.4k
Sep 5, 2026
RepositoryRuby
carmen-ruby/carmen

A repository of geographic regions for Ruby

1.2k
Jan 31, 2022
RepositoryTypeScript
AykutSarac/jsoncrack.com

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

44.7k
Nov 25, 2026
RepositoryHTML
hasaneyldrm/exercises-dataset

1,324-exercise fitness dataset — animation GIFs, 180×180 thumbnails, muscle-group & equipment data, and step-by-step instructions in 6 languages. The exercise data layer behind the LogPress app.

24.3k
Jul 16, 2026
RepositoryPython
sinaptik-ai/pandas-ai

Chat with your database or your datalake (SQL, CSV, parquet). PandasAI makes data analysis conversational using LLMs and RAG.

24.0k
Oct 28, 2025
RepositoryJavaScript
modood/Administrative-divisions-of-China

中华人民共和国行政区划:省级(省份)、 地级(城市)、 县级(区县)、 乡级(乡镇街道)、 村级(村委会居委会) ,中国省市区镇村二级三级四级五级联动地址数据。

21.0k
Dec 27, 2025
RepositoryGo
mikefarah/yq

yq is a portable command-line YAML, JSON, XML, CSV, TOML, HCL and properties processor

16.4k
Nov 27, 2026