# ip-location-db


| Database | Type | License | Update | ipv4 | ipv6 | ipv4-num | ipv6-num |
|---|---|---|---|---|---|---|---|
| ASN <br>[![npm version](https://img.shields.io/npm/v/@ip-location-db/asn-country?color=success&style=flat-square&label=%20)](https://www.npmjs.com/package/@ip-location-db/asn-country) | Country | [CC0](https://creativecommons.org/publicdomain/zero/1.0/deed) | Daily | [asn-country-ipv4.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/asn-country/asn-country-ipv4.csv) | [asn-country-ipv6.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/asn-country/asn-country-ipv6.csv) |[asn-country-ipv4-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/asn-country/asn-country-ipv4-num.csv) | [asn-country-ipv6-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/asn-country/asn-country-ipv6-num.csv) |
| GeoFeed + ASN<br>[![npm version](https://img.shields.io/npm/v/@ip-location-db/geo-asn-country?color=success&style=flat-square&label=%20)](https://www.npmjs.com/package/@ip-location-db/geo-asn-country) | Country | [CC0](https://creativecommons.org/publicdomain/zero/1.0/deed) | Daily | [geo-asn-country-ipv4.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geo-asn-country/geo-asn-country-ipv4.csv) | [geo-asn-country-ipv6.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geo-asn-country/geo-asn-country-ipv6.csv) | [geo-asn-country-ipv4-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geo-asn-country/geo-asn-country-ipv4-num.csv) | [geo-asn-country-ipv6-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geo-asn-country/geo-asn-country-ipv6-num.csv) |
| GeoFeed + Whois + ASN<br>[![npm version](https://img.shields.io/npm/v/@ip-location-db/geo-whois-asn-country?color=success&style=flat-square&label=%20)](https://www.npmjs.com/package/@ip-location-db/geo-whois-asn-country)| Country | [CC0](https://creativecommons.org/publicdomain/zero/1.0/deed) | Daily | [geo-whois-asn-country-ipv4.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geo-whois-asn-country/geo-whois-asn-country-ipv4.csv) | [geo-whois-asn-country-ipv6.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geo-whois-asn-country/geo-whois-asn-country-ipv6.csv) | [geo-whois-asn-country-ipv4-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geo-whois-asn-country/geo-whois-asn-country-ipv4-num.csv) | [geo-whois-asn-country-ipv6-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geo-whois-asn-country/geo-whois-asn-country-ipv6-num.csv) |
| [iptoasn.com](https://iptoasn.com/)<br>[![npm version](https://img.shields.io/npm/v/@ip-location-db/iptoasn-country?color=success&style=flat-square&label=%20)](https://www.npmjs.com/package/@ip-location-db/iptoasn-country)| Country | [PDDL](https://opendatacommons.org/licenses/pddl/1.0/) by [iptoasn.com](https://iptoasn.com/)<sup>&clubs;</sup> | Daily | [iptoasn-country-ipv4.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/iptoasn-country/iptoasn-country-ipv4.csv) | [iptoasn-country-ipv6.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/iptoasn-country/iptoasn-country-ipv6.csv) | [iptoasn-country-ipv4-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/iptoasn-country/iptoasn-country-ipv4-num.csv) | [iptoasn-country-ipv6-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/iptoasn-country/iptoasn-country-ipv6-num.csv) |
| [Webnet77](http://software77.net/geo-ip/)<br>[![npm version](https://img.shields.io/npm/v/@ip-location-db/webnet77-country?color=success&style=flat-square&label=%20)](https://www.npmjs.com/package/@ip-location-db/webnet77-country)| Country | [Donationware](http://en.wikipedia.org/wiki/Donationware) by [Webnet77](http://software77.net/geo-ip/)<sup>&spades;</sup> | Daily | [webnet77-country-ipv4.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/webnet77-country/webnet77-country-ipv4.csv) | [webnet77-country-ipv6.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/webnet77-country/webnet77-country-ipv6.csv) | [webnet77-country-ipv4-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/webnet77-country/webnet77-country-ipv4-num.csv) | [webnet77-country-ipv6-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/webnet77-country/webnet77-country-ipv6-num.csv) |
| [DB-IP](https://db-ip.com/) Lite<br>[![npm version](https://img.shields.io/npm/v/@ip-location-db/dbip-country?color=success&style=flat-square&label=%20)](https://www.npmjs.com/package/@ip-location-db/dbip-country)| Country | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) <br> by [DB-IP](https://db-ip.com/)<sup>&#9733;</sup> | Monthly | [dbip-country-ipv4.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/dbip-country/dbip-country-ipv4.csv) | [dbip-country-ipv6.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/dbip-country/dbip-country-ipv6.csv) | [dbip-country-ipv4-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/dbip-country/dbip-country-ipv4-num.csv) | [dbip-country-ipv6-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/dbip-country/dbip-country-ipv6-num.csv) |
| [DB-IP](https://db-ip.com/) Lite<br>[![npm version](https://img.shields.io/npm/v/@ip-location-db/dbip-city?color=success&style=flat-square&label=%20)](https://www.npmjs.com/package/@ip-location-db/dbip-city)| City | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) <br> by [DB-IP](https://db-ip.com/)<sup>&#9733;</sup> | Monthly | [dbip-city-ipv4.csv.gz](https://github.com/sapics/ip-location-db/raw/master/dbip-city/dbip-city-ipv4.csv.gz) | [dbip-city-ipv6.csv.gz](https://github.com/sapics/ip-location-db/raw/master/dbip-city/dbip-city-ipv6.csv.gz) | [dbip-city-ipv4-num.csv.gz](https://github.com/sapics/ip-location-db/raw/master/dbip-city/dbip-city-ipv4-num.csv.gz) | [dbip-city-ipv6-num.csv.gz](https://github.com/sapics/ip-location-db/raw/master/dbip-city/dbip-city-ipv6-num.csv.gz) |
| [GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/)<br>[![npm version](https://img.shields.io/npm/v/@ip-location-db/geolite2-country?color=success&style=flat-square&label=%20)](https://www.npmjs.com/package/@ip-location-db/geolite2-country)| Country | GeoLite2 License by [MaxMind](https://www.maxmind.com/)<sup>&hearts;</sup> | Weekly  | [geolite2-country-ipv4.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geolite2-country/geolite2-country-ipv4.csv) | [geolite2-country-ipv6.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geolite2-country/geolite2-country-ipv6.csv) | [geolite2-country-ipv4-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geolite2-country/geolite2-country-ipv4-num.csv) | [geolite2-country-ipv6-num.csv](https://cdn.jsdelivr.net/npm/@ip-location-db/geolite2-country/geolite2-country-ipv6-num.csv) |
| [GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/)<br>[![npm version](https://img.shields.io/npm/v/@ip-location-db/geolite2-city?color=success&style=flat-square&label=%20)](https://www.npmjs.com/package/@ip-location-db/geolite2-city)| City | GeoLite2 License by [MaxMind](https://www.maxmind.com/)<sup>&hearts;</sup> | Weekly  | [geolite2-city-ipv4.csv.gz](https://github.com/sapics/ip-location-db/raw/master/geolite2-city/geolite2-city-ipv4.csv.gz) | [geolite2-city-ipv6.csv.gz](https://github.com/sapics/ip-location-db/raw/master/geolite2-city/geolite2-city-ipv6.csv.gz) | [geolite2-city-ipv4-num.csv.gz](https://github.com/sapics/ip-location-db/raw/master/geolite2-city/geolite2-city-ipv4-num.csv.gz) | [geolite2-city-ipv6-num.csv.gz](https://github.com/sapics/ip-location-db/raw/master/geolite2-city/geolite2-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
`country_code` is the two-letter code defined in [ISO 3166-1 alpha-2](https://wikipedia.org/wiki/ISO_3166-1_alpha-2).
You can get the `country name, capital, continent, currency, languages, etc.` from the `country_code` by [Countries Database](https://github.com/annexare/Countries) in JSON, CSV, SQL format.

##### ip address format
`ip_range_start` and `ip_range_end` is ip address.
- `ipv4`: The csv line `1.0.0.0,1.0.0.255,AU` means that ip addresses between `1.0.0.0` and `1.0.0.255` inclusive are `AU` country_code.
- `ipv4-num`: The csv line `16777216,16777471,AU` means that ip addresses between `1.0.0.0` and `1.0.0.255` inclusive are `AU` country_code. (`16777216` is the number format of the ip address `1.0.0.0`)
- `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](https://afrinic.net), [apnic](https://www.apnic.net), [arin](https://www.arin.net), [lacnic](https://www.lacnic.net), [ripe ncc](https://www.ripe.net)) IP-ASN database.
[ASN (Autonomous System Number)](https://wikipedia.org/wiki/Autonomous_system_(Internet)) is a unique number assigned to an Autonomous System (AS) by the [IANA](https://www.iana.org/).



### GeoFeed database [Update: Daily]

Created by merging GeoFeed database from [OpenGeoFeed](https://opengeofeed.org/).



### Whois database [Update: Daily]

Created by merging 5 RIP provided WHOIS database.
There are some inconsistencies between 5 RIP.



### [iptoasn.com](https://iptoasn.com/)<sup>&clubs;</sup> database [Update: Hourly]

You can download hourly updated database in tsv format from [original site](https://iptoasn.com/).
This is licensed under a [Public Domain Dedication and Licence v1.0](https://opendatacommons.org/licenses/pddl/1.0/).
There are some differences from above `ASN` database.



### [Webnet77](https://software77.net/geo-ip/)<sup>&spades;</sup> database [Update: Daily]

This database is donationware, please read [the license](https://software77.net/geo-ip/?license) carefully.<br>
We **recommend donating to [webnet77](https://software77.net/geo-ip/), if you use this database especially for commercial use**.



### [DB-IP](https://db-ip.com/)<sup>&#9733;</sup> database [Update: Monthly]

You could download and read the license from [ip-to-country-lite](https://db-ip.com/db/download/ip-to-country-lite) or [ip-to-city-lite](https://db-ip.com/db/download/ip-to-city-lite).
These database are licensed under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/),
so, **you must create attribution to [DB-IP.com](https://db-ip.com/) for using this database**.<br>
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>`.<br>
If you need better accuracy or no attribution or daily updates, please use the [Commercial Version of db-ip](https://db-ip.com/db/ip-to-country).



### [GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/)<sup>&hearts;</sup> database [Update: Weekly]

GeoLite2 is created by [MaxMind](https://www.maxmind.com).
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](https://www.maxmind.com/en/geoip2-databases).



## 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

License depends on the database which you use. Please read carefully each database license.
You can use [PDDL](https://opendatacommons.org/licenses/pddl/1.0/) (ODC Public Domain Dedication and Licence) or [CC0](https://creativecommons.org/publicdomain/zero/1.0/deed) (Creative Commons Zero) licensed database without attribution for any purpose.

We are glad if you make a link to [sapics/ip-location-db](https://github.com/sapics/ip-location-db), or give us a star to [the github repository](https://github.com/sapics/ip-location-db).
