Where is my IP location
Here you will get general information about
- Internet Protocol Registries.
- Programmatically access the location information about IP address. (IP to location).
API explained in below example use HTTP get method. you need to pass the IP parameter value
in query string.
Regional Internet Registries world MAP
The above five non profit organizations registers and administers Internet Protocol IP address.
- AfriNIC http://www.afrinic.net/
Geographical regions: Africa, portions of the Indian Ocean
- APNIC http://www.apnic.net/
Portions of Asia, portions of Oceania
- ARIN https://www.arin.net/about_us/index.html
Canada, many Caribbean and North Atlantic islands, and the United States
- LACNIC http://www.lacnic.net/en/
Latin America, portions of the Caribbean
- RIPE NCC http://www.ripe.net/
Europe, the Middle East, Central Asia
Range of IP addresses are distributed among those regions.
How to trace location of IP address:
Replace the IP address shown in below URL with the IP address you would like to locate.
What is my IP address
(URL What Is My IP Address? Lookup IP, Hide IP, Change IP, Trace IP and more... ) will
show you your IP address. As shown in above picture you can see the location of IP inside the Google MAP.
Geographical information gives you Country, State or Region, Latitude and Longitude data.
Longitude and Latitude data are enough to get exact location of IP address using Google MAP.
IP to Location API
Use below API to get IP locations programmatically.
static void Main(string args)
// string IpAddress = HttpContext.Current.Request.UserHostAddress;
string IpAddress = "188.8.131.52";
string URL = "http://api.hostip.info/country.php?IP=" + IpAddress;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
Description: Uncomment the code to get end user IP address programmatically, if you are using web application
to trace the IP location. you can also replace the hard coded IP address with the IP addresses found in Database.
You need to add reference of System.Web in your class library project or console application.
Instance of HttpWebRequest class creates the link between your server and IP to location API server.
Same way response object of HttpWebResponse holds the response of response stream returned by IP to location API.
There are so many free and commercial IP to location API provider. To send request from PHP server to IP to
location API provider, use Curl libraries. In .net application use HttpWebRequest and HttpWebREsponse classes found at System.Net namespace.
You can download the database of IP to location from below location
http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip Size around 5MB.
This database get updated monthly. Database provides only information about the country which has that IP address.
Web service for IP to Location
This is free tool and you can find below information
- Country (code/name)
- Region (code/name)
- Zip Code
Information is accurate and you can retrieve the Data in various formats like CSV, JSON or XML.