List of All Countries in All Languages and All Data Formats

The scenario is simple – I need a list of all countries. This is the task that need to be solved in majority of applications. So I sit down and tried to find a good solution for this problem. No matter which programming language or data format you use in your application or language you speak, this country list will suit your needs.

I actually wrote a piece of PHP code which generates a list of all country names with ISO 3166-1 codes.

countries

Available in All Data Formats

Formats available:

New formats will be added in the future. Please feel free to suggest your favorite data formats.

Everybody Needs a Country Table

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

Country Flags

Thanks to world-flags-sprite project I was able to generate special HTML version which includes country flags. You can see demo page here. It’s just simple list, so I encourage you to iterate on it.

Multilingual

All formats are also available in multiple languages, please find full language list here.

Where Does the Data Come From?

For now, I have implemented two data importers:

So, if country list changes in the future, it will be very easy to update our country list.

All contributions, Ideas and Suggestions are Welcome

Source code for this project is hosted on github. Feel free to fork it and play with it, once you change something, just run build script and it will rebuild all country files. I will be receiving any pull requests which improve this tool. You can add new formats, new data sources or suggest improvements in comments. If you find any bug, you can report it here.

Adding New Formats and Data Sources

To add new data format just extend Exporter and implement export() method from ExporterInterface. Similar pattern applies to importers.

Use it and Give Your Feedback

I hope someone will find this country list useful. Feel free to give your feedback and join this project.

  • Steven

    South Sudan (ISO Code: SS) is not included.

    • umpirsky

      Thanks for your feedback, I opened a pull request in Symfony Locale component https://github.com/symfony/Locale/pull/1. Once they merge that, I will rebuild country list and this will be fixed.

    • Roland

      south sudan is a fake country. Made by George Clooney, to provide free oil for the white man

      • Andre

        Wtf dude? What kind of drug you’re into? LOL

      • kriansa

        LMAO!

  • Sdf

    County codes are wrong…

    • umpirsky

      Can you be more specific please? Which code for example?

  • Toni

    Some frameworks like .NET already contain this list. In addition you get all the culture specific things (thousands separator, date formats etc.).

    • umpirsky

      Yes. Some PHP frameworks (like Symfony and Zend) contain this list as well, I actually used one to fetch this data. Sometimes is handy to have table in database, and sometimes you don’t use a framework, that’s where this list jumps in.

  • Guest

    Since when is PHP a “format”? Where are the Perl/Ruby/Python/etc. arrays?

    • umpirsky

      If PHP is not a format in which data can be represented, then Perl/Ruby/Python are not as well. I would like to add Perl/Ruby/Python, so pull request would be very appreciated.

  • Kyle

    UTF-8 XML file contains following invalid characters:
    Å (0xC5), ô (0xF4), ’ (0×92), é (0xE9), ã (0xE3), í (0xED)

    • Kyle

      Disregard last, my browser straight from github.

      Nice work

  • Jalapeno

    how about including flags?

  • Pingback: Bleak. Wednesday! « myblux

  • Andrea Baron

    What about a full all-countries-all-languages dump? I started to build something like that times ago by parsing wikipedia pages, but ended up after adding italian and english (those I really needed). So someone might need something like that, don’t you think?
    Thanks anyway, it would be very useful to anyone.

  • Tommy

    If /cy/ is supposed to be Welsh (Cymraeg) as per ISO code, the names of many countries are wrong. The list is mostly just in English. Many European countries have a different name in Welsh, for example Germany is ‘Yr Almaen’. The name you have for the UK is the name of the Island not the country. ‘Prydain Fawr’ = Great Britain. ‘Y Deyrnas Unedig’ = United Kingdom. The full name of the country ‘United Kingdom of Great Britain and Northern Ireland’ would be ‘Teyrnas Unedig Prydain Fawr a Gogledd Iwerddon’

  • Anon

    Been looking for something like this for a while now. You, Sir, are a genius!

  • Pingback: Una lista multilingua di tutte le nazioni in tutti i formati | Mr.Webmaster Blog

  • David Walsh

    Netherlands Antilles (AN) is no longer. It split up into three separate entities.

    http://www.iso.org/iso/pressrelease.htm?refid=Ref1383

    EDIT: Never mind. I see that was included in the pull request below.

    • umpirsky

      Exactly, thanks anyway.

  • dacay

    Nice work! Turkish countries are all correct, but in some languages (like AF) English names are used.

  • Nema

    There’s no more Serbia and Montenegro (2003-2006)

    • umpirsky

      Thanks, I will address this to ICU. I also work on alternate solution to fetch data from CLDR.

      • Me

        Do you know ruby-cldr?

        • umpirsky

          Now I know, looks interesting, thanks.

  • Antony

    I always like to have an “alternate name” field included with my country data. E.g Netherlands might be Holland or Nederlands. This allows for ux experience such as the follow:
    http://uxdesign.smashingmagazine.com/2011/11/10/redesigning-the-country-selector/

  • http://blog.iwanluijks.nl/ Iwan Luijks

    You could double check your data with the WorldBank API (http://data.worldbank.org/node/18), or maybe use that one in addition to your datasource now :) .

  • http://twitter.com/knalli knalli

    Nice idea. There is another thing which is very similar: time zones. And they can change sometimes, perhaps more likely than country codes. Do anyone have an idea where we could grab this data from? Ideally, this should be later automatic, too.

  • http://www.wirelesssecuritycamera-system.com/ Luhkamaeni

    This is format HTML

  • Waqas

    Good Work…

  • http://blog.terava.info/ Julian Raschke

    This must be the first webdesign resource that got Taiwan right on the first try! Even the flag.

  • Facundo

    Hi everyone,
    I’m looking for a list of world languages (currently spoken) to load on a website’s DB. Does anyone know of a good resource. All I could find so far doesn’t seem very accurate. Ideally, my goal is to find a list that has values like the ones Facebook would offer such as “Spanish (Argentina)” “Spanish (México)”.
    Thanks for reading

  • http://twitter.com/louis_ferreira Louis Ferreira

    What about a list of countries and the continents they form part of?

    • umpirsky

      Well, I would like to keep it plain and simple :) How do you mean to format exported data in that case?

  • Ranomyrro-313

    Do you know where I can find a simple many-to-many table:
    Country ISO code | Official Language ISO code

    doesn’t matter which one which ISO standards 2 or 3 letters, just so it will be consist. CSV or SQL format.

    Thanks in advance.

    • umpirsky

      Is this good enough? Zend locale uses CLDR data.

  • Jasminesccott

    What the hell????

  • Kamugo

    Do you know if there is something similar with ISO 639-1 (languages)? Thanks

  • Hayleyjchivers

    Hi ,y name is hayley

  • Rohit5

    This is amazing list, thanks for sharing it.

  • Dobrosław Żybort

    Thank you for that list, but maybe you can also add three-letter country codes (ISO 3166-1 alpha-3)?

  • Lenster

    This is a great resource many thanks for your efforts! What would be equally useful (to me at least) is a list-of-all-languages-in-all-languages-and-all-data-formats

    So for example:
    English: German
    German: Deutsch
    French: Allemand

    • umpirsky

      Yes, I have plans for that. It will be easy to add this, the hardest part is renaming the project :)

      • BlackHatMario

        Hi, what about your plans? I have been waiting for this 1 year and need it very bad

        • umpirsky

          No time to do it now, but will accept pull requests.

  • Ziaries

    can you do a list of words in all spoken languages in the world, with the english translation for all the words, as a database?

    • umpirsky

      That one is hard to get :)

    • kriansa

      You gotta be kidding him.

  • krunal shah

    Thanks for the list. its very useful :)

  • Connie

    Thank you for your work!

  • La

    Dear Sir, have under consideration that Macedonia is a continent and not a country. see
    http://en.wikipedia.org/wiki/Macedonia_%28disambiguation%29
    http://en.wikipedia.org/wiki/Republic_of_Macedonia
    F.Y.R.O.M. or Republic of Macedonia is the apropriate name and this name is also partially recognized by EU members including the Greek member.
    Off course this is not the place for nationallity issues but it’s an issue of accuracy of your data since this is not a programming project and more of a resource project.

    • umpirsky

      I know. But I am not creator of this data, I’m just putting it in various handy formats. Please refer to ICU and CLDR projects since that are 2 data sources I used for this project.

  • http://www.facebook.com/dotcompals Prashanth Randadath

    thank you very much for this very useful data

  • Wesam Alalem

    Hi, great job you did here. just one note, Libya’s flag has changed, check the new one at: http://en.wikipedia.org/wiki/Libya

  • http://www.facebook.com/vusi.bennoah Vusi Ben Noah

    Zimbabwe flag is incorrect.

  • Remo

    East Germany isn’t a country

    • umpirsky

      That is the problem in CLDR database, feel free to report it. You can use ICU data instead.

  • http://twitter.com/bartmax Bart Calixto

    Problem is: For real application you will need to expand iso 3166.
    Wales, Scotland and many more aren’t on that list, yet they have different flags and currency than GB (United Kingdom) while you should want to use same ‘code’ but it’s defined as a PK. So you have to implement new codes or use another ID for PK.

    • umpirsky

      Wales and Scotland are states (correct me if I’m wrong), this list is for countries. Regarding ID, this is just a simple table, you can always alter or select-insert to make table to suit your needs.

      • http://twitter.com/bartmax Bart Calixto

        Wales is a country that is part of the United Kingdom … (from wikipedia)

        • umpirsky

          Thanks. This should be addressed to ICU/CLDR.

  • http://www.facebook.com/eric.esquivel.007 Eric Esquivel

    -

  • http://www.facebook.com/eric.esquivel.007 Eric Esquivel

    somebody has the United Nation M49 dataset with Sub-regions?
    http://millenniumindicators.un.org/unsd/methods/m49/m49regin.htm#ftna

  • http://twitter.com/bjoben Björn Skarner

    Hey,
    What a great resource! Thank you for sharing it with the world.

    Was thinking of extending this with currencies and coordinates.
    Hope it is ok if I make use of this library?

    • umpirsky

      Sure, that would be awesome. You can share details, maybe I can help. Will you fetch data from ICU/CLDR?

  • http://twitter.com/bjoben Björn Skarner

    Not that far along in my plans, will pick it up as a weekend project.
    I’ll provide more details as it progresses.
    Will look into which resource to use, but will probably continue the use of ICU/CLDR.
    Think the biggest issue will be to collect the coordinates from an open source.

  • Erik Pöhler

    does anybody have a similar list for all locales? or could I extract them from your repo? nice resource. cheers

  • Erik Pöhler

    actually with this XPath “//table//a[contains(@class,'js-directory-link')]” I could get all the locales from the HTML of the GitHub cldr page. :)

  • Oscar

    Sr. You make my day. Thank you so much! =)

  • xeryan

    can you make even a list of languages with her native name (not country) ?

  • shaviTF

    Hey.. what about one list of all language and countries each one in its own language?

  • Cron

    Might it be possible to convert this list to ISO639-1? I need flags of language codes rather than country codes. For example, en-gb is Britain, EL is Greece rather than GR.

  • ritesh Andaz

    hehehehe

  • qwerty

    Gereat work! The only point is : if i need translations of country list to some languages I have to download each translation separetely. The best thing would be to make a general DB table with all country names in all languages.

    • umpirsky

      It’s easy to generate such table. It’s open source, so anyone can take some time to do it.

  • http://www.juanescobar.org/ Juan Escobar

    What about cities? anyone know where I can find it? And thank you for the countries, really helpful.

  • Bernhard Schussek

    For the record, I’m in the process of overhauling the API of the Symfony2 Intl component to provide access to much more data than it currently provides. Basically, I’m creating a clone of ICU4J/ICU4C (the official ICU APIs) for PHP.

    This will most likely make it into Symfony 2.5. The current WIP can be seen here: https://github.com/symfony/symfony/pull/9206

    • umpirsky

      Yes, I saw your PR. Very cool. Thanks for the heads up!

  • .CW Registry Curacao

    As you probably know CURACAO, SAINT MAARTEN, BONAIRE, SABA and SAINT EUSTATIUS used to be part of the NETHERLANDS ANTILLES and since October 10, 2010 the NETHERLANDS ANTILLES
    were dissolved and new countries were born (reference links: http://www.iana.org/reports/2011/cw-report-20111003.html and http://www.iana.org/domains/root/db/cw.html).

    However the last 2 years we are
    confronted with the fact that our new countries are not appearing on the
    country lists on several (business) websites, and on the other hand the
    NETHERLANDS ANTILLES is been removed without having been replaced by CURACAO, SAINT
    MAARTEN and BES islands.

    This causes several registration
    issues when making use of e-Commerce sites, but is also making e-Business in
    general more difficult and as you can understand this has its effects on the
    economics of the new countries.

    As the manager of the .AN
    Registry responsible for .AN being phased out accordingly and on the other hand
    also the manager of the .CW Registry for CURACAO (and concerned also for the
    .SX Registry and future .BQ Registry), I am requesting your all help on how we
    can have these updates made in the country list databases all over the WWW
    a.s.a.p.?

    Other reference links:

    http://www.iana.org/reports/2011/cw-report-20111003.html
    https://www.facebook.com/pages/Cura%C3%A7ao-on-the-Web/399502033481259?ref=hl
    http://www.btnp.org/index.php?option=com_content&view=article&id=156:notice-on-new-iso-country-code-cw-for-curacao-former-island-territory-of-the-netherlands-antilles&catid=92:latest-news&Itemid=435&lang=en

    Best regards,

    Leendert J.J.Pengel

    .CW Registry of Curacao (.AN Registry former Netherlands Antilles)

    • umpirsky

      This country list is based on icu and cldr databases. So, that is the place where you should look for an update.

      • Mike

        These countries are already updated at CLDR 24 (14-09-2013)… We have the same problem, Zend 1 and 2 do not list the new countries, thus Magento is also not listing these countries. Even for Magento 1.8 released 25-09-2013. We got orders with user comments like: “I selected Aruba because there was no Curacao, please ship to Curacao.”

        Aruba Aruba AW
        Caribbean Netherlands Caribisch Nederland BQ
        Curaçao Curaçao CW
        Sint Maarten Sint-Maarten SX

        http://www.unicode.org/cldr/charts/latest/supplemental/scripts_languages_and_territories.html

  • Dean Jones

    I have also the country and the flag database dump. You can check it here on http://www.techrecite.com

  • Dean Jones

    You can also check the database dump for country,flag and ISO code here
    http://www.techrecite.com/mysql-database-dump-for-countries-currency-and-flags/

  • G Rodriguez

    Awesome resource. I’m curious, which source (ICU or CLDR) is considered to be more reliable?

  • Ashraf Badr Elden

    the best resource of countries ever !