- Help
- World city database
How to use the world city database
Pick a version, download it, and open it in Excel or load it into your database, with the commands to copy. Then get every release for 12 months at the same link.
Updated
Pick a version
Free holds the 51,032 bigger cities of 245 countries: every place of 7,500 people or more, and every country’s and region’s capital, each with its point, country, region, population and time zone. Pro holds 2,513,129 cities, towns and villages: every place in or near a village, town or city, every place of 500 people or more and every seat of a county or district, with more columns: the county or district, the settlement, elevation, UTC offset and daylight saving. Complete holds every populated place GeoNames lists, 5,001,711 in all.
- Every version is CC BY 4.0, as GeoNames’ data is: credit GeoNames where you use it. The free version also links to the database’s page.
- Pro and Complete need no link to Geloky; with them, credit the European Commission too, for the settlement column.
- Free’s columns come first in Pro and Complete, in the same order, so a formula or a query keeps working when you move up.
Download your files
The free version downloads at once: a zip with the CSV, the Excel file and a README. For Pro or Complete, FastSpring’s checkout opens on the page. Once you have paid, the page turns into your download page, and a private link to it comes by email. Pro and Complete come as two zips: the CSV, and the SQL files for MySQL and PostgreSQL.
- No Geloky account needed. Keep the email: its link is your download page for 12 months.
- Pro and Complete are too big for Excel: unzip the CSV and open it in a database, or in a tool made for big files.
- Lost the link? Find my downloads sends it again to the email you paid with.
Open it in Excel or Google Sheets
The free version’s Excel file opens as it is. To add each city’s time zone to your own list, put the database on a sheet named Cities and look each city up by its name and two-letter country code (Excel 365; in Google Sheets, wrap it in ARRAYFORMULA( )):
=XLOOKUP(A2&B2, Cities!A:A&Cities!F:F, Cities!K:K, "not found")
- Column K is timezone. Use J for the population, C and D for the latitude and longitude, or H for the region.
- Names typed without accents? Look them up in column B, city_ascii: Krakow finds Kraków.
- A name can repeat in a country: the free version has 11 places called Springfield in the United States. XLOOKUP returns the first, so add the region, column H, when it matters.
- Need Pro in Excel? Load one country: Data › From Text/CSV › Transform Data, filter iso2, then Close & Load.
Load it into a database
The SQL zip holds one file for MySQL and MariaDB, and one for PostgreSQL. Each creates a table named world_cities, with GeoNames’ id as its key, and fills it:
mysql -u you -p yourdb < world-cities-pro-mysql.sql psql -d yourdb -f world-cities-pro-postgresql.sql
Then ask it what you need, such as the places of 100,000 people or more within 50 km of Toronto, the biggest first (MySQL 8):
SELECT city, population, ROUND(ST_Distance_Sphere( POINT(lng, lat), POINT(-79.38389, 43.65333)) / 1000) AS km FROM world_cities WHERE population >= 100000 HAVING km <= 50 ORDER BY population DESC;
- Loading takes a few minutes: Pro has 2.5 million rows and Complete 5 million. Add an index on the columns you search, such as
iso2. - TRUE and FALSE load as booleans. A value the sources don’t have is NULL: many villages have no population.
- Loading a new release? Drop the old table first:
DROP TABLE world_cities;
Pick the places you need
Pro and Complete say what kind of place each one is, so you keep just what your project needs: capital marks the capitals of countries, regions and districts, population the places GeoNames counts, and settlement the kind of area each place lies in, such as the cities and towns of Kenya:
SELECT city, country FROM world_cities
WHERE settlement IN ('city', 'dense town', 'semi-dense town')
AND iso2 = 'KE';- settlement is city, dense town, semi-dense town, suburban, village, dispersed rural or mostly uninhabited: the most built-up kind of area within about a kilometre of the place.
- capital says primary for a country’s capital, admin for a region’s and minor for a county’s or district’s.
- feature_code is GeoNames’ own kind of place, such as PPLA for the seat of a region or PPLF for a farm village.
Get each update
For 12 months, every new release comes to the same link, and we email you when one is out. We aim to publish a release every quarter, from GeoNames’ newest data: new places, new names and new population figures.
- Your download page lists every release you can get, newest first.
- Bought Pro? Upgrade to Complete on that page for the $100 difference. Your updates keep their end date.
- After the 12 months, everything you downloaded stays yours; only new releases stop.
Every populated place GeoNames lists, from capitals to hamlets. The 171,436 neighbourhoods it marks as parts of a city are left out, and so are historical and abandoned places; a few districts it lists as places of their own stay in, such as Paris’s arrondissements.
The kind of area a place lies in, by the Degree of Urbanisation the European Commission and the UN use: city, dense town, semi-dense town, suburban, village, dispersed rural or mostly uninhabited. It comes from the European Commission’s settlement grid of 2025, which classes every square kilometre; a place gets the most built-up class within about a kilometre of its point.
GeoNames records the population of about 476,000 places, most cities and towns among them, from census offices and other sources; most villages have none. Some figures are a city’s own, some its urban area’s.
The IANA time zone GeoNames gives it, such as Europe/Warsaw. utc_offset is its offset in standard time, and dst says whether its clocks change in summer.
Write “Contains data from GeoNames (geonames.org), CC BY 4.0” where you use it; with Pro and Complete, add “Degree of Urbanisation: GHSL, European Commission, CC BY 4.0”. The free version also needs a visible link to geloky.com/data/world-cities.
Yes: the data is CC BY 4.0 in every version, as GeoNames’ is, so you may share it with those credits. The data licence has the details.
Your first 100 rows are free. Every day.
Free plan, no credit card · See your results on a map before you pay