Skip to main content

IP Lookup API: Free IP Geolocation APIs for Developers

Find the best free IP geolocation APIs for developers. Includes code examples in JavaScript and Python for ip-api.com, ipapi.co, and ipinfo.io.

IP lookup APIs let developers programmatically retrieve geolocation and network data for any IP address. They return JSON responses that can be integrated into fraud detection systems, analytics pipelines, access control logic, or content personalization engines. Several free-tier IP geolocation APIs are available with generous rate limits suitable for most small to medium applications.

How to Test an IP Lookup API Response

  1. Use the IP Lookup tool — Enter any IP address to see what data is available before integrating an API.
  2. Choose an API provider — Select from the free options listed below based on your rate limit needs.
  3. Make a GET request — Pass the IP as a URL parameter and receive a JSON response.
  4. Parse the response — Extract country, city, ISP, and other fields you need for your application logic.

Free IP Geolocation APIs with Code Examples

# ipapi.co — free tier: 1000 requests/day, no key needed
curl \"https://ipapi.co/8.8.8.8/json/\"

# ip-api.com — free tier: 45 requests/minute, no key needed
curl \"http://ip-api.com/json/8.8.8.8\"

# ipinfo.io — free tier: 50,000 requests/month with free key
curl \"https://ipinfo.io/8.8.8.8?token=YOUR_TOKEN\"

# Example JSON response (ip-api.com):
{
  \"status\": \"success\",
  \"country\": \"United States\",
  \"countryCode\": \"US\",
  \"region\": \"CA\",
  \"city\": \"Mountain View\",
  \"isp\": \"Google LLC\",
  \"org\": \"AS15169 Google LLC\",
  \"lat\": 37.4056,
  \"lon\": -122.0775,
  \"query\": \"8.8.8.8\"
}

Fetching IP Data in JavaScript

async function getIPData(ip) {
  const res = await fetch(`https://ipapi.co/${ip}/json/`);
  const data = await res.json();
  return {
    country: data.country_name,
    city: data.city,
    isp: data.org,
    timezone: data.timezone,
  };
}

getIPData('8.8.8.8').then(console.log);

Fetching IP Data in Python

import requests

def get_ip_data(ip: str) -> dict:
    response = requests.get(f'http://ip-api.com/json/{ip}')
    return response.json()

data = get_ip_data('8.8.8.8')
print(data['country'], data['city'], data['isp'])

Why Use an IP Lookup API?

  • Automate geolocation at scale — Look up thousands of IPs from server logs to enrich analytics without manual work.
  • Real-time fraud signals — Check incoming request IPs during checkout or registration to flag suspicious locations.
  • Redirect and localization — Automatically redirect users to a country-specific URL based on their IP's detected country.
  • Rate limit by country — Implement country-level rate limiting or access controls at the application layer.

Test IP data before integrating an API using the IP Lookup tool — see live results for any IP address instantly.

Try IP Lookup Free

Find location and details of any IP address.

Use IP Lookup →