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.
{
"id": 133024,
"name": "Mumbai",
"state_id": 4008,
"state_code": "MH",
"country_id": 101,
"country_code": "IN",
"latitude": "19.07283000",
"longitude": "72.88261000"
}Core tables, linked by ID.
Country, state and city IDs link the core records. Some cities have no state link; use a left join to keep them. This simplified view omits other tables and columns, which vary by release and export format.
Coverage and place types
This is a worldwide location dataset, not a guarantee that every city or village is listed. City records can represent settlements, neighbourhoods or administrative units; classifications and coverage vary by country and release. Review the place-type definitions before filtering rows for your application.
Keep country and state IDs with city names so places with the same name stay distinct. Check the fields in your chosen release rather than assuming every format has the same columns or every value is populated.
Download a world cities database.
Choose CSV for city rows in a spreadsheet or an import pipeline, or Parquet for column-based analysis. Need the country → state → city hierarchy together? Choose the nested JSON download or a world database file. The CSV and Parquet buttons below download cities; get the matching country and state files from the source commit for that release.
For SQL, select your database engine: MySQL, PostgreSQL, SQLite and SQL Server have separate exports. Decompress the downloaded file before importing it with your engine’s tools. For a checked CSV import, follow the CSV-to-SQLite guide.
git clone https://github.com/dr5hn/countries-states-cities-database.git cd countries-states-cities-database
- Use it in commercial products.
- Credit CountryStateCity where the data appears.
- Review applicable share-alike requirements.
Rather not host it yourself?
The same records as a live API, with search and a change feed. 3,000 free requests a month.