ip-api.com

Geocoding API · Works globally · Fast IP geolocation

TL;DR

ip-api.com is one of the fastest and most reliable free IP geolocation APIs available. Hit http://ip-api.com/json/8.8.8.8 and get back country, region, city, zip code, latitude/longitude, timezone, ISP, and organization in a fraction of a second. The free tier handles 45 requests per minute from a single IP — generous for most development and personal projects. No API key needed for basic usage, with JSON, XML, and CSV formats supported.

Quick start: http://ip-api.com/json/8.8.8.8

No API key needed — just make a request!

Lookup 8.8.8.8: http://ip-api.com/json/8.8.8.8

How to Use This API

1. JSON Lookup

http://ip-api.com/json/8.8.8.8

Returns: status, country, countryCode, region, regionName, city, zip, lat, lon, timezone, isp, org, as, query.

2. Batch Lookup (up to 100 IPs)

POST multiple IPs at once (pro feature):

curl -X POST http://ip-api.com/batch -d '["8.8.8.8","1.1.1.1"]'

3. JavaScript — Get User's Location

fetch('http://ip-api.com/json/')
  .then(res => res.json())
  .then(data => {
    console.log('Your IP:', data.query);
    console.log('Location:', data.city, data.regionName, data.country);
    console.log('Coordinates:', data.lat, data.lon);
    console.log('ISP:', data.isp);
    console.log('Timezone:', data.timezone);
  });

4. Python — Simple IP Info

import requests

resp = requests.get('http://ip-api.com/json/1.1.1.1')
info = resp.json()
if info['status'] == 'success':
    print(f"IP: {info['query']}")
    print(f"Location: {info['city']}, {info['regionName']} ({info['country']})")
    print(f"ISP: {info['isp']} ({info['org']})")
else:
    print(f"Failed: {info.get('message', 'Unknown')}")

Frequently Asked Questions

What are the rate limits for the free tier?
45 requests per minute from a single IP address. For commercial/production use with higher limits, they offer a paid pro service starting at $10/month.
Do I need an API key?
For the free tier, no API key is needed. Just make requests to the JSON endpoint. The pro tier uses API keys for higher rate limits and HTTPS.
What output formats are available?
JSON (/json), XML (/xml), CSV (/csv), and Newline JSON (/line). JSON is recommended for most applications.
How accurate is the geolocation?
City-level accuracy for most IPs, ISP-level data is highly reliable. Accuracy is best for North American and European IP addresses.
What fields can I include/exclude?
Add a fields query parameter to limit response fields, e.g., /json/8.8.8.8?fields=city,country,isp for a smaller payload.
Does it support IPv6?
Yes, ip-api.com supports both IPv4 and IPv6 address lookup.

API Details

API URL
http://ip-api.com/json/{ip}
Documentation
ip-api.com/docs
Category
Geocoding
Authentication
Not Required (free tier)
Geographic Coverage
Global — IPv4 and IPv6

What You Can Build