dr5hn/countries-states-cities-database

Public

🌍 Discover our global repository of countries, states, and cities! 🏙️ Get comprehensive data in JSON, SQL, PSQL, SQLSERVER, MONGODB, SQLITE, XML, YAML, and CSV formats. Access ISO2, ISO3 codes, country code, capital, native language, timezones (for countries), and more. #countries #states #cities

  • Stars9.9k+35 tuần này
  • Forks3k
  • Watchers106
  • Issues13
  • Ngày tạo20/07/2018
  • Cập nhật gần nhất31/10/2026
  • Ngôn ngữPython
  • Giấy phépODbL-1.0
README.md33.6 KBRaw

banner

Countries States Cities Database

A comprehensive, community-maintained dataset of countries, states, counties, cities, and postcodes — published in 12 formats and free under the Open Database License (attribution required).

License: ODbL-1.0 GitHub stars release NPM PyPI

Total Regions : 6
Total Sub Regions : 22
Total Countries : 250
Total States/Regions/Municipalities : 5,299
Total Cities/Towns/Districts : 153,765
Total Postcodes : 725993 (116 countries)
Total Timezones : 427 (100% IANA coverage)
Last Updated On: October 19, 2026


Build & Launch Websites Faster with MakeMySiteLive Finding a remote job? Go check remotegig.in


Recommended for production

The two managed products below are the fastest path to shipping. They're actively maintained, billed for sustainability, and back the rest of the ecosystem.

REST API — api.countrystatecity.in

Query countries, states, cities, and postcodes from any language. Free tier for prototyping; paid tiers for production.

curl https://api.countrystatecity.in/v1/countries/IN/states/MH/cities \
  -H "X-CSCAPI-KEY: $YOUR_API_KEY"

Python applications can use the official sync and async client:

pip install countrystatecity-api
export CSC_API_KEY="YOUR_API_KEY"
from countrystatecity import CountryStateCity

with CountryStateCity() as client:
    states = client.get_states_of_country("IN")
    print([state["name"] for state in states[:3]])

Get a free API key → · Compare plans · Documentation · Interactive playground · OpenAPI spec · Status

Export Tool — export.countrystatecity.in

Build tailored datasets in your browser — pick country, region, format, and field selection, then download.

Launch the Export Tool →


Other ways to use the data

NPM (JavaScript / TypeScript)
Package GitHub NPM
@countrystatecity/countries GitHub npmjs.com
@countrystatecity/countries-browser GitHub npmjs.com
@countrystatecity/currencies GitHub npmjs.com
@countrystatecity/timezones GitHub npmjs.com
@countrystatecity/translations GitHub npmjs.com
@countrystatecity/cli GitHub npmjs.com
PyPI (Python)

Use countrystatecity-api for live, managed data. The suffixed packages are versioned offline snapshots.

Nội dung README thuộc về dr5hn và cộng đồng đóng góp, giấy phép ODbL-1.0. Nguồn: github.com/dr5hn/countries-states-cities-database