IPv4 geolocation

8,940
Updated:
Files:1
Size:30.1 MB
Formats:csv

Database of IPv4 address networks with their respective geographical location. Based on GeoLite2 Country Free Downloadable Databases as of Apr 21, 2015 http://dev.maxmind.com/geoip/geoip2/geolite2/...

Part of a Data Solution

  • Global Country & Region Reference Data Solution

    Authoritative country codes, regions and location reference data to power your location-based solutions.

    Explore →

API Access

Access dataset files directly from scripts, code, or AI agents.

Browse dataset files
Dataset Files

Each file has a stable URL (r-link) that you can use directly in scripts, apps, or AI agents. These URLs are permanent and safe to hardcode.

/core/geoip2-ipv4/
https://datahub.io/core/geoip2-ipv4/_r/-/ATTRIBUTION.txt
https://datahub.io/core/geoip2-ipv4/_r/-/LICENSE
https://datahub.io/core/geoip2-ipv4/_r/-/README.md
https://datahub.io/core/geoip2-ipv4/_r/-/data/geoip2-ipv4.csv
https://datahub.io/core/geoip2-ipv4/_r/-/datapackage.json
Key Files

Start with these files — they give you everything you need to understand and access the dataset.

datapackage.json— metadata & schema
https://datahub.io/core/geoip2-ipv4/_r/-/datapackage.json
README.md— documentation
https://datahub.io/core/geoip2-ipv4/_r/-/README.md
Typical Usage
  1. 1. Fetch datapackage.json to inspect schema and resources
  2. 2. Download data resources listed in datapackage.json
  3. 3. Read README.md for full context

Data Files

Explore with AI

geoip2-ipv4


About this dataset

badge

IPv4 geolocation

IPv4 networks in CIDR notation with the country and continent that MaxMind's GeoLite2 Country database assigns to each. The location is at country level only.

Column definitions and types are in datapackage.json.

Data

data/geoip2-ipv4.csv has one row per IPv4 network:

ColumnMeaning
networkIPv4 network in CIDR notation, for example 1.0.0.0/24. Each network appears once
geoname_idGeoNames id of the location: the country, or a continent when MaxMind gives no country. Empty when the network has no location
continent_codeAF, AN, AS, EU, NA (North America), OC or SA. Empty when the network has no location
continent_nameContinent name, for example Oceania
country_iso_codeISO 3166-1 alpha-2 country code, for example AU. Empty when the location is only a continent or unknown
country_nameEnglish country name, for example Australia
is_anonymous_proxyMaxMind's flag for an anonymous proxy: 1 or 0
is_satellite_providerMaxMind's flag for a satellite provider that serves several countries: 1 or 0

Known limitations

  • The codes NA are real values: continent_code NA is North America and country_iso_code NA is Namibia. Many tools read the text NA as "missing". Read the file as text and keep empty cells empty: pd.read_csv("data/geoip2-ipv4.csv", dtype=str, keep_default_na=False).
  • The location is the country, not a city or a street. MaxMind says IP geolocation is inherently imprecise, and its terms forbid using GeoLite data to identify a household, an individual or a street address.
  • A few networks have only a continent: their geoname_id is the continent's id and the two country columns are empty.
  • Where MaxMind gives a network no location of its own, the country where the network is registered is used. That country can differ from the country where the addresses are used.
  • A network with neither has empty location columns.
  • is_anonymous_proxy and is_satellite_provider are 0 in every row of the data we checked. Do not use them to find proxies or satellite networks.
  • IPv4 only. There is no IPv6.

Data sources

Changes made to the source data: the script joins the two files on geoname_id. Where a network has no geoname_id, it uses registered_country_geoname_id. It keeps the eight columns above, drops the other columns of the MaxMind files, and removes repeated rows.

Not endorsed by, or affiliated with, MaxMind.

Preparation

You need Python 3.12 or greater and a free MaxMind GeoLite account with a licence key. Set your account id and key as environment variables, then run the script from the repository root:

pip install -r scripts/requirements.txt
export MAXMIND_USERNAME=<your account id>
export MAXMIND_PASSWORD=<your licence key>
python scripts/process.py

The script stops with an error if the download fails or if the result looks wrong (fewer than 100,000 networks, a repeated network, or the text nan in any column).

A GitHub workflow runs the script every Sunday at 00:00 UTC, on every push to main and when started by hand, with the account id and licence key stored as GitHub secrets. It commits data/ if it changed.

The data is also published on datahub.io.

License

The data is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0). MaxMind's GeoLite End User License Agreement (updated 12 February 2026) says so in section 3: "to the extent the Services contain any copyrightable elements those copyrightable elements are governed by the Creative Commons License".

What this means for you:

  • Credit MaxMind. The agreement says "You must provide attribution of your use to MaxMind", with the example: "This product includes GeoLite Data created by MaxMind, available from https://www.maxmind.com".
  • Share alike. If you share a changed version of the data, CC BY-SA 4.0 requires you to share it under the same licence.
  • Keep the limits that come with the data. Section 6 allows sharing where the Creative Commons licence permits it, and says the same duties pass on to whoever receives the data. Section 4 forbids using the data for credit, insurance or employment decisions. Section 5 forbids using it to identify a household, an individual or a street address.

Old versions. The agreement also says (section 6, "Destructions") that you must "cease use of and destroy … any old versions of the Services within thirty (30) days following the release of the updated GeoLite Databases". This repository replaces the data every week and keeps the older versions in its Git history. Use the current file in data/, not an older version from the history.

The maintainers place only their own work (the script, the column definitions and the file layout) under the Public Domain Dedication and License (PDDL). The CC0 text in LICENSE is also only the maintainers' own dedication. Neither applies to the MaxMind data. See also ATTRIBUTION.txt.