How to Find the Location of an IP Address | Blog | IP Geolocation API
Read the other articles

How to Find the Location of an IP Address

IP addresses are the Internet's equivalent of postal addresses. Every device connected to the Internet has an IP address (and usually more than one).

First, you've got local IP addresses. These addresses are used to locate a device on a local network. Let's say you have a wireless router at home with three separate devices connected to it: a TV, laptop, and mobile phone. Each of these three devices would have a unique "local IP address" that your router would use to route information to and from these devices over the local network.

Next, you've got public IP addresses. These addresses are what connects a device to the public Internet and allow it to send and receive information all over the world. Public IP addresses are globally unique.

If you're trying to find the location of a device with a specific IP address, there are a few things you need to know.

You Cannot Geolocate Local IP Addresses

Local IP addresses are the equivalent of a street number. If you live at 123 Main Street in Walnut Creek, California, 94597, you can think of your local IP address as "123". While there may be only one "123" on Main Street, there are a great may "123s” in the world, and unless you have very specific knowledge about where in the world this particular "123" is, the "123" on its own is essentially useless.

You can't address a piece of mail to just "123" and expect the mailman to be able to deliver it. In the same way, you can't expect devices on the public Internet to be able to find and communicate with a device by only its local IP address.

With that said, if you're trying to find the precise location of a device only having a local IP address, there's not much you can do.

You Can Geolocate a Public IP Address

On the other hand, if you have a public IP address and are trying to locate where in the world a given device might be located, there is a way to track down its approximate location. This technique is known as "IP geolocation".

In order to understand how IP geolocation works, you first need to understand how public IP addresses are created and assigned.

In order for a device to connect to the public Internet and be able to communicate with other devices around the world, the device needs a public IP address. Public IP addresses are created and assigned to Internet Service Providers (ISPs) via a nonprofit organization called IANA (the Internet Assigned Numbers Authority).

When an Internet provider like Sonic starts operating, they'll request a block of IP addresses from IANA using their formal procedures. Eventually, they'll be assigned a range of IP addresses via a Regional Internet Registry (RIR), depending on where in the world the Internet provider is located.

Once they're assigned a block of IP addresses, the Internet provider will begin assigning these public IP addresses to each one of their customers. For example, if you sign up for home Internet service through Sonic, they'll give your home network a single public IP address. This IP address will usually be connected to your home router, which all of your devices will then connect to.

In this way, your home network is likely to have a single public IP address and a single device that communicates with the public Internet (your router), while all the devices in your home: your TV, your laptop, and your mobile phone all have local IP addresses assigned to them by the router. These local devices will then communicate with the router, which will relay their requests over the public Internet using the public IP address that was assigned to the router via the Internet provider (Sonic, in this case).

So where does geolocation come in? So far, you've learned how public IP addresses are assigned, but not how they're geolocated.

In short: IP address geolocation data is aggregated by third-party database providers (like us), from a variety of sources:

  • Information from Internet service providers who provide information like GPS coordinates and postal addresses of IP addresses they assign. For example, if Sonic gave you a public IP address at your home, they may record that data and share it out with third parties.
  • Data mining. A website might ask you where you live and may use that data to map your public IP address to your address. If this data is later shared with third parties, it could be used to geolocate your public IP address.
  • Merging databases from various providers. There are several large IP geolocation providers. By merging these databases, you can improve the coverage of IP geolocation data.
  • Latency-based geolocation techniques. Because communicating to devices over the public Internet requires routing between many different devices across the world, there are various techniques that can be used to geolocate an IP address by analyzing the time it takes to communicate with a device in a known location.

By relying on all of these data types as well as filtering out anomalies and performing some basic data scrubbing techniques, large IP geolocation providers are able to provide fairly accurate location data for a given public IP address.

But… IP Geolocation Data May Not Be Perfect

Unfortunately, because there is no "standard" way to record IP geolocation data at its source, there will never be a foolproof way to accurately geolocate each and every publicly assigned IP address.

This means that even if you purchase IP geolocation data from one of the large data providers, there will be some circumstances where location data won't be 100% accurate.

The Best Way to Find the Location of an IP Address

Now that you know how IP geolocation works, you're probably wondering what the best way to find the location of an IP address is.

Well, as mentioned above, all IP geolocation data is aggregated by various companies that package and sell this data. Each provider has their own techniques for gathering and scrubbing IP geolocation data in a way that makes sense to them.

While we might be biased, we think our solution is the best, as we aggregate IP geolocation data from a number of sources and put a considerable amount of time and effort into scrubbing bad and anomalous data.

If you'd like to locate an IP address using our IP geolocation services, you have a few options:

  • 1. You can perform an individual IP address lookup at the bottom of our website on the homepage: https://geo.ipify.org
  • 2. You can sign up for our developer service and use our API to get 1,000 free IP geolocation requests per month. If you're building an application where you need IP geolocation data, this is going to be the simplest and most effective route.
  • 3. You can download our IP geolocation database if you'd like the whole of the raw IP geolocation data. If you'd like to perform a large amount of IP geolocation analysis, this may be the best option as you'll have access to all the raw data and can use it in any way you want.

Regardless of which method you choose to locate IP addresses, the data you'll be able to get through our service is the same. For each public IP address you'll be able to discover:

  • The country of an IP address
  • The region of an IP address (usually a state or province)
  • The city of an IP address
  • The latitude of an IP address
  • The longitude of an IP address
  • The postal code of an IP address
  • The timezone in which an IP address resides

For example, if you perform a lookup on the IP address "8.8.8.8", you'll get back the following data:

{
  "ip": "8.8.8.8",
  "location": {
    "country": "US",
    "region": "California",
    "city": "Mountain View",
    "lat": 37.40599,
    "lng": -122.078514,
    "postalCode": "94043",
    "timezone": "-07:00",
    "geonameId": 5375481
  }
}

Have questions about how IP address geolocation works? Contact us today and we'll do our best to give you an answer!

Read the other articles
Try out IP Geolocation API free of charge
Get started
Have questions?

Or shoot us an email to