Ip to location database

ip, ip-location, ip-location-db, ipv4, ipv6, location, city, country, asn, autonomous-system, geoip, ip-country, ip-geolocation, ip2country, ip2location
npm install @ip-location-db/geolite2-city-7z@2.3.2024041218


ip-location-db NPM version

This project provides ip to location database in csv.
Country csv format: ip_range_start,ip_range_end,country_code
City csv format: ip_range_start,ip_range_end,country_code,state,city,latitude,longitude
country_code is the two-letter code defined in ISO 3166-1 alpha-2. You can get the country name, capital, continent, currency, languages, etc. from the country_code by Countries Database.

Database Type License Update ipv4 ipv6
IP-ASN Country Public Domain Daily asn-ipv4-country.csv asn-ipv6-country.csv
GeoFeed + IP-ASN Country Public Domain Daily geo-asn-ipv4-country.csv geo-asn-ipv6-country.csv
iptoasn.com Country PDDL by iptoasn.com Daily iptoasn-ipv4-country.csv iptoasn-ipv6-country.csv
Webnet77 Country DONATIONWARE by Webnet77 Daily webnet77-ipv4-country.csv webnet77-ipv6-country.csv
DB-IP Country CC BY 4.0 by DB-IP Monthly dbip-ipv4-country.csv dbip-ipv6-country.csv
DB-IP + IP-ASN Country CC BY 4.0 by DB-IP Daily dbip-asn-ipv4-country.csv dbip-asn-ipv6-country.csv
DB-IP City CC BY 4.0 by DB-IP Monthly dbip-ipv4-city.csv.gz dbip-ipv6-city.csv.gz

IP-ASN database [Update: Daily]

Created by merging 5 RIP (afrinic, apnic, arin, lacnic, ripe ncc) IP-ASN database. ASN (Autonomous System Number) is a unique number assigned to an Autonomous System (AS) by the IANA.

GeoFeed database [Update: Daily]

Created by merging GeoFeed database from OpenGeoFeed and geofeeds.lacnic.net.

iptoasn.com database [Update: Hourly]

You can download hourly updated database in tsv format from original site. This is licensed under a Public Domain Dedication and Licence v1.0. There are some differences from above IP-ASN database.

Webnet77 database [Update: Daily]

Created by webnet77 geo-ip country database. This database is donationware, please read the license carefully.
We recommend donating to webnet77, if you use this database especially for commercial use.

DB-IP database [Update: Monthly]

Created by DB-IP database which you could download and read the license from ip-to-country-lite or ip-to-city-lite. These are licensed under a Creative Commons Attribution 4.0 International License, so, you must create attribution to DB-IP.com for using this database.
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, no attribution or daily updates, please use the Commercial Version of db-ip.

Which database is recommended to use?

Of course, it depends on your use case. But the above list is too long, thus, we write down the recommendation.

  • If you need city or geo-location data, DB-IP is the one.
  • If you need Public Domain country database, GeoFeed + IP-ASN looks best.
  • If you need more precise country database, DB-IP+ IP-ASN looks best.


Files in dist/* have their own license as described above.
Files other than dist/* are under MIT License by sapics/ip-location-db.
When you write the attribution to this project, we are glad if you make a link to sapics/ip-location-db.