IP2Location

Development API · Works globally · IP geolocation · No API key

TL;DR

IP2Location provides a free IP geolocation API that transforms any IP address into rich geographic and network data: country, region, city, latitude/longitude, ZIP code, ISP, domain, timezone, and connection type. The free tier supports basic lookups with reasonable rate limits. Just pass an IP as a query parameter and get structured JSON back. Ideal for localization, analytics enrichment, fraud detection, and regional content targeting.

Quick start: https://api.ip2location.io/?ip=8.8.8.8

No API key needed — just make a request!

How to Use This API

1. Basic IP Lookup

Look up Google's public DNS (8.8.8.8):

https://api.ip2location.io/?ip=8.8.8.8

Returns country, region, city, lat/lng, ISP (Google), domain, and more.

2. Lookup Your Own IP

Omit the IP parameter to get the location of the requesting client:

https://api.ip2location.io/

3. JavaScript — Get Visitor Location

fetch('https://api.ip2location.io/')
  .then(r => r.json())
  .then(data => {
    console.log(`You're in ${data.city_name}, ${data.country_name}`);
    console.log(`ISP: ${data.isp}`);
    console.log(`Time zone: ${data.time_zone}`);
  });

4. Python — Bulk Lookup

import requests

ips = ['8.8.8.8', '1.1.1.1', '208.67.222.222']
for ip in ips:
    data = requests.get(
        'https://api.ip2location.io/',
        params={'ip': ip}
    ).json()
    print(f"{ip} -> {data['city_name']}, {data['country_name']} ({data['isp']})")
Look up 8.8.8.8: https://api.ip2location.io/?ip=8.8.8.8

Frequently Asked Questions

What data fields does IP2Location return?
The response includes: ip, country_code, country_name, region_name, city_name, latitude, longitude, zip_code, time_zone, isp, domain, net_speed, idd_code, area_code, weather_station_code, and mcc/mnc/mobile_brand.
Is the free tier rate limited?
The free tier of IP2Location has reasonable rate limits. For high-volume production use, consider registering for a free API key which provides higher limits.
Can I use it without an API key?
Yes, basic lookups work without a key. However, registering for a free key gives you access to higher rate limits and additional data fields.
How accurate is the geolocation?
Accuracy varies by IP type. City-level accuracy is typically high for fixed-line ISPs. Mobile and corporate VPN IPs may resolve to a different region.
What format does the response use?
The API returns JSON by default. The response structure is flat with all fields at the top level of the JSON object.
Does it support IPv6?
Yes, IP2Location supports both IPv4 and IPv6 addresses. Simply pass an IPv6 address as the ip parameter.

API Details

API URL
https://api.ip2location.io/
Documentation
www.ip2location.io
Category
Development
Authentication
Not Required (optional free key for higher limits)
Geographic Coverage
Global — IP addresses worldwide

What You Can Build