Find the physical location of an IP address with this IP Geolocation lookup tool.
Valid Input: IPv4 IPv6 example.com 8.8.8.8 2001:4860:4860::8888
What is an IP to Geolocation Lookup?
IP Geo-location involves attempting to discover the location of an IP address in the real world. IP addresses are assigned to an organization, and as these are ever-changing associations, it can be difficult to determine exactly where in the world an IP address is located.
Different services maintain datasets of this information for public use. Maxmind is one of the most well known. Its service commercial service known as GeoIP, is used for many things including fraud prevention. As an example, a merchant can use the IP location of a customer to cross-reference with Credit Card data to reduce credit card fraud.
This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com.
Maxmind has a number of products under the GeoIP brand. The commercial options are more accurate than the GeoLite2 version of the database, especially for locations outside of the United States. The Maxmind API is relatively inexpensive, so if you are interested in performing tens of thousands of IP to Geolocation queries I recommend using that service directly. The service hosted here is primarily for ad-hoc lookups, useful for quickly performing security testing or troubleshooting an issue. Note that the Free service is limited to 50 lookups a day (includes all IP Tools).
For those wishing to perform a large number of Geo IP location queries take a look at the Maxmind products, either download the Free GeoLite2 database or sign up for the commercial GeoIP service.
Free IP Geolocation (GeoIP) API
This tool is built as an easy to use API that we provide to the community. It is Free to use and signup is not required. Simply query the API and get the results in simple plain text or json
format. Use a simple curl
command to query the endpoint or use your favourite scripting language such as php
, python,
or lua
to make the HTTP request.
See below for two examples. In this example we see the use of the ?q=9.9.9.9
specifies the IP address to query.
test@ubuntu:~$ curl https://api.hackertarget.com/geoip/?q=9.9.9.9
IP: 9.9.9.9
Country: United States
State: California
City: Berkeley
Latitude: 37.8767
Longitude: -122.2676
GeoIP API - JSON response
Now take note of thejson
HTTP GET parameter to specify the output format. In this curl
example we are using the -s
parameter to hide the transfer statistics (silent) and the -H
to add the X-API-Key
header with our API key.
test@ubuntu:~$ curl -s -H "X-API-Key: zzzz" "https://api.hackertarget.com/geoip/?q=9.9.9.9&output=json" | jq
{
"city": "Berkeley",
"country": "United States",
"ip": "9.9.9.9",
"latitude": 37.8767,
"longitude": -122.2676,
"state": "California"
}
Mapping the Latitude and Longitude on a Google Map
Google has a range of mapping services. Here is a simple process to add the co-ordinates you get from the Geolocation API, to a Google map that is a static exportable image.
http://maps.googleapis.com/maps/api/staticmap?center=38.000000,-97.000000&zoom=5&size=400x400&sensor=false&markers=color:blue|38.000000,-97.000000
While this URL may look a little intimidating, it is really quite simple. The lat/long are placed at the center of the Google map and also to place the marker. The zoom will affect how much detail the map has, and the size is also obvious. Try it. Grab a location from an IP address, paste the URL above into a browser, and swap out the co-ordinates.
The Google Static Map API site has all the details regarding the parameters and usage. It is a fast and easy way to whip up a map to add to a blog post, article, or website.
Vulnerability Scans and Network Intelligence
Use CasesEnumerate and Discover
Know the Network
28 vulnerability scanners and network tools
Membership