GeoIP Legacy CSV Databases

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

Many of our GeoIP Legacy database products are offered in a CSV format, in addition to our binary format. 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

Name Type Description
Start IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

End IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

Netmask unsigned integer In some variants of our CSV databases, we offer an additional netmask column, containing the netblock's netmask as a number from 1-31.
Country code varchar(2)

A two-character ISO 3166-1 country code for the country associated with the IP address. In addition to the standard codes, we may also return one of the following:

The US country code is returned for IP addresses associated with overseas US military bases.

Country name varchar(50) The country name associated with the IP address.

GeoIP Region Edition CSV Database Fields

Name Type Description
Start IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

End IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

Country code varchar(2)

A two-character ISO 3166-1 country code for the country associated with the IP address. In addition to the standard codes, we may also return one of the following:

The US country code is returned for IP addresses associated with overseas US military bases.

Region code char(2)

A two character ISO-3166-2 or FIPS 10-4 code for the state/region associated with the IP address.

For the US and Canada, we return an ISO-3166-2 code. In addition to the standard ISO codes, we may also return one of the following:

  • AA – Armed Forces America
  • AE – Armed Forces Europe
  • AP – Armed Forces Pacific

We return a FIPS code for all other countries.

We provide a CSV file which maps our region codes to region names. The columns are ISO country code, region code (FIPS or ISO), and the region name.

GeoIP Legacy City CSV Database Fields

Name Type Description
Start IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

End IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

Country code varchar(2)

A two-character ISO 3166-1 country code for the country associated with the IP address. In addition to the standard codes, we may also return one of the following:

The US country code is returned for IP addresses associated with overseas US military bases.

Region code char(2)

A two character ISO-3166-2 or FIPS 10-4 code for the state/region associated with the IP address.

For the US and Canada, we return an ISO-3166-2 code. In addition to the standard ISO codes, we may also return one of the following:

  • AA – Armed Forces America
  • AE – Armed Forces Europe
  • AP – Armed Forces Pacific

We return a FIPS code for all other countries.

We provide a CSV file which maps our region codes to region names. The columns are ISO country code, region code (FIPS or ISO), and the region name.

City name varchar(255) The city or town name associated with the IP address. See our list of cities to see all the possible return values.
Postal code varchar(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 the first 2-4 characters (outward code) for postal codes in the United Kingdom.
Latitude* decimal The 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* decimal The longitude associated with the IP address.
Metro code unsigned int The metro code associated with the IP address. These are only available for IP addresses in the US. MaxMind returns the same metro codes as used by Google Marketing Platform.
Area code char(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

Name Type Description
Start IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

End IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

ISP name varchar(50) The name of the ISP associated with the IP address.

GeoIP Organization Edition CSV Database Fields

Name Type Description
Start IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

End IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

Organization name varchar(50) The name of the organization associated with the IP address.

GeoIP Netspeed Edition CSV Database Fields

Name Type Description
Start IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

End IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

Netspeed enum

The network speed associated with the IP address. This can be one of the following values:

  • Dialup
  • Cable/DSL
  • Corporate
  • Cellular

GeoIP Domain Edition CSV Database Fields

Name Type Description
Start IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

End IPv4 address varchar(15) or unsigned int

The first IPv4 address in a netblock. In some databases, this is provided as a string of dot-separated octets. In others, it is provided as an integer number. See above for the algorithms to pack and unpack these numbers. The largest possible number for this field is 4,294,967,295.

In some cases, we offer both representations in the same database. In some others, we offer the same data in two different downloadable formats, one with a IPv4 string and the other with a number. See below for more details.

Domain varchar(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.