63

We've got a requirement in a couple of our systems to detect a user's country based on their IP address. We'd prefer to use a database rather than a Web Service (to prevent issues with downtime/network access to an externally hosted service) so I'm looking for recommendations, anyone got any good or bad stories of the various IP to Country databases?

What I've found from google:

Paid

Free

Any information on how the free ones compare to the paid ones would be good. Right now I'm leaning towards Maxmind's paid service since it includes automatic updates that we can run via script once a week.

Henry Wilson
  • 3,281
  • 4
  • 31
  • 46
  • 5
    You can also consider IP2Location LITE as the free one. It has more information such as time zone compare to peers in the same category. http://lite.ip2location.com – Michael C. Oct 23 '13 at 00:16
  • 2
    IPLocate.io provides a free API: [`https://www.iplocate.io/api/lookup/8.8.8.8`](https://www.iplocate.io/api/lookup/8.8.8.8) - Disclaimer: I run this service. – ttarik Nov 15 '17 at 00:47
  • Try https://clearip.io The most elegant one I've seen so far. – AbdullahDiaa Nov 12 '18 at 22:07

2 Answers2

78

Totally free, LGPL, not easily found in google: ip2c.org

mezzoforte
  • 853
  • 1
  • 6
  • 2
  • This is the best answer and everyone should use this! – rockstardev May 06 '15 at 07:44
  • It's being flagged by anti-virus – Rui Lima May 16 '15 at 08:40
  • 44
    Webservice only, so it doesn't allow downloading the database – Redzarf Jul 27 '15 at 17:33
  • Very usefull and easy! – Allan Andrade Oct 07 '15 at 13:16
  • 7
    Also does not support HTTPS. – Simon East Feb 19 '16 at 05:30
  • 5
    It's not accurate for me: It says that I'm in UK but I'm in France. When I'm using Maxmind or ip2location it gives me the right answer. – Aalex Gabi Jul 04 '16 at 08:35
  • The other problem with ip2c is for example, it shows me in "Canada". As the 2nd biggest country on the planet, just showing "Canada" is.....pretty vague. Not quite useless, but not great information. – Stéphane Oct 06 '16 at 03:51
  • For tiny projects, this LGPL thing is a nice add-on to this question. However, it's limited. It's unreliable at scale, the location identification is way too simple and thus often inaccurate, and if we're on secure servers (which everyone should be), then the service doesn't work at all. – PKHunter May 27 '17 at 15:14
  • 13
    @Redzarf: The download of their DB is [here](http://software77.net/geo-ip/). Their [Notes page](http://about.ip2c.org/#notes) mentions which DB they use. It's a bit hard to spot on the downloadpage, you need to look [here](https://i.imgur.com/XjbfVwy.png). – RobIII Feb 12 '18 at 15:57
  • `You can use http or https.` Stated on their site. – Fusseldieb May 15 '18 at 18:50
  • 1
    It doesn't appear that ip2c.org supports ipv6. ipv6 addresses are used pretty frequently. Is there a reliable solution for ipv6 addresses as well? I'd rather an API (like ip2c.org) rather than downloading and maintaining the DB myself. – theyuv Mar 22 '20 at 16:00
  • As @RobIII points in his comment, the database behind http://i2c.org comes from http://software77.net/geo-ip/, which is the third provider in the original question. – joanpau Aug 18 '20 at 22:35
  • @joanpau links don’t work now – Daniel Lidström Jul 20 '21 at 13:00
  • 1
    @DanielLidström Yes, there is an error in the first link. It should be https://about.ip2c.org/#licensenotes . And for the second one, it seems that the service is down or no longer there, and the license notes of ip2c have not been updated. – joanpau Jul 22 '21 at 17:49
  • They stopped getting updated recently – jjxtra Apr 16 '22 at 18:41
33

We use Maxmind and it's very good, and pretty accurate. You can get scenarios where, say, a German company has offices in the US but is using a German IP range for internal purposes. So, they'll report as Germany while being based in the US. It won't be 100% reliable.

Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206