The accuracy of an IP address will vary largely from country to country. In parts of the world where there are many smaller countries, there is a higher chance that you get a false match on a specific country. In places like the U.S., it is almost always going to be accurate. Overall, the likelihood that your country match is accurate is about 95-99%.
However, when you start breaking it down to city level, the accuracy of the exact location of the user becomes far more variable. This is because the IP address that is identified is coming directly from a user’s Internet Service Provider (ISP). Most IPSs make use of dynamic IP addresses, particularly if they are relying on IPv4, of which there are a limited number of distinct addresses. This means that they may be using a random IP from a nearby town or city which may or may not be accurate as to where an individual who is accessing a site is physically located.
The information provided to the querying user is likely to be accurate to where the specific node exists, but not necessarily the exact location of the user. As a result, in order of accuracy, you will most likely get the correct country, but not necessarily the correct city or town (though it may within a reasonable range of distance), and almost certainly not the exact physical address of the user. If a user is attempting to access your site from a business, the results are more likely to be accurate, as many companies make use of static IP addresses.
Further complicating this is if users use a proxy or VPN. For instance, if a user chooses to use the TOR browser this will mask their access node by bouncing it around the world to many different anonymous proxies. If you are using TOR, you may be accessing the internet from somewhere in the US, but the end-computer may identify it as coming from somewhere in Eastern Europe, or wherever the last TOR node the connection reached before it hit the website is physically located. In other words, using TOR or a wide range of other proxies can seriously mask the location of the user to where it is not even easy to identify the part of the globe where the user is accessing your site. TOR is not the only proxy server out there; there are many that are designed to mask the access point of the user.
Identifying where a user is actually located depends largely on a database. As we mentioned with dynamic addresses, the location sometimes changes. Sometimes the location of an IP address moves, so the data that is associated with it, if it has not been updated in whois records, will be inaccurate.