There is no formula for converting an IP address to a geographic location. You will find out through whom the IP address is registered. This is not perfect. A block of addresses owned by Google or HP may not tell you much, as they are distributed in many places. Looking at the network path to reach the address (routers along the way) gives a few more tips. Most geolocation databases are compiled in this way - using known information about neighboring IP addresses and making the best estimate. Some providers will ask for information, asking you to correct their best guess about where your IP address is.
source share