
Determine the country, subdivisions (regions), city, and postal code associated
with IPv4 and IPv6 addresses worldwide.

Terms and pricing for the GeoIP City and GeoIP Country databases may be found on
our product pages:

- [GeoIP City](https://www.maxmind.com/en/geoip-databases)
- [GeoIP Country](https://www.maxmind.com/en/geoip-databases)

 **IP Geolocation Usage**

IP geolocation is inherently imprecise. Locations are often near the center of
the population. Any location provided by a GeoIP database should not be used to
identify a particular address or household. 

 **Data Privacy**

To comply with data privacy regulations, please monitor our
[Do Not Sell My Personal Information Requests](https://www.maxmind.com/en/accounts/current/do-not-sell-requests)
page (login required) for IP addresses and networks that should not be used for
advertising or marketing purposes. You can automate retrieval of this list using
our [privacy exclusions API](/geoip/privacy-exclusions-api). 


## Binary Databases

Binary databases make use of the
[MaxMind DB file format](https://maxmind.github.io/MaxMind-DB/). MaxMind
provides [official client APIs](/geoip/docs/databases/#official-client-apis)
that are open source. We also provide a list of
[unsupported and unofficial client APIs](/geoip/docs/databases/#unofficial-client-apis)
and
[unsupported and unofficial integrations](/geoip/docs/databases/#integrations)
with various applications.

You can also use the [mmdbinspect tool](https://github.com/maxmind/mmdbinspect)
(in beta), a command line interface built with Go, to look up one or more IPs
from one or more MMDB databases and receive output in a parsable JSON format.


- [GeoIP City binary database fields](city-binary/)
- [GeoIP Country binary database fields](country-binary/)

## CSV Databases

In addition to our MaxMind DB binary format, we also offer GeoIP and GeoLite
databases in a CSV format suitable for importing into a SQL database. The CSV
files are shipped as a single
[zip file](<https://en.wikipedia.org/wiki/Zip_(file_format)>).




The zip file itself is named `{GeoIP2,GeoLite2}-{City,Country}-CSV_{YYYYMMDD}.zip`.
The downloaded zip file contains a single directory which in turn
contains several files. That directory is named
`{GeoIP2,GeoLite2}-{City,Country}-CSV_{YYYYMMDD}`.



The downloaded .zip file contains a single directory which in turn contains 13
files:



<div class="table">
  <table>
    <tbody>
      <tr>
        <th>Filename</th>
        <th>Description</th>
      </tr>
      <tr>
        <td><code>COPYRIGHT.txt</code></td>
        <td>Copyright statement</td>
      </tr>

      <tr>
        <td><code>LICENSE.txt</code></td>
        <td>End user license</td>
      </tr>

      <tr>
        <td><code>README.txt</code></td>
        <td>Information file</td>
      </tr>

      <tr>
        <td><code>{GeoIP2,GeoLite2}-{City,Country}-Blocks-IPv4.csv</code></td>
        <td>CSV file containing data on IPv4 addresses</td>
      </tr>

      <tr>
        <td><code>{GeoIP2,GeoLite2}-{City,Country}-Blocks-IPv6.csv</code></td>
        <td>CSV file containing data on IPv6 addresses</td>
      </tr>

      <tr>
        <td>
          <code>{GeoIP2,GeoLite2}-{City,Country}-Locations-{locale}.csv</code>
        </td>
        <td>
          Eight CSV files containing data on locations for each locale code,
          where <code>{locale}</code> can be “de”, "en", “es”, “fr”, “ja”,
          “pt-BR”, “ru”, and “zh-CN”.
        </td>
      </tr>
    </tbody>
  </table>
</div>


All the CSV files start with a single header row containing column names. The
specific column names and their contents are detailed below. The files are
encoded as UTF-8.


### Blocks Files

There are two CSV files for network blocks, one each for IPv4 and IPv6 blocks.
These files are named `{GeoIP2,GeoLite2}-{City,Country}-Blocks-IPv4.csv` and
`{GeoIP2,GeoLite2}-{City,Country}-Blocks-IPv6.csv` respectively. An example name
would be `GeoIP2-City-Blocks-IPv4.csv`.

[City subset by continent databases](https://www.maxmind.com/en/geoip-databases)
blocks files have the same columns as the City database.




| Data field name | Type | Data field description | Included in... |
|------|------|-------------|-------------|
| network | IP network as a string | This is the IPv4 or IPv6 network in CIDR format such as "2.21.92.0/29" or "2001:4b0::/64". We offer a utility to convert this column to start/end IPs or start/end integers. See the conversion utility section for details. | Country, City |
| geoname_id | integer | A unique identifier for the network's location as specified by [GeoNames](https://www.geonames.org/). This ID can be used to look up the location information in the Location file. [Learn more about GeoNames IDs on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/maxmind-ip-geolocation-data#geonames-ids) | Country, City |
| registered_country_geoname_id | integer | The registered country is the country in which the ISP has registered the network. This column contains a unique identifier for the network's registered country as specified by [GeoNames](https://www.geonames.org/). This ID can be used to look up the location information in the Location file. [Learn more about registered countries on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/country-level-and-city-level-geolocation-maxmind) | Country, City |
| represented_country_geoname_id | integer | The represented country is the country which is represented by users of the IP address. For instance, the country represented by an overseas military base. This column contains a unique identifier for the network's represented country as specified by [GeoNames](https://www.geonames.org/). This ID can be used to look up the location information in the Location file. [Learn more about represented countries on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/country-level-and-city-level-geolocation-maxmind) | Country, City |
| is_anonymous_proxy | boolean | **Deprecated.** Please see our [GeoIP Anonymous IP database](https://www.maxmind.com/en/geoip-anonymous-ip-database) to determine whether the IP address is used by an anonymizing service. | Country, City |
| is_satellite_provider | boolean | **Deprecated.** | Country, City |
| postal_code | string | A postal code close to the user's location. For the following countries, we return partial postal codes with the number of characters indicated below: United States: 5, Canada: 3, United Kingdom: 2-4, Brazil: 5, Ireland: 3, Japan: 7 (specified for the first 6. The last digit defaults to 1), Netherlands: 4, Portugal: 7 (accurate for the first 4. The last 3 often defaults to `-001`), Singapore: 2 | City only |
| latitude* | decimal | The approximate [WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System) latitude of the location associated with the network. [Learn about the geolocation area defined by latitude, longitude, and accuracy radius, on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/maxmind-ip-geolocation-data#geolocation-area) | City only |
| longitude* | decimal | The approximate [WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System) longitude of the location associated with the network. [Learn about the geolocation area defined by latitude, longitude, and accuracy radius, on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/maxmind-ip-geolocation-data#geolocation-area) | City only |
| accuracy_radius | integer | The radius in kilometers around the specified location where the IP address is likely to be. [Learn about the geolocation area defined by latitude, longitude, and accuracy radius, on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/maxmind-ip-geolocation-data#geolocation-area) | City only |

| is_anycast | boolean | This is `1` if the network is an [anycast network](https://en.wikipedia.org/wiki/Anycast). This column will be empty in GeoLite2-Country and GeoLite2-City. | Country, City |

 _\* The coordinates 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._ 


### Locations Files

The zip file includes one location file for each locale code for which data is
available. There will always be an "en" file containing a record for every
`geoname_id` used in the blocks files. Files corresponding to other locales will
exist and have a record for a `geoname_id` only if data is available. The other
possible locales are "de", "es", "fr", "ja", "pt-BR", "ru", and "zh-CN".

These files are named `{GeoIP2,GeoLite2}-{City,Country}-Locations-{locale}.csv`.
An example name would be `GeoIP2-City-Locations-en.csv`.

[City subset by continent databases](https://www.maxmind.com/en/geoip-databases)
locations files have the same columns as the City database.



| Data field name | Type | Data field description | Included in... |
|------|------|-------------|-------------|
| geoname_id | integer | A unique identifier for the location as specified by [GeoNames](https://www.geonames.org/). This ID can be used as a key for the Location file. [Learn more about GeoNames IDs on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/maxmind-ip-geolocation-data#geonames-ids) | Country, City |
| locale_code | string | The locale that the names in this row are in. This will always correspond to the locale name of the file. | Country, City |
| continent_code | string (2) | The continent code for this location. Possible codes are: **AF** - Africa, **AN** - Antarctica, **AS** - Asia, **EU** - Europe, **NA** - North America, **OC** - Oceania, **SA** - South America | Country, City |
| continent_name | string | The continent name for this location in the file's locale. [Learn more about localized names on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/maxmind-ip-geolocation-data#names) | Country, City |
| country_iso_code | string (2) | A two-character [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code for the country associated with the location. | Country, City |
| country_name | string | The country name for this location in the file's locale. [Learn more about localized names on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/maxmind-ip-geolocation-data#names) | Country, City |
| subdivision_1_iso_code | string (1-3) | A string of up to three characters containing the region-portion of the [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) code for the first level region associated with the IP address. Some countries have two levels of subdivisions, in which case this is the least specific. For example, in the United Kingdom this will be a country like "England", not a county like "Devon". | City only |
| subdivision_1_name | string | The subdivision name for this location in the file's locale. As with the subdivision code, this is the least specific subdivision for the location. [Learn more about localized names on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/maxmind-ip-geolocation-data#names) | City only |
| subdivision_2_iso_code | string (1-3) | A string of up to three characters containing the region-portion of the [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) code for the second level region associated with the IP address. Some countries have two levels of subdivisions, in which case this is the most specific. For example, in the United Kingdom this will be a a county like "Devon", not a country like "England". | City only |
| subdivision_2_name | string | The subdivision name for this location in the file's locale. As with the subdivision code, this is the most specific subdivision for the location. [Learn more about localized names on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/maxmind-ip-geolocation-data#names) | City only |
| city_name | string | The city name for this location in the file's locale. [Learn more about localized names on our Knowledge Base.](https://support.maxmind.com/knowledge-base/articles/maxmind-ip-geolocation-data#names) | City only |
| metro_code | integer | **Deprecated.** This is a no-longer-maintained code for targeting advertisements in Google. | City only |
| time_zone | string | The time zone associated with location, as specified by the [IANA Time Zone Database](https://www.iana.org/time-zones), e.g., "America/New_York". | City only |
| is_in_european_union | boolean | This is `1` if the country associated with the location is a member state of the European Union. It is `0` otherwise. | Country, City |

### Returned Values as Database, Map, Dict, or Hash Keys

**We strongly discourage you from using a value from any `*_name` field as a key
in a database or map/dict/hash data structure.**

These names may change between releases. Instead we recommend using one of the
following:

| Data object  | Recommended key              |
| ------------ | ---------------------------- |
| city         | `geoname_id`                 |
| continent    | `continent_code`             |
| country      | `country_iso_code`           |
| postal       | `postal_code`                |
| subdivisions | `subdivision_{1,2}_iso_code` |


### Conversion Utility

We've created a
[small utility program](https://github.com/maxmind/geoip2-csv-converter) to
allow you to convert a GeoIP CSV file's representation of IP addresses to
another format. You can choose between start/end IP addresses, with the
addresses represented as strings or integers.

The program is available from our
[geoip2-csv-converter GitHub project releases tab.](https://github.com/maxmind/geoip2-csv-converter/releases)


## Example Files

We maintain example files in CSV and MMDB format. The files contain dummy data
rather than real GeoIP data.


### CSV Example Files

We maintain examples of the CSV files as they would be downloaded from the account portal:



- [GeoIP2-City-CSV_Example.zip](/examples/GeoIP2-City-CSV_Example.zip)
- [GeoIP2-Country-CSV_Example.zip](/examples/GeoIP2-Country-CSV_Example.zip)
  

### MMDB Example Files

We maintain test MMDB files on GitHub:



- [GeoIP2-City-Test.mmdb](https://github.com/maxmind/MaxMind-DB/blob/main/test-data/GeoIP2-City-Test.mmdb)
- [GeoIP2-Country-Test.mmdb](https://github.com/maxmind/MaxMind-DB/blob/main/test-data/GeoIP2-Country-Test.mmdb)
  

Alternatively, you can [view all of our MMDB test data on GitHub](https://github.com/maxmind/MaxMind-DB/tree/main/test-data).

## Database Sizes

<!-- prettier-ignore-start -->

MaxMind databases can vary in size from release to release. If you are
working with file size limitations that are concerning, you should build
your integrations to fail gracefully in event of a significant size
change.

From May to August 2026, the database files varied in file size and number of networks as
follows:

| Database | CSV File Size | MMDB File Size | IPv4 Networks | IPv6 Networks |
|----------|---------------|----------------|---------------|---------------|
- databaseName: "GeoIP City"
  csvSizeRange: "672 MB - 767 MB"
  mmdbSizeRange: "112 MB - 127 MB"
  ipv4Range: "6,176,000 - 7,635,000"
  ipv6Range: "3,914,000 - 4,077,000"

- databaseName: "GeoIP Country"
  csvSizeRange: "43.6 MB - 48.0 MB"
  mmdbSizeRange: "8.60 MB - 9.23 MB"
  ipv4Range: "559,000 - 585,000"
  ipv6Range: "522,000 - 600,000"

- databaseName: "GeoLite City"
  csvSizeRange: "308 MB - 385 MB"
  mmdbSizeRange: "43.9 MB - 66.9 MB"
  ipv4Range: "3,102,000 - 3,797,000"
  ipv6Range: "1,674,000 - 2,095,000"

- databaseName: "GeoLite Country"
  csvSizeRange: "44.0 MB - 52.2 MB"
  mmdbSizeRange: "8.61 MB - 9.69 MB"
  ipv4Range: "561,000 - 592,000"
  ipv6Range: "530,000 - 684,000"

The listed file sizes are for unpacked databases. Databases are
downloaded in a compressed format.


<!-- prettier-ignore-end -->

## Database Changes

We may add new data fields to the City and Country database at any time.

New database fields are added as new columns to the right of existing columns in our CSV files,
and as additional data in our MMDB files.

Subscribe to our [GeoIP release notes](/geoip/release-notes) to be notified when new
data is added to our databases.

## APIs and Third-Party Integrations

You can find a complete list of official and unofficial client APIs, and
third-party integrations on the
[database documentation page](/geoip/docs/databases#client-apis).


## [GeoIP City binary database fields](/geoip/docs/databases/city-and-country/city-binary/)
<p>The GeoIP City binary database contains the following fields for each network.
The top-level record for each network is a map containing the keys listed below.
Each key maps to a map or an array of maps. If a key maps to an undefined or
empty value, it is not included in the record.</p>


<div class="table">
  <table>
    <tbody>
      <tr>
        <th>Data field name</th>
        <th>Type</th>
        <th>Data field description</th>
      </tr>

      <tr>
        <td><a href="#city">city</a></td>
        <td>map</td>
        <td>
          A map containing details about the city associated with the IP
          address.
        </td>
      </tr>

      <tr>
        <td><a href="#continent">continent</a></td>
        <td>map</td>
        <td>
          A map containing details about the continent associated with the IP
          address.
        </td>
      </tr>

      <tr>
        <td><a href="#country">country</a></td>
        <td>map</td>
        <td>
          A map containing details about the country where MaxMind believes the
          IP address is located.
        </td>
      </tr>

      <tr>
        <td><a href="#location">location</a></td>
        <td>map</td>
        <td>
          A map containing details about the location associated with the IP
          address, including coordinates and time zone.
        </td>
      </tr>

      <tr>
        <td><a href="#postal">postal</a></td>
        <td>map</td>
        <td>
          A map containing details about the postal code associated with the IP
          address.
        </td>
      </tr>

      <tr>
        <td><a href="#registered_country">registered_country</a></td>
        <td>map</td>
        <td>
          A map containing details about the country where the ISP has
          registered the IP block. This may differ from the country where the IP
          is located.
        </td>
      </tr>

      <tr>
        <td><a href="#represented_country">represented_country</a></td>
        <td>map</td>
        <td>
          A map containing details about the country represented by users of the
          IP address, such as a military base or embassy.
        </td>
      </tr>

      <tr>
        <td><a href="#subdivisions">subdivisions</a></td>
        <td>array of maps</td>
        <td>
          An array of maps containing data for the subdivisions associated with
          the IP address, ordered from largest to smallest.
        </td>
      </tr>

      <tr>
        <td><a href="#traits">traits</a></td>
        <td>map</td>
        <td>A map containing general traits associated with the IP address.</td>
      </tr>
    </tbody>
  </table>
</div>

## city


<div class="table">
  <table>
    <tbody>
      <tr>
        <th>Data field name</th>
        <th>Type</th>
        <th>Data field description</th>
      </tr>

      <tr>
        <td>geoname_id</td>
        <td>uint32</td>
        <td>
          <p>
            A unique identifier for the city as specified by
            <a href="https://www.geonames.org/">GeoNames</a>.
          </p>

## [GeoIP Country binary database fields](/geoip/docs/databases/city-and-country/country-binary/)
<p>The GeoIP Country binary database contains the following fields for each network.
The top-level record for each network is a map containing the keys listed below.
Each key maps to a map. If a key maps to an undefined or empty value, it is not
included in the record.</p>


<div class="table">
  <table>
    <tbody>
      <tr>
        <th>Data field name</th>
        <th>Type</th>
        <th>Data field description</th>
      </tr>

      <tr>
        <td><a href="#continent">continent</a></td>
        <td>map</td>
        <td>
          A map containing details about the continent associated with the IP
          address.
        </td>
      </tr>

      <tr>
        <td><a href="#country">country</a></td>
        <td>map</td>
        <td>
          A map containing details about the country where MaxMind believes the
          IP address is located.
        </td>
      </tr>

      <tr>
        <td><a href="#registered_country">registered_country</a></td>
        <td>map</td>
        <td>
          A map containing details about the country where the ISP has
          registered the IP block. This may differ from the country where the IP
          is located.
        </td>
      </tr>

      <tr>
        <td><a href="#represented_country">represented_country</a></td>
        <td>map</td>
        <td>
          A map containing details about the country represented by users of the
          IP address, such as a military base or embassy.
        </td>
      </tr>

      <tr>
        <td><a href="#traits">traits</a></td>
        <td>map</td>
        <td>A map containing general traits associated with the IP address.</td>
      </tr>
    </tbody>
  </table>
</div>

## continent


<div class="table">
  <table>
    <tbody>
      <tr>
        <th>Data field name</th>
        <th>Type</th>
        <th>Data field description</th>
      </tr>

      <tr>
        <td>code</td>
        <td>string</td>
        <td>
          <p>
            A two-character continent code like <code>NA</code> (North America)
            or <code>OC</code> (Oceania).
          </p>

