Text List of All Countries in the World

By:

on

May 29, 2007

Given the success of this simple list, I thought it would be good to see if it could be improved by opening it up to greater collaboration.

How hard would it be to simply have a text list of all countries in the world that you could use to just cut and paste for a drop-down list? I was just in the middle of creating a cck node for countries and wanted a quick list I could cut and paste from without having to muck about with doing search/replace work to get rid of the side data from Wikipedia or the UN's list of countries. The Wikipedia list also has lists of the states lacking general international recognition, of which Taiwan and Palestine are likely the most hotly contested.

 

My friend Jason Ramsey pointed out on Facebook (when my rss feed migrated there) that there were some other options, looking at "the perl cpan module Geography::Country you will notice that they use the ISO 3166-1 list which I searched for and found this list. Then you can easily do a regex to strip off the country code. Or there is also this easy to use list tool. I took the output from this and formatted it nicely for use in CCK's select forms (one value per line - key|label.) & the survey module (A list of all options - delimited by semicolons & colons - 1:red;2:blue;3:green).

It is useful to have a drop-down that returns a country code so that this can be consistently stored with your client's address. If you do need support with user input forms, please feel contact us.

I've cleaned up one source of 195 countries and have it here for future reference:

Afghanistan Albania Algeria Andorra Angola Antigua & Deps Argentina Armenia Australia Austria Azerbaijan Bahamas Bahrain Bangladesh Barbados Belarus Belgium Belize Benin Bhutan Bolivia Bosnia Herzegovina Botswana Brazil Brunei Bulgaria Burkina Burundi Cambodia Cameroon Canada Cape Verde Central African Rep Chad Chile China Colombia Comoros Congo Congo {Democratic Rep} Costa Rica Croatia Cuba Cyprus Czech Republic Denmark Djibouti Dominica Dominican Republic East Timor Ecuador Egypt El Salvador Equatorial Guinea Eritrea Estonia Ethiopia Fiji Finland France Gabon Gambia Georgia Germany Ghana Greece Grenada Guatemala Guinea Guinea-Bissau Guyana Haiti Honduras Hungary Iceland India Indonesia Iran Iraq Ireland {Republic} Israel Italy Ivory Coast Jamaica Japan Jordan Kazakhstan Kenya Kiribati Korea North Korea South Kosovo Kuwait Kyrgyzstan Laos Latvia Lebanon Lesotho Liberia Libya Liechtenstein Lithuania Luxembourg Macedonia Madagascar Malawi Malaysia Maldives Mali Malta Marshall Islands Mauritania Mauritius Mexico Micronesia Moldova Monaco Mongolia Montenegro Morocco Mozambique Myanmar, {Burma} Namibia Nauru Nepal Netherlands New Zealand Nicaragua Niger Nigeria Norway Oman Pakistan Palau Panama Papua New Guinea Paraguay Peru Philippines Poland Portugal Qatar Romania Russian Federation Rwanda St Kitts & Nevis St Lucia Saint Vincent & the Grenadines Samoa San Marino Sao Tome & Principe Saudi Arabia Senegal Serbia Seychelles Sierra Leone Singapore Slovakia Slovenia Solomon Islands Somalia South Africa South Sudan Spain Sri Lanka Sudan Suriname Swaziland Sweden Switzerland Syria Taiwan Tajikistan Tanzania Thailand Togo Tonga Trinidad & Tobago Tunisia Turkey Turkmenistan Tuvalu Uganda Ukraine United Arab Emirates United Kingdom United States Uruguay Uzbekistan Vanuatu Vatican City Venezuela Vietnam Yemen Zambia Zimbabwe

About The Author

Mike Gifford is the founder of OpenConcept Consulting Inc, which he started in 1999. Since then, he has been particularly active in developing and extending open source content management systems to allow people to get closer to their content. Before starting OpenConcept, Mike had worked for a number of national NGOs including Oxfam Canada and Friends of the Earth.