Get the capital city of any country

Look up a country's capital from its name or ISO code, or find which country a capital belongs to — in one request, with no API key.

Back

Capitals are a small lookup that's annoying to hard-code and easy to get wrong. Here's both directions.

Country → capital

The capital is a field on every country record, so any country lookup gives it to you:

curl https://countries.dev/alpha/JP
{ "name": "Japan", "alpha2Code": "JP", "capital": "Tokyo" }

Only need the capital? Trim the response:

curl "https://countries.dev/alpha/JP?fields=name,capital"

Capital → country

Have a capital and want the country? Look it up directly:

curl https://countries.dev/capital/Tokyo
[{ "name": "Japan", "alpha2Code": "JP", "capital": "Tokyo", "region": "Asia" }]

Every capital at once

For a dropdown or a quiz, pull them all in one request:

curl "https://countries.dev/countries?fields=name,capital"

One thing to know: capital is a single string, so countries with multiple or no de-facto capital are flattened to their most common one — fine for almost every UI, worth knowing if you're building a geography quiz.

Capital docs →

Written by

Dov Azencot

At

Wed Jun 24 2026