"How many countries are there" has no single answer, because lists mix sovereign states with dependent territories like Puerto Rico, Greenland and Bermuda. The independent flag lets you draw the line yourself.
Sovereign states only
curl "https://countries.dev/independent/true?fields=name"This returns 202 countries — close to the 193 UN members plus a handful of widely recognised states. It's the list you want behind a "nationality" dropdown.
Territories and dependencies
curl "https://countries.dev/independent/false?fields=name,demonym"48 of them: the overseas regions, crown dependencies and similar. Keeping them separate is what stops Réunion and France both showing up as standalone "countries" in a picker.
Filtering the full list yourself
The flag is on every country record, so you can split a list you already have without a second request:
const all = await fetch("https://countries.dev/countries?fields=name,independent")
.then((r) => r.json());
const sovereign = all.filter((c) => c.independent);
const territories = all.filter((c) => !c.independent);This also matters for rankings: sorting by area or by population over the sovereign-only set is what keeps Antarctica and dependent territories out of your "biggest countries" list.
Written by
Dov Azencot
At
Thu Jun 25 2026