How IP Geolocation Works: Databases, Accuracy Levels & Why It's Sometimes Wrong
The complete guide to IP geolocation: how databases are built, how lookups work internally, accuracy by data type, and the common causes of wrong locations.
What Is IP Geolocation?
IP geolocation is the process of estimating a device's physical location based on its IP address. When you visit a website and see "you're browsing from [City, Country]," that's IP geolocation at work. It's used for content localization, fraud detection, regulatory compliance (GDPR, age verification), targeted advertising, CDN routing, and security analysis. Try it yourself with our IP Lookup tool.
Critically, IP geolocation is an estimate, not a precise GPS-style location. It typically achieves city-level accuracy (60–80% correct city in most databases) but can be off by tens or hundreds of kilometers, especially for mobile carriers, VPNs, and satellite connections.
How Geolocation Databases Are Built
IP geolocation providers (MaxMind, IP2Location, IPinfo, and others) build their databases from multiple data sources:
- Regional Internet Registry (RIR) data: ARIN, RIPE, APNIC, LACNIC, AFRINIC publish WHOIS records showing which organization was allocated each IP block and their registered address — a starting point, though often the ISP's headquarters, not the end user.
- ISP-provided data: Some ISPs share more granular allocation data with geolocation providers under commercial agreements.
- Triangulation from network latency: Measuring round-trip time from known reference points to estimate distance (similar in concept to GPS triangulation, but far less precise).
- User-submitted corrections: Websites using geolocation APIs report inaccuracies, which providers use to refine their databases.
- Wi-Fi and mobile network data: Crowdsourced from apps with location permission, correlating GPS coordinates with the visible IP address at that moment.
How the Database Lookup Actually Works
Internally, geolocation databases store rows of (start_ip_integer, end_ip_integer, country, region, city, latitude, longitude, ISP, ASN). Every IPv4 address is converted to a 32-bit integer for fast comparison. When you query an IP, the system performs a binary search across sorted ranges to find which row's start–end interval contains your IP integer.
This is why lookups are millisecond-fast even across databases with millions of rows — binary search on N sorted rows takes O(log N) comparisons, not a linear scan. Our IP Range Calculator outputs exactly this start/end integer format, which mirrors what geolocation databases use internally.
What Geolocation Accurately Determines
| Data Point | Typical Accuracy | Notes |
|---|---|---|
| Country | ~99% | Very reliable — allocation is country-specific |
| Region/State | ~80–90% | Reliable for most fixed broadband |
| City | ~55–80% | Often shows ISP's regional hub, not exact city |
| ZIP/Postal code | ~50–70% | Least reliable, varies heavily by provider |
| Exact street address | Not possible | IP geolocation cannot determine this — requires legal subpoena to ISP |
Why IP Geolocation Can Be Wrong
- Mobile carriers: Cellular IPs are often assigned from a centralized regional pool, showing the carrier's gateway city rather than your actual location, sometimes 100+ km off.
- VPNs and proxies: Your visible IP is the VPN server's location, not yours. Use our IP Lookup tool to check if an IP is flagged as a VPN/proxy/hosting provider.
- CGNAT: Multiple subscribers sharing one public IP can show the ISP's CGNAT gateway location rather than individual subscriber locations.
- Stale data: IP allocations change over time. If a database hasn't been updated recently, you might see an outdated mapping from when the IP block was allocated to a different organization.
- Satellite internet: Often shows the satellite provider's ground station location, which can be thousands of kilometers from the actual user.
IP Geolocation Use Cases
Related Tools & Guides
IP Lookup & Geolocation | My IP Address | ASN Lookup | IP Range Calculator | What Is an IP Address? | How to Hide Your IP