GeoIP refers to the method of obtaining the geographic location of a specific device by its IP. Many alternatives to access information of this kind allow you to obtain as well more specific information as the city, state, province, local currency, latitude and longitude, company detail, ISP lookup (internet service provider), language, zip code, country calling code, time zone, current time, sunset and sunrise time, moonset and moonrise time from any provided IPv4 and IPv6 address. According to the type of implementation, you may read this information either from an API over HTTP or the specific GeoIP databases to obtain this information in JSON or XML format.
In this article, I will share with you 5 of the most awesome and free GeoIP databases that you can access nowadays.
5. IP2C (API)
ip2c.org is a very useful online tool/service that exists to resolve IPs to country codes/names. You can access this API with multiple languages through an HTTP request.
4. IPAPI (API)
ipapi provides an easy-to-use API interface allowing customers to look at various pieces of information IPv4 and IPv6 addresses are associated with. For each IP address processed, the API returns more than 45 unique data points, such as location data, connection data, ISP information, time zone, currency, and security assessment data. The API is REST-based, lookup requests are made using straightforward HTTP GET URLs, and results are returned in lightweight JSON or XML format within a matter of a few milliseconds.
This API documentation will outline in detail the API's specification, access, and features. At the very bottom, you will find code examples in different programming languages. In case any technical questions are left unanswered, please feel free to contact ipapi Customer Service.
3. IP2Location Lite (self-hosted)
IP2Location LITE databases consist of IP addresses that are being used to determine the geolocation information of an IP address like country, region or state, city, latitude, longitude, zip code, and time zone. If you are looking for high data accuracy, more records, and customer support, please kindly try the commercial edition.
IP2Location™ LITE IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE Database provides a solution to determine the country, region or state, city, latitude, longitude, ZIP code, and time zone of origin for any IP address in a few simple steps. First, retrieve the IP address from the networking protocol or server-side variable of the Web server. Next, translate the IP address to an IP number in decimal format to speed up the database query. Lastly, reverse lookup the IP number from the IP2Location™ database to pinpoint the exact geographical location. The LITE edition is a free version of the database with limited accuracy & number of records compares to commercial release. It is free for personal or commercial use with attribution required by mentioning the use of this data.
2. IP Geolocation (API)
Free IP API is a free and paid service that provides country, city, state, province, local currency, latitude and longitude, company detail, ISP lookup, language, zip code, country calling code, time zone, current time, sunset and sunrise time, moonset and moonrise time from any IPv4 and IPv6 address in REST, JSON and XML format over HTTPS. The IP Geolocation API allows you to:
- Lookup any IPv4 or IPv6 address with our API to know its physical location, detect TOR, Proxy, VPN, threat, robot, and user agent.
- Get the exact sunrise, sunset, moonset and moonrise timings with our API from an IP Address or GPS Coordinates.
- Get accurate date time and local time information from an IP address, GPS Coordinates, and time zone string.
1. Maxmind GeoLite2 Database (self-hosted)
GeoLite2 databases are free IP geolocation databases comparable to, but less accurate than, MaxMind’s GeoIP2 databases. The GeoLite2 Country, City, and ASN databases are updated weekly, every Tuesday. MaxMind does not provide official support for the free GeoLite2 databases. If you have questions about the GeoLite2 databases or GeoIP2 APIs, please see StackOverflow's GeoIP questions and answers or our GeoLite FAQ.
The GeoLite2 end-user license agreement, which incorporates components of the Creative Commons Attribution-ShareAlike 4.0 International License can be found here. The attribution requirement may be met by including the following in all advertising and documentation mentioning features of or use of this database. They also offer redistribution licenses for GeoLite2 databases that allow you to package the databases with your commercial products without the need for attribution. For more information, please visit the GeoLite2 Commercial Redistribution page.
Honorable mentions
IP Base
https://ipbase.com/ is an easy-to-use and features complete IP Geolocation API with global coverage. It provides a reliable & scalable IP API for software developers. It uses a database of IP addresses associated with cities and other relevant information like time zone, latitude & longitude. The IP data API is not only easy to integrate but comes along with an entire suite of REST-Clients and pre-built integrations. Additionally, they provide a Postman-Collection.
Unlike other geolocation techniques like GPS, IP geolocation is non-specific and cannot be utilized for real-time device tracking. Our IP address database is updated daily to ensure the highest possible accuracy. In case you're wondering, yes, ipbase.com provides a free plan where no payment details are required.
Final thoughts
The accuracy of the databases is specified by all the information that it contains, if the IP/IP Pattern isn't in the database, you will obtain nothing useful. Most of them are incredibly accurate at the country level. Depending on the region, the accuracy of the information may differ, for example, in developed countries, the information will be usually up to date, however in less developed countries, some information may be missing.
If you know another free database or API that offers the possibility to obtain geoinformation from the user's IP, please share it with the community in the comment box.