List of All Countries

February 24, 2018

Back in 2012, I was sitting in front of the screen and asked myself:

What do most websites need, no matter what tech stack they are built on?

The mind flow was something like: login and registration form, ok, they have some fields, most of them empty…but one of them not - the select country field. You need to feed it with data, and where’s the data coming from?

© Penn State -

I started googling around for a good data source, searched on GitHub, but no good resource was found back then. I needed something that is available in a variety of formats, multilingual and easy to use. So scraping Wikipedia was not an option (although that would probably work for this project).

Since I enjoy building stuff, I sit down and wrote a piece of PHP code which generates a list of all country names with ISO 3166-1 codes. The list was available in JSON, yaml and PHP at first. It used ICU as the data source, so staying up to date was not the problem.

It was very simple to use, but it was a small weekend project, and I expected nothing. But project grew and got traction, I never thought something so silly as list of countries can be so popular.

Formats and Languages

Formats available:

All formats are also available in all languages.

Everybody Needs a Country Table

For developers, this is the most common case, they simply need a country databaase table. There are SQL dumps for each DBMS:

Numbers, 6 Years Later

Child Projects

Since it got popular, I realized that this data was not easily accessible for many developers. So I thought further, what else can be exported as a list of this kind?

That’s how child projects were born:

All build with List Generator, simple export engine I extracted from the original project. So, if you have idea for a similar project, feel free to use it. ;)


I just want to thank to everyone who is using, contributing or reporting issues. Yes, even you complaining about Macedonia :). I cannot change data source, I am the first who can complain about Kosovo being listed as a sovereign country, but that did happen (since version 2.0 if I remember correctly). I simply have no control over the data source, but I can say it here: Kosovo is Serbia! :)