GeoIP Legacy Databases

We are retiring our GeoIP Legacy database formats at the end of May 2022. Please see our blog post for more information, including how to migrate to GeoIP2.

New Database Format Available: This page is for our legacy databases. For our latest database format, please see our GeoIP2 Downloadable Databases.

GeoIP Legacy 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.

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

Latitude and longitude are not precise and should not be used to identify a particular street address or household. To better represent a level of accuracy, please include the accuracy_radius when displaying latitude and longitude and make it clear that the coordinates refer to a larger geographical area instead of a precise location.

Official API Clients

We supply APIs for many major programming languages

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

Language/PlatformDocumentation
Apache (mod_geoip)Documentation
CDocumentation
C#Documentation
JavaDocumentation
PerlDocumentation
PHPDocumentation
PythonDocumentation

Unofficial API Clients

Use at your own risk.

MaxMind does not offer support for these integrations. Please contact the integrator for assistance.

Language or FrameworkAPI NameDocumentation/Version Control
ErlangegoipGitHub
GoGeoIP (C wrapper)GitHub
Nimmmgeoip (C wrapper)GitHub
Node.jsGeoIP binding (C extension)GitHub
Node.jsnode-maxmind (0.6 and earlier)GitHub
PHPNet_GeoIPPEAR
PHPGeoIP PECLPECL package
PythonpygeoipGitHub
RubyGeoIP Bindings (C Extension)GitHub
RubygeoipGitHub
ScalaScala MaxMind Geo-IPGitHub

Download Limits

MaxMind reserves the right to limit the number of downloads made within a limited period of time.

CSV Databases

New CSV Formats Available: This page is for our legacy CSV formats. For our latest CSV formats, please see our GeoIP2 Databases.

The primary use case for these CSV files is to import them into a SQL database or other data store.

This documentation details the contents of every CSV database. Some of our CSV files are shipped as zipped archives. Others are gzipped.

In some cases, we offer a zip archive with multiple CSV files. The primary file will contain IDs referring to rows in other files. Each of these files can be imported directly into different database tables, and the referencing IDs will function as foreign keys.

In the documentation below, all types are specified in a form that is useful for defining a SQL database table, such as "varchar(40)" or "unsigned integer".

Integer IPv4 Representation

Many of our databases include an integer representation of an IPv4 address. This allows you to easily compare these addresses as numbers to determine if a specific IP falls into a given range. This is especially useful with databases that don't have native network address types. If your database does have such a type, like PostgreSQL, then we recommend using that type instead. If you are using MySQL (which does not have such a type), we recommend using the INET_ATON() and INET_NTOA() functions to perform conversions.

For cases where you cannot rely on your database to handle conversions, please refer to this pseudo-code for calculating the integer value of an IPv4 address:

For the IP address 174.36.207.186 this produces the number 2,921,648,058.

Here is pseudo-code for turning an integer back into an IPv4 address:

SQL Queries

You can now incorporate the integer representation of 174.36.207.186 (as calculated above) into an SQL query:

When using MySQL, you can have the database perform the address to number conversion for you:

CSV Database Fields

This is a list of available CSV downloads. Please see the section on field order for more information on the order of available columns. All strings are returned in the ISO-8859-1 encoding. This encoding is also referred to as latin1.

GeoIP Legacy Country CSV Database Fields

NameTypeDescription
Start IPv4 addressvarchar(15) or unsigned int
End IPv4 addressvarchar(15) or unsigned int
Netmaskunsigned integerIn some variants of our CSV databases, we offer an additional netmask column, containing the netblock's netmask as a number from 1-31.
Country codevarchar(2)
Country namevarchar(50)The country name associated with the IP address.

GeoIP Region Edition CSV Database Fields

NameTypeDescription
Start IPv4 addressvarchar(15) or unsigned int
End IPv4 addressvarchar(15) or unsigned int
Country codevarchar(2)
Region codechar(2)

GeoIP Legacy City CSV Database Fields

NameTypeDescription
Start IPv4 addressvarchar(15) or unsigned int
End IPv4 addressvarchar(15) or unsigned int
Country codevarchar(2)
Region codechar(2)
City namevarchar(255)The city or town name associated with the IP address.
Postal codevarchar(8)The postal code associated with the IP address. These are available for some IP addresses in Australia, Canada, France, Germany, Italy, Spain, Switzerland, United Kingdom, and the US. We return the first 3 characters for Canadian postal codes. We return the first 2-4 characters (outward code) for postal codes in the United Kingdom.
Latitude*decimalThe latitude associated with the IP address. The latitude and longitude are near the center of the most granular location value returned: postal code, city, region, or country.
Longitude*decimalThe longitude associated with the IP address.
Metro codeunsigned intThe metro code associated with the IP address. These are only available for IP addresses in the US.
Area codechar(3)The telephone area code associated with the IP address. These are only available for IP addresses in the US. This output is deprecated, and may not reflect newer area codes.

* Latitude and longitude are not precise and should not be used to identify a particular street address or household.

GeoIP ISP Edition CSV Database Fields

NameTypeDescription
Start IPv4 addressvarchar(15) or unsigned int
End IPv4 addressvarchar(15) or unsigned int
ISP namevarchar(50)The name of the ISP associated with the IP address.

GeoIP Organization Edition CSV Database Fields

NameTypeDescription
Start IPv4 addressvarchar(15) or unsigned int
End IPv4 addressvarchar(15) or unsigned int
Organization namevarchar(50)The name of the organization associated with the IP address.

GeoIP Netspeed Edition CSV Database Fields

NameTypeDescription
Start IPv4 addressvarchar(15) or unsigned int
End IPv4 addressvarchar(15) or unsigned int
Netspeedenum

GeoIP Domain Edition CSV Database Fields

NameTypeDescription
Start IPv4 addressvarchar(15) or unsigned int
End IPv4 addressvarchar(15) or unsigned int
Domainvarchar(255)The second level domain associated with the IP address. This will be something like "example.com" or "example.co.uk", not "foo.example.com".

Field Order and Database Format

In order to parse a CSV database file successfully, you need to know the field order for that database. We offer many different variations of our CSV databases. In some cases, the same data may be available in three or four different layouts.

Every CSV database includes column headers. Many of the databases also have a copyright statement on their first line. You can determine the field order by looking at the first few lines of the CSV file.

We also offer combined CSV format databases. For example, we offer a database that combines the City, ISP, and Organization databases, as well as one that combines the Country and ISP databases.

The available downloads vary based on the subscriptions you have paid for. To download a combined database, you must purchase all the individual databases separately.

Third Party Tools

Warning! MaxMind does not offer support for these tools and has not reviewed the code. Use at your own risk.

David Neal has written a tool to import GeoIP Legacy CSV files into a MySQL database.

This page was last updated on September 17, 2021.