GeoIP Downloadable Databases

The GeoIP product is available in a variety of downloadable databases. These databases use a custom binary format to maximize lookup speed. MaxMind also offers CSV versions of the same data. This is useful if you would like to import this data into a SQL RDBMS, for example.

CSV Database

Please see our CSV database documentation.

Binary Databases

The binary databases come in many flavors, each of which contains a specific dataset. These are all offered as separate products with their own subscription. We provide installation instructions for GeoIP Country and GeoIP City.

At present, we offer the following databases:

  • Country - maps the IP address to a country
  • Region - maps the IP address to a specific state/province within a country
  • City - maps the IP address to a specific city within a country. In the US, we are able to map many IP addresses to specific postal codes. This database also contains latitude, longitude, and time zone data.
  • Organization - maps the IP address to the organization which was assigned the IP address's netblock.
  • ISP - maps the IP address to the ISP which owns the IP, including wireless carriers.
  • Netspeed - maps the IP address a particular network speed.
  • Domain - maps the IP address to a domain (not a hostname).

MaxMind-Supported APIs

We supply APIs for many major programming languages. Please see our benchmarks if you are interested in comparing the speed of various APIs.

Many of our APIs are available on GitHub. We are happy to review patches submitted as GitHub Pull Requests.

Apache (mod_geoip)

If you'd like to embed GeoIP in the Apache server, we offer mod_geoip2 for this purpose.

This module can only look up the IP address of the client connected to the web server. It sets environment variables containing the results of the IP address lookup.

See the mod_geoip2 documentation for more details.

C

This code is licensed under the LGPL. You can download the latest version of the API from our download server.

This API should work on most Unix platforms. For installation on Windows, please see the READMEwin32.txt file in the distribution tarball.

Note that while most of the API is thread-safe, the GeoIP_last_netmask and GeoIP_range_by_ip are not. In addition, opening a database with the GEOIP_CHECK_CACHE flag is not thread-safe.

Packages for this library are available in many distributions. They are usually named "GeoIP", "libgeoip1", or "libGeoIP1". Some systems (like Debian) may split the package into "libgeoip1" (the library) and "libgeoip-dev" (headers and static libraries).

C#

We offer an LGPL-licensed C# library on our download server. This library does not require the libGeoIP C library and is thread-safe.

The C# library should work with both Microsoft's .NET framwork as well as Mono.

Java

We offer an LGPL-licensed Java library on our download server. This library does not require the libGeoIP C library and is thread-safe.

Microsoft COM

We offer a COM API for the MaxMind Country, Region, City, ISP, and Organization database. To get GeoIP or GeoLite City to work with the new COM API, you must set GeoIP.set_db_path to the directory containing the GeoIPCity.dat file. If you are using GeoLite data, you have to rename GeoLiteCity.dat to GeoIPCity.dat for this to work.

The MS COM API may not work on 64 bit machines. To install on a 64 bit machine, copy the dll to %windir%/SysWOW64, then register the dll. If that doesn't work, a client of ours has documented a MS COM API guide for 64 bit machines.

Source code for the MS COM API is available.

Perl

GeoIP is available in two forms for Perl. The Geo::IP module can either use a XS wrapper to the libGeoIP C library installed on your system, or use pure Perl code. Geo::IP::PurePerl has been merged with Geo::IP and is now deprecated.

PHP

We offer an LGPL-licensed pure PHP API. This API works on Windows and Unix.

You may also use our mod_geoip Apache module from PHP. See the apache_note PHP function for information on how to do this.

Finally, there are several third-party PHP APIs.

Python

We offer an LGPL-licensed Python library that links against the libGeoIP C library on our download server.

Third-Party APIs

Node.js

There are several Node.js APIs available. The GeoIP binding uses the C library to provide fast performance. node-geoip and node-maxmind are pure JavaScript implementations.

PHP

In addition to our supported API, the PEAR package repository has a Net_GeoIP package for PHP 5. This API works on both Windows and Unix and does not require the libGeoIP C library.

If you require a faster API, there is a PECL package that lets you embed the libGeoIP C library in the PHP interpreter. This package also has a newer fork on github which supports more of the GeoIP data.

Python

pygeoip is a pure Python module that is available on PyPI.

Ruby

There are several options for Ruby. The geoip-c gem links against the libGeoIP C library. There is a pure Ruby implementation in the geoip gem.

Other Ways to Access the Databases

OpenX/phpAdNews

We offer instructions for using our downloadable databases with OpenX.

Wireshark

Wireshark compiled with GeoIP supports the use of GeoIP and GeoLite databases.

Wireshark packages are available for many platforms. Windows packages are available from Wireshark for 32-bit and 64-bit processors.