[state] Where can I get a list of Countries, States and Cities?

This probably seems like a duplicate, since there are identical questions out there.

Unfortunately all of the answers to all of these questions are missing one detail: the states.

Where can I get a list of countries, states and cities?

For example, I want this:

| Sydney  |  New South Wales  |  Australia  |

or

|  Miami  |  Florida          |  United States  |

I don't want something like this, which excludes the state:

|  Miami  |  United States  |

Is there any place where I can get this kind of data?

I've already tried the following data sources:

But all of them exclude the states.

This question is related to state country city datafeed

The answer is


The UN maintains a list of countries and "states" / regions for economic trade. That DB is available here: http://www.unece.org/cefact/locode/welcome.html



geonames.org has an api and a data dump of worldwide geographical places.


This may be a sideways answer, but if you download Virtuemart (A Joomla component), it has a countries table and all the related states all set up for you included in the installation SQL. They're called jos_virtuemart_countries and jos_virtuemart_states. It also includes the 2 and 3 character country codes. I'd attach it to my answer, but don't see a way of doing it.


Check this out! It was built no longer ago in 2014.

Get a list of country/state/city in a hierarchy using geonames webservice


Geonames has a lot of data on places (including towns and cities) but it seems to be contributed and perhaps not complete.

Perhaps also try SQL Dumpster, I've used this website a lot for these kinds of databases, cities, provinces, etc. Unfortunately it's not free but only appears to be a one-time fee.