Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @ip-location-db/asn-country with all npm packages installed. Try it out:

@ip-location-db/asn-country lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("@ip-location-db/asn-country/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@ip-location-db/asn-country v2.2.2020112318

Ip to location database


npm version
GeoFeed + ASN
npm version
GeoFeed + Whois + ASN
npm version
npm version
CountryPDDL by iptoasn.comDailyiptoasn-country-ipv4.csviptoasn-country-ipv6.csviptoasn-country-ipv4-num.csviptoasn-country-ipv6-num.csv
npm version
CountryDonationware by Webnet77Dailywebnet77-country-ipv4.csvwebnet77-country-ipv6.csvwebnet77-country-ipv4-num.csvwebnet77-country-ipv6-num.csv
DB-IP Lite
npm version
CountryCC BY 4.0
by DB-IP
DB-IP Lite
npm version
CityCC BY 4.0
by DB-IP
npm version
CountryGeoLite2 License by MaxMindWeeklygeolite2-country-ipv4.csvgeolite2-country-ipv6.csvgeolite2-country-ipv4-num.csvgeolite2-country-ipv6-num.csv
npm version
CityGeoLite2 License by MaxMindWeeklygeolite2-city-ipv4.csv.gzgeolite2-city-ipv6.csv.gzgeolite2-city-ipv4-num.csv.gzgeolite2-city-ipv6-num.csv.gz

CSV format

This project provides ip to location database in csv format.

Country csv format

ip_range_start, ip_range_end, country_code

City csv format

ip_range_start, ip_range_end, country_code, state1, state2, city, postcode, latitude, longitude, timezone


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 in JSON, CSV, SQL format.

ip address format

ip_range_start and ip_range_end is ip address.

  • ipv4: The csv line,,AU means that ip addresses between and inclusive are AU country_code.
  • ipv4-num: The csv line 16777216,16777471,AU means that ip addresses between and inclusive are AU country_code. (16777216 is the number format of the ip address
  • ipv6: The csv line 2001:200::,2001:200:ffff:ffff:ffff:ffff:ffff:ffff,JP means that ip addresses between 2001:200:: and 2001:200:ffff:ffff:ffff:ffff:ffff:ffff inclusive are JP country_code.
  • ipv6-num: The csv line 42540528726795050063891204319802818560,42540528806023212578155541913346768895,JP means that ip addresses between 2001:200:: and 2001:200:ffff:ffff:ffff:ffff:ffff:ffff inclusive are JP country_code. (42540528726795050063891204319802818560 is the number format of the ip address 2001:200::)

Please be careful when using ipv6 and ipv6-num in your program. The numerical value exceeds 32bit unsigned integer, so you need to use 64bit unsigned integer.

Databases referenced in this project

When merging multiple database, set the front database above back one. (ex. geo-whois-asn-...csv is created by merging 3 database with GeoFeed > Whois > ASN.)

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.

Whois database [Update: Daily]

Created by merging 5 RIP provided WHOIS database. There are some inconsistencies between 5 RIP. 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 ASN database.

Webnet77 database [Update: Daily]

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]

You could download and read the license from ip-to-country-lite or ip-to-city-lite. These database are licensed under a Creative Commons Attribution 4.0 International License, so, you must create attribution to for using this database.
In the case of a web application, you must include a link back to 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=''>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: 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.

If you need better accuracy, please use the commercial version GeoIp2.

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 postcode or timezone, geolite2-city is the one.
  • If you need city data with CC-BY License, dbip-city is the one.
  • If you need country database with Public Domain, we recommend geo-whois-asn-country database.


License depends on the database which you use. Please read carefully each database license. You can use PDDL (ODC Public Domain Dedication and Licence) or CC0 (Creative Commons Zero) licensed database without attribution for any purpose.

We are glad if you make a link to sapics/ip-location-db, or give us a star to the github repository.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free