Open source · free forever

Country, state and city data. Yours to download.

250 countries, 5,300+ states and 150,000+ cities in 12 formats. Linked by ID, updated frequently, maintained in the open.

Coverage varies by release. Check the API statistics and database releases for current data. Read the ODbL-1.0 licence before using the database.

GitHub contributions
Public releases
ODbL-1.0 licence
Sample records · click to drill inIN › MH › Mumbai
Countries250
States5,300+
Cities150,000+
Mumbaicities.json
{
  "id": 133024,
  "name": "Mumbai",
  "state_id": 4008,
  "state_code": "MH",
  "country_id": 101,
  "country_code": "IN",
  "latitude": "19.07283000",
  "longitude": "72.88261000"
}
Schema

Three tables, linked by ID.

Every city points to its state and country, so joins and dropdowns work the same in every format. Regions and subregions sit above countries.

countries250
idint
namestr
iso2 · iso3str
phonecodestr
currencystr
region_idfk → regions
timezonesobj
states5,300+
idint
namestr
iso2str
country_idfk → countries
typestr
latitude · longitudedec
timezonestr
cities150,000+
idint
namestr
state_idfk → states
country_idfk → countries
latitude · longitudedec
timezonestr
wikiDataIdstr

Pick a format.

JSONApps and APIsPopular
Download
MySQLImport dumpPopular
Download
PostgreSQLImport dump
Download
SQLiteSingle file
Download
SQL ServerImport dump
Download
MongoDBmongoimportPopular
Download
CSVSpreadsheetsPopular
Download
ParquetColumnar
Download
XMLLegacy systems
Download
YAMLConfig
Download
GeoJSONMaps
Download
TOONToken-oriented notation
Download
JSON and SQL world files include countries, states and cities. Other formats link to city files; additional files are on GitHub releases. Need only some fields or countries? Use the Export Tool.
git clone https://github.com/dr5hn/countries-states-cities-database.git
cd countries-states-cities-database
Licensing, in one place
  • Use it in commercial products.
  • Credit CountryStateCity where the data appears.
  • Share changes to the data itself under the same licence.
Data and data packages: ODbL-1.0Read the licence →

Rather not host it yourself?

The same records as a live API, with search and a change feed. 3,000 free requests a month.