Every two-letter domain ending is a country-code top-level domain (ccTLD) assigned to a specific country or territory. The "tech" favourites are just borrowed: .io is the British Indian Ocean Territory, .ai is Anguilla, .tv is Tuvalu, .co is Colombia, .me is Montenegro.
TLD → country
Pass a domain ending (the leading dot is optional) and get the country that owns it:
curl https://countries.dev/tld/io[
{
"name": "British Indian Ocean Territory",
"alpha2Code": "IO",
"flag": "🇮🇴",
"topLevelDomain": [".io"],
"callingCodes": ["246"]
}
]It returns an array because a handful of TLDs map to more than one entry.
Country → TLD
Going the other way, a country's domains live on its record:
curl https://countries.dev/alpha/CO{ "name": "Colombia", "alpha2Code": "CO", "topLevelDomain": [".co"] }One gotcha
Generic TLDs like .com, .org and .dev aren't owned by a country, so they won't match — only ccTLDs resolve. If you're validating user input, treat a 404 as "not a country domain".
Written by
Dov Azencot
At
Wed Jun 24 2026