Explore our IP Address Database Downloads for instant access to our IP address insights
Learn moreOur API returns ISO-2 country codes instead of country names. Here you can see it returning "US" for a google IP:
curl ipinfo.io/8.8.8.8/country?token=$TOKEN
US
When displaying the country to the user you might want a full country name rather than the country code though. You can do this by using one of the mapping files from country.io. The country names JSON file has a mapping from codes to English names. Here are the first few lines from that file:
{
"BD": "Bangladesh",
"BE": "Belgium",
"BF": "Burkina Faso",
"BG": "Bulgaria",
"BA": "Bosnia and Herzegovina",
"BB": "Barbados",
"WF": "Wallis and Futuna",
"BL": "Saint Barthelemy",
"BM": "Bermuda",
"...": "..."
}
You can download and import that file into your project, and then use it to lookup the full country name given the country code from our API.
If you would like to get the full database of country names from country codes as well as their continent information, checkout out our free IP address to the country database.
IPinfo is a comprehensive IP data and API provider with flexible pricing plans to meet your business needs. We handle billions of API requests per month, serving data like IP geolocation, ASN, mobile carrier detection, and more. Sign up for a free account or contact our data experts to learn more.