Skip to main content

Introduction

The Countries States Cities Database is CountryStateCity’s open geographical dataset of countries, states/provinces, and city records. Choose a versioned download for offline queries, application dropdowns and local joins.

Live Database Demo

Explore the complete database online with search and filtering capabilities.

Download Database

Access the latest database files in all supported formats from GitHub.

Database Statistics

The figures below describe one published database snapshot. City records can include settlements and administrative units; coverage varies by country and release:
6
Regions
22
Subregions
250
Countries
5,327
States
156,169
Cities
Snapshot: v5.2.0-export.1, published 3 November 2026. These counts describe that release; API data and package snapshots can differ.

Available Formats

The database is available in multiple formats to suit different technical requirements and use cases:

Database Formats

  • MySQL (.sql) - Popular open-source relational database
  • PostgreSQL (.sql) - Advanced open-source relational database
  • SQLite (.sqlite3) - Lightweight file-based database
  • SQL Server (.sql) - Microsoft SQL Server compatible format

File Distribution Matrix

Different data combinations are available depending on your needs:
Hierarchical combinations (Country+States, Country+Cities) are primarily available in JSON format for optimal nested data representation.

Key Features

Comprehensive Coverage

  • Complete geographical hierarchy from regions down to cities
  • Standardized naming using official sources and international standards
  • ISO codes for countries (ISO 3166-1) and states where available
  • Coordinate data with latitude and longitude for cities
  • Timezone information for accurate time-based applications

Data Quality

  • Regular updates with community contributions and automated monitoring
  • Multiple validation layers ensuring data consistency and accuracy
  • Source attribution for transparency and verification
  • Version control with detailed changelog tracking

Developer-Friendly

  • Multiple export formats supporting different technology stacks
  • Documented schema with format-specific differences
  • Well-documented structure with clear relationships
  • API integration for real-time access alongside offline database usage

Common Use Cases

E-commerce Platforms

Address forms, shipping calculations, tax regions, and location-based services.

Analytics & BI

Geographic data analysis, regional reporting, and location-based insights.

Mobile Applications

Location selection, offline maps, regional content delivery.

Government & Public Sector

Census data integration, administrative boundaries, public service delivery.

Quick Start Options

Choose the approach that best fits your project:
1

Direct Database Download

Download pre-built database files from GitHub in your preferred format.
Perfect for offline applications or when you need complete control over the data.
2

API Integration

Use our REST API for real-time data access without managing database files.
Use the dataset currently served by the API, with fields and endpoints determined by your plan.
3

Custom Export

Use our Export Tool to create customized datasets with specific filters and formats.
Great for specific regional focus or when you only need subset of the data.

Next Steps

Schema Documentation

Understand the database structure, tables, and relationships.

Installation Guide

Step-by-step instructions for setting up the database in different environments.
While we strive for accuracy, geographical data can change due to political developments, administrative reorganization, or other factors. Always verify critical data against official sources when needed.