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/...
This is the IPv4 network in CIDR format such as 2.21.92.0/29.
geoname_id
integer
A unique identifier for the network's location as specified by GeoNames. It is the id of the country, or of a continent when MaxMind gives no country. Where MaxMind has no location for the network, the registered country is used; if there is none either, it is empty.
continent_code
string
The continent code for this IP: AF - Africa, AN - Antarctica, AS - Asia, EU - Europe, NA - North America, OC - Oceania, SA - South America. Empty when the network has no location. NA is the code for North America, not a missing value.
continent_name
string
The continent name for this location
country_iso_code
string
A two-character ISO 3166-1 country code for the country associated with the location. Empty when the location is only a continent or unknown. NA is the code for Namibia, not a missing value.
country_name
string
The country name for this location. Empty when the location is only a continent or unknown.
is_anonymous_proxy
boolean
MaxMind's flag for an anonymous proxy: 1 or 0. In the data we checked every row is 0, so do not use it to detect proxies.
is_satellite_provider
boolean
MaxMind's flag for a satellite provider that serves several countries: 1 or 0. In the data we checked every row is 0.
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:
Column
Meaning
network
IPv4 network in CIDR notation, for example 1.0.0.0/24. Each network appears once
geoname_id
GeoNames id of the location: the country, or a continent when MaxMind gives no country. Empty when the network has no location
continent_code
AF, AN, AS, EU, NA (North America), OC or SA. Empty when the network has no location
continent_name
Continent name, for example Oceania
country_iso_code
ISO 3166-1 alpha-2 country code, for example AU. Empty when the location is only a continent or unknown
country_name
English country name, for example Australia
is_anonymous_proxy
MaxMind's flag for an anonymous proxy: 1 or 0
is_satellite_provider
MaxMind's flag for a satellite provider that serves several countries: 1 or 0
Known limitations
The codes NA are real values: continent_codeNA is North America and country_iso_codeNA 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.
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:
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.
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.
API access
Access dataset files directly from scripts, code, or AI agents.
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.