Free IP geolocation API

Turn an IP address into a country in one request. No API key, no sign-up — call it from your server or straight from the browser.

Your IP geolocation
Detecting…

Why

IP to country, the easy way

IP → country

Resolve any IPv4 or IPv6 address to its country — name, ISO codes, capital, region and flag.

No key, runs anywhere

No account or token, and permissive CORS — call it from your server or straight from the browser.

Batch up to 100

POST an array of IPs and get them all back in one request.

Quick start

One request, no setup

No keys to generate and nothing to install — call an endpoint and parse the JSON.

The caller's own IP

curl https://countries.dev/ip

Any IP address

curl https://countries.dev/ip/8.8.8.8

Batch (up to 100)

curl -X POST https://countries.dev/ip \
  -d '["8.8.8.8","1.1.1.1"]'

In the browser

const { country } = await fetch('https://countries.dev/ip')
  .then((r) => r.json());
console.log(country.name); // visitor's country

Use it for

What developers build with it

Localize on first load

Default the currency, language or region before the user picks anything.

Geo-routing & compliance

Route traffic or gate features by country without a third-party SDK.

Analytics & fraud signals

Tag events with a country, or flag mismatched sign-ups — server-side.

IP geolocation API — FAQ

Is the IP geolocation API free?

Yes — no API key, no sign-up and no quota tier. Use it in production or side projects.

Do I need an API key?

No. Send a request to /ip (or /ip/{address}) and you get JSON back. CORS is permissive, so it also works from the browser.

Does it return city-level location?

No — it resolves an IP to its country (name, ISO codes, capital, region and flag), not a city or coordinates. Country level covers most localization, routing and compliance needs.

How accurate is it?

Country-level accuracy from the open geo-whois-asn IP database, which is refreshed regularly. On Vercel and Cloudflare the edge country header is used when available.

Can I look up many IPs at once?

Yes. POST a JSON array of up to 100 IP addresses to /ip and each is resolved in the same response.

Is it a good ipinfo or ipapi alternative?

For IP-to-country it is — free, keyless and CORS-friendly, with the full country record attached. See the docs at /docs/api/ip.

Geolocate your first request

GET countries.dev/ip returns the caller’s country. The docs cover single, batch and any-IP lookups.