Use the form above. Parameters, code examples and FAQ are grouped in the documentation section below.


IP
City
Region
Country/Code
Zip Code
Time Zone
Lat/Lon

Description
- This API requires no key or signup.
- Limit : 30 requests per minute. Once reached subsequent requests will result in error 429 (too many requests) until your quota is cleared.
- Supported formats : json and xml
- If no IP or hostname is provided it retrieves your own IP
- IPv4 and IPv6 supported
- CORS support out of the box makes this perfect for your frontend apps or websites
- XML responses use <output> as root element
Endpoint - Get IP or Hostname IP Geolocation
This endpoint retrieves geolocation information from any IPv4, IPv6 or hostname in JSON or XML format
HTTP Request: GET /v1/geolocation/format?q=ip4|ip6|hostname
examples :
- /v1/geolocation/json
- /v1/geolocation/json?q=example.com
- /v1/geolocation/xml?q=8.8.8.8
- /v1/geolocation/xml?q=2a00:1450:4006:803::200e
response :
        {
          "ip": "8.8.8.8",
          "country_code": "US",
          "country_name": "United States",
          "region_name": "Virginia",
          "city": "Ashburn",
          "zip_code": "20149",
          "time_zone": "America/New_York",
          "latitude": 39.03,
          "longitude": -77.5
        }
            


Documentation & API reference

How to use the IP Geolocation API

Look up the country, region, city, timezone and coordinates behind any IPv4 or IPv6 address.

Endpoints

EndpointReturnsExample
/v1/geolocation/jsonJSONq=8.8.8.8
/v1/geolocation/xmlXMLq=8.8.8.8

Parameters

NameTypeDefaultDescription
qstringoptionalIPv4, IPv6 or hostname. Leave empty to use the caller's own public IP.

Code examples

curl 'https://freetools.one/v1/geolocation/json?q=8.8.8.8'
const r = await fetch('https://freetools.one/v1/geolocation/json?q=8.8.8.8');
const g = await r.json();
console.log(g.city, g.country_name, g.latitude, g.longitude);
import requests

g = requests.get('https://freetools.one/v1/geolocation/json', params={'q': '8.8.8.8'}).json()
print(g['city'], g['country_name'], g['latitude'], g['longitude'])

Example response

{
  "ip": "8.8.8.8",
  "country_code": "US",
  "country_name": "United States",
  "region_name": "Virginia",
  "city": "Ashburn",
  "zip_code": "20149",
  "time_zone": "America/New_York",
  "latitude": 39.03,
  "longitude": -77.5
}

Frequently asked questions

Is the FreeTools IP geolocation API really free?

Yes. There is no API key, no account and no request signing. You only need to send the request.

Do I need an API key to use it?

No. Every endpoint on FreeTools is a plain GET request. Drop in the URL and it works.

Can I look up my own IP address?

Call /v1/geolocation/json without the q parameter and the service locates the caller's public IP address.

Does it support IPv6?

Yes. IPv4, IPv6 and hostnames are all accepted, and hostnames are resolved before the lookup.