Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

As all Internet users, I've visited web sites which appear to know in which country and city I'm located. I understand that these web sites typically look up my IP address in a database which maps IP address to country / city which works fairly well. I've also seen companies selling this type of database.

How is this database, which maps an IP address to a country / city, created in the first place?

Is there a central database somewhere where each ISP registers the link between IP address and country/city? Or does the companies selling geolocation databases contact different ISP's and purchase the mapping information from them? Or is there some organization 'above' ISP's who keeps track of this?

share|improve this question

3 Answers 3

Your ISP gives you your IP address. They own a block of IP addresses that, in one way or another, originate from the IANA.

The business that purchases those IP blocks has a physical location/address that can help place them geographically. (it only helps because, for instance, they can hand out an IP address to someone living in a different geographical area)

On average though, that method generally works.

Additionally, the ISP may have their own DNS servers. When you navigated to that website, your ISP's DNS server helped your browser get there. That DNS server also has a public IP address that is owned and registered.

In the end, I think it often boils down the address of the owner of the IP address as registered with the IANA.

share|improve this answer
I don't think its as easy as that. Lets take an example. The Swedish ISP Comhem has customers in entire Sweden. According to ripe.net, the IP address I am currently using is owned by Comhem located in Stockholm (the entire range - But I'm located 600KM from Stockholm and if I perform a GEO lookup on my IP address, it will tell me what city I'm in. Just using the owners address would be far to vague to include city properly. –  Martin Jul 6 '12 at 20:37
Also, I don't see what the DNS has to do with it. Yes, my PC will use my ISP's DNS server when performing a query. But this only resolves host name to a specific IP address. But that's not linked to geo location at all. Also, a geo lookup server won't know what DNS server I'm using. –  Martin Jul 6 '12 at 20:39
@Martin: It's partially related because some authoritative DNS servers (e.g. those which host google.com) are configured to return different results depending on the asker's address. Usually they only see the addresses of ISP caching servers, not the user's directly, but that's sufficient to redirect the user to a geographically close web server. –  grawity Jul 6 '12 at 20:58
@Martin I take your point with the ISP being remote. However, and to be honest I'm speculating here, I would be surprised if the ISPs didn't distribute sub-blocks based on political geography (cities, etc.). Your linked article states the primary source of data is the registry itself, secondary is the ISP, and beyond that, just data mining and your own various user or account data. I still think the owner of the IP is the source for most of the data. –  JoshP Jul 6 '12 at 21:01

Source Wikipedia: http://en.wikipedia.org/wiki/W3C_Geolocation_API#How_does_Geolocation_work.3F

Though the implementation is not specified, W3C Geolocation API is built on extant technologies, and is heavily influenced by Google Gears Geolocation API. Example: Firefox's Geolocation implementation[7] uses Google's network location provider.[8] Google Gears Geolocation works by sending a set of parameters that could give a hint as to where the user's physical location is to a network location provider server, which is by default the one provided by Google (code.l.google.com).[9] Some of the parameters are lists of sensed mobile cell towers and Wi-Fi networks, all with sensed signal strengths. These parameters are encapsulated into a JavaScript Object Notation (JSON) message and sent to the network location provider via HTTP POST. Based on these parameters, the network location provider can calculate the location. Common uses for this location information include enforcing access controls, localizing and customizing content, analyzing traffic, contextual advertising and preventing identity theft.[10]

share|improve this answer
Well sir, the Geolocation that runs in your browser is the one thats described there. Which answers "how geolocation based.on IP works" cause it works the same.for ip address and wireless devices. –  Rhyuk Jul 6 '12 at 20:41
And next time be a little bit more respectful. –  Rhyuk Jul 6 '12 at 20:45
up vote -1 down vote accepted

Found answer on http://en.wikipedia.org/wiki/Geolocation_software, section Data sources.

share|improve this answer
The content of a link might change (or even die completely). Please add information to your answer, eg by quoting the relevant parts of the article. –  Baarn Jul 6 '12 at 21:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.