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.

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).

Accessing the Database

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

C API

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).

Perl

GeoIP is available in two forms for Perl. The Geo::IP module requires that you have the libGeoIP C library installed on your system, along with its headers.

We also offer a pure Perl version, Geo::IP::PurePerl. This version does not require the libGeoIP C library, but is a bit slower.

Python

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

There is also a pure Python module, pygeoip, that is available from 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.

PHP

There are several different options for PHP. We offer an LGPL-licensed pure PHP version from our download server.

The PEAR package repository has a Net_GeoIP package for PHP 5.

Both of these APIs work on both Windows and Unix, and they do 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.

Finally, you can use access mod_geoip from PHP. You can use the apache_note() PHP function to access the information provided by mod_geoip.

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.

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.

Thanks to Ting Huang for providing the original implementation of the C# API.

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

mod_geoip Apache module

If you'd like to embed GeoIP in the Apache server, we offer an Apache module named 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.

Thanks to Corriss Randall for his contributions to this module.

See the mod_geoip2 documentation for more details.