This project provides IP to location databases in CSV and MMDB formats since 2019.
There are 3 types of IP database in this repository: country, city and asn files. All have their own standard format.
ip_range_start, ip_range_end, country_code| Database | License | Updated | IPv4 | IPv6 | IPv4+IPV6 | IPv4-num | IPv6-num | IPv4-CIDR | IPv6-CIDR |
|---|---|---|---|---|---|---|---|---|---|
| user-country | PDDL | Daily | CSV MMDB |
CSV MMDB |
CSV MMDB |
CSV | CSV | CSV | CSV |
| server-country | PDDL | Daily | CSV MMDB |
CSV MMDB |
CSV MMDB |
CSV | CSV | CSV | CSV |
| GeoLite2 | GeoLite2 License by MaxMind | Twice weekly | CSV MMDB |
CSV MMDB |
CSV MMDB |
CSV | CSV | CSV | CSV |
| DB-IP Lite | CC BY 4.0 by DB-IP |
Monthly | CSV MMDB |
CSV MMDB |
CSV MMDB |
CSV | CSV | CSV | CSV |
| IPtoASN | PDDL | Daily | CSV MMDB |
CSV MMDB |
CSV MMDB |
CSV | CSV | CSV | CSV |
ip_range_start, ip_range_end, country_code, state1, state2, city, postcode, latitude, longitude, timezone| Database | License | Updated | IPv4 | IPv6 | IPv4-num | IPv6-num |
|---|---|---|---|---|---|---|
| DB-IP Lite | CC BY 4.0 by DB-IP |
Monthly | CSV.gz CSV.7z MMDB |
CSV.gz CSV.7z MMDB |
CSV.gz CSV.7z |
CSV.gz CSV.7z |
| GeoLite2 | GeoLite2 License by MaxMind | Twice weekly | CSV.gz CSV.7z MMDB |
CSV.gz CSV.7z MMDB |
CSV.gz CSV.7z |
CSV.gz CSV.7z |
ip_range_start, ip_range_end, autonomous_system_number, autonomous_system_organization| Database | License | Updated | IPv4 | IPv6 | IPv4+IPV6 | IPv4-num | IPv6-num | IPv4-CIDR | IPv6-CIDR |
|---|---|---|---|---|---|---|---|---|---|
| origin-asn | PDDL | Daily | CSV MMDB |
CSV MMDB |
CSV MMDB |
CSV | CSV | CSV | CSV |
| GeoLite2 | GeoLite2 License by MaxMind | Twice weekly | CSV MMDB |
CSV MMDB |
CSV MMDB |
CSV | CSV | CSV | CSV |
| DB-IP Lite | CC BY 4.0 by DB-IP |
Monthly | CSV MMDB |
CSV MMDB |
CSV MMDB |
CSV | CSV | CSV | CSV |
| IPtoASN | PDDL | Daily | CSV MMDB |
CSV MMDB |
CSV MMDB |
CSV | CSV | CSV | CSV |
user-country, server-country, and origin-asn are published under the Public Domain Dedication and License v1.0 (PDDL) (free use without attribution).
These datasets are compiled from raw, public network data. We aim to use sources free of commercial or redistribution restrictions to maintain this permissive licensing.
Huge thanks to the following organizations for providing the foundational data:
We use public statistical data (e.g., delegated statistics) from the five Regional Internet Registries (AFRINIC, APNIC, ARIN, LACNIC, RIPE NCC) and the NRO.
- License: Subject to the NRO License and respective RIR copyright statements.
We aggregate global BGP routing data (RIB dumps and BGP updates) to analyze network visibility and active IP prefixes using the two primary open routing archives:
- Route Views (University of Oregon)
- RIPE RIS (RIPE NCC)
We integrate geolocation data from geofeeds published by network operators worldwide (RFC 8805 / RFC 9632).
- Note: While geofeeds are intended for public use, many lack explicitly defined licenses. We use this data "as is" to compile our datasets.
To comply with data providers' Acceptable Use Policies (AUP) and maintain our PDDL licensing, we DO NOT use RIR WHOIS or IRR databases (e.g., inetnum, country, geoloc) for geographic mapping.
Many RIRs strictly prohibit this (e.g., APNIC's AUP states: "you cannot use the database to map IP address to geographic location"). By relying only on open routing records and public geofeeds, we keep our datasets compliant and safe for public use.
Both databases share the same data sources but prioritize different geographic points:
user-country(Recommended): Prioritizes the end-user's country, even when routed through VPNs or proxies. Best for most general applications.server-country: Prioritizes the physical server or relay point. Best for specific network analysis (e.g., determining routing locations).
(Note: Both databases return almost identical results in most instances.)
IPtoASN database [Update: Hourly]
You can download hourly updated database in tsv format from original site. This is licensed under a Public Domain Dedication and License v1.0.
DB-IP database [Update: Monthly]
You could download and read the license from ip-to-asn-lite or ip-to-country-lite or ip-to-city-lite.
These database are licensed under a CC BY 4.0.
In the case of a web application, you must include a link back to DB-IP.com on pages that display or use results from the database. You may do it by pasting the HTML code snippet into your code: <a href='https://db-ip.com/'>IP Geolocation by DB-IP</a>.
If you need better accuracy or no attribution or daily updates, please use the Commercial Version of db-ip.
GeoLite2 database [Update: Twice weekly]
GeoLite2 is created by MaxMind. The license of GeoLite2 is written in GEOLITE2_LICENSE and End User License Agreement (EULA) is written in GEOLITE2_EULA. Please carefully read the GEOLITE2_LICENSE and GEOLITE2_EULA files, if you use these database. This package comes with certain restrictions and obligations, most notably:
- You cannot prevent the library from updating the databases.
- You cannot use the GeoLite2 data:
- for FCRA purposes,
- to identify specific households or individuals.
You can read the latest version of GeoLite2 EULA. GeoLite2 databse is provided under CC BY-SA 4.0 by MaxMind. If you need better accuracy, please use the commercial version GeoIp2.
It depends upon your use-case! We do have some simple recommendations though:
- If you need postcodes or timezones:
geolite2-city - If you need city data with a CC-BY Licence:
dbip-city - If you need a country database without attribution:
user-country - If you need an ASN database:
origin-asn
Since there is no definitive information on IP addresses and country_code, it is difficult to discuss the accuracy of our data qualitatively, but it is possible to estimate the approximate accuracy by comparing it with the country information in GeoLite2 and DbIp Lite. By comparing the database in GeoLite2, which is well known for its high accuracy, with the differences in other databases, we can see that our data accuracy.
| Database | Same | Diff | Empty | Extra |
|---|---|---|---|---|
| user-country | 97.49% | 2.51% | 0.00% | 0.03% |
| dbip-country | 94.49% | 5.51% | 0.00% | 0.44% |
| iptoasn-country | 78.50% | 5.84% | 15.66% | 0.04% |
Measurements were taken in 14 June 2026. Because the ipv6 range is too wide, the measurements here are limited to ipv4 results. "Same" + "Diff" + "Empty" shows the GeoLite2 IP-range, and the GeoLite2 IP-range size is listed as 100%.
- "Same" indicates the percentage of country_codes in Database that are the same as the country_code in GeoLite2.
- "Diff" indicates the percentage of country_codes in Database that are different from GeoLite2 country_code.
- "Empty" shows the percentage of IPs with GeoLite2 country_code but no corresponding country_code in Database.
- "Extra" indicates the percentage of IPs with no GeoLite2 country_code listed that had a country_code listed in the Database.
If you would like to integrate MMDB files into an existing project there are several libraries that can help.
Libraries exist in many languages when using the MMDB files. There are official, Maxmind developed libraries for many popular languages: .NET, C, Node.js, Perl, PHP, Python and Ruby, and third-party readers for others: Erlang, Go, Rust.
If you wish to create your own MMDB files from the CSV files (to customise their format) there are a couple of official libraries: Go and Perl (now archived). There are also some third-party options: Python and Rust.
| Library | Language | Description | Types | Auto Updates |
|---|---|---|---|---|
| ip-location-api | Node.js | Fast ip to country lookup by using in-memory database (7MB RAM) | countrycity |
✓ |
| country country-extra |
Browser js | Ip to country lookup in browser | country |
✓ |
| geocode geocode-extra |
Browser js | Ip to geocode lookup in browser | countrylatitudelongitude |
✓ |
| Application | Language | Description | Types | Auto Updates |
|---|---|---|---|---|
| ip_location_server | Java | An in-memory GRPC and HTTP server mapping IP addresses to locations (requires at least 1.5GB RAM) | countryasncity |
✓ |
| ip-location-api | Go | API server creating / supporting MMDB, PostgreSQL, MySQL / MariaDB and SQLite | countryasncity |
✓ |
| Ip-geo-API | Go | In-memory API server | country |
✘ |
| IPInfoOffline | Windows | Desktop tool showing information about IP addresses (local data) | countryasncity |
✘ |
| Tool | Description |
|---|---|
| ip-location-to-mmdb | Basic conversion from CSV files from this database into MMDB files |
| mmdbmeld | Create and customise MMDB files from CSV files in this database |
The required licence depends upon the database which you use. Please carefully read each database licence before use.
You can use PDDL (ODC Public Domain Dedication and Licence) licensed databases without attribution for any purpose.
We'd be grateful if you could link back to sapics/ip-location-db, and star this project to help others find it.