I am looking for IP address to geocoding data sources and/or APIs. Open to any formats, and the main concern is the quality, depth, and freshness of the data.

4 Answers 4


There are three sources that may be helpful:

  • 1
    Interesting, but I don't think the Google Map API and IPInfoDB qualify as open data :-)
    – Nicolas Raoul
    May 26, 2014 at 3:12
  • PInfoDB requires registration for use of the API, but for the same reasons many sites do in collecting metrics, rather than charging for the service. I included Google Map API only as a secondary component that may help @blunders to map the results of any earlier query. May 26, 2014 at 3:47
  • 1
    They seem (but I am not 100% sure) to use data from lite.ip2location.com/databases . These databases come either with a commercial license or with a free license. The free license says The LITE edition is an open-source version of database with limited accuracy & number of records compares to commercial release. It is free for personal or commercial use with attribution required. So I was wrong, IPInfoDB seems to qualify as open data indeed :-)
    – Nicolas Raoul
    May 26, 2014 at 3:57

For a project I use the GeoLite City download from MaxMind. The license is "Creative Commons Attribution-ShareAlike 3.0 Unported License."

This file is usually updated every month, so I have a script that checks if the file has been updated and only downloads/unzips if it has:

wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

I choose the binary file, and not the CSV, because there is a nice python library to load this data and then do the lookups: pygeoip. For thousands of IP addresses, I found this process much faster than sending each IP address to an external web API.

A python snippet to load the IP table and then do a lookup:

import pygeoip
gi = pygeoip.GeoIP('GeoLiteCity.dat')
print gi.record_by_addr('')

provides a JSON output like this:

 {'city': u'Mountain View', 'region_name': u'CA', 'area_code': 650, 'time_zone': 'America/Los_Angeles', 'dma_code': 807, 'metro_code': 'San Francisco, CA', 'country_code3': 'USA', 'latitude': 37.41919999999999, 'postal_code': u'94043', 'longitude': -122.0574, 'country_code': 'US', 'country_name': 'United States', 'continent': 'NA'}   

(Just to add details to the second list item in Jeanne's answer)

freegeoip.net is a community-built IP geocoding platform.

Database files are downloaded automatically by the updatedb script from the blog.freegeoip.net domain and according to their blog the data actually comes from the Geolite databases which are disctributed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.

In addition:

  • The engine itself is open source
  • There is even a free hosted API (with hourly limits)

Three more IP geolocation APIs/Datasets I can suggest:

www.ip2location.com - free version for non-commercial use

www.hostip.info - crowdsourced dataset and API

dev.maxmind.com/geoip/legacy/geolite/ - free IP geolocation dataset

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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