← Back to Blog
Geolocation

IP Geolocation Lookup: How It Works

The technology behind IP geolocation, its accuracy levels, and common use cases for businesses and developers.

9 min read Published November 17, 2025

IP geolocation is the process of estimating the real-world geographic location of an IP address. When you visit a website that says "We detected you're in London" or a streaming service blocks content because "it's not available in your region," IP geolocation is at work. It powers a vast range of functionality across the internet β€” from personalisation and analytics to fraud detection and regulatory compliance.

How Geolocation Databases Are Built

Building a geolocation database is an ongoing data aggregation effort, not a one-time mapping exercise. IP address allocation and usage constantly shifts as blocks are transferred, reassigned, and renumbered. The main data sources are:

  • RIR WHOIS data β€” Regional Internet Registries (ARIN, RIPE NCC, APNIC, LACNIC, AFRINIC) record which organisations have been allocated which IP blocks, along with the country of the registrant. This gives reliable country-level data for most allocations.
  • BGP routing data β€” Border Gateway Protocol announcements tell you which AS is currently advertising each IP block. Combined with ASN geolocation (which is generally reliable at the country level), this provides a second data point.
  • Active latency probing β€” Sending ping requests from known geographic locations and measuring round-trip times narrows down where an IP is physically located. An IP that has 5ms latency from Frankfurt and 200ms from New York is probably in Europe.
  • User-reported data β€” Opt-in location verification programmes, GPS-corroborated sessions, and user-confirmed location data improve accuracy for specific IP ranges.
  • ISP cooperation β€” Some ISPs share anonymised network topology data that helps map their customer-facing IP ranges to specific regions or cities.
  • Wi-Fi geolocation data β€” For mobile networks, correlation between Wi-Fi access point databases and IP assignment helps narrow location.

Accuracy by Specificity Level

Geolocation accuracy degrades as you request more specific information. Understanding these limits is critical to using geolocation data responsibly:

Country level (95–99% accurate) β€” The most reliable level. Country is encoded in RIR allocation records, and most IP blocks don't cross national borders. Errors at this level usually involve proxies, VPNs, or unusual routing arrangements.

Region / State level (55–80% accurate) β€” Useful as a signal but should not be relied upon for decisions. An IP in California might geolocate to the correct state most of the time, but ISP routing can place it in Nevada or Oregon.

City level (50–75% accurate) β€” Highly variable. Works reasonably well for well-mapped countries with dense geolocation data (US, UK, Germany, Japan). Works poorly for rural areas, emerging markets, and countries with limited ISP cooperation.

Postal code level (30–60% accurate) β€” Treated as a rough guide at best. The same IP can geolocate to different postal codes depending on which database you query.

Coordinate level (highly misleading) β€” IP geolocation coordinates are almost never the device's actual physical location. They're typically the centroid of a city, the location of the ISP's main office, or the location of the data centre handling the connection. Never treat IP-derived coordinates as a substitute for GPS.

Types of IPs That Defy Accurate Geolocation

Several categories of IP are systematically difficult to geolocate accurately:

  • Mobile carrier IPs β€” Mobile networks use large shared IP pools with regional gateways. A user in Birmingham might exit through a gateway in London, appearing to be in London.
  • Satellite internet β€” Starlink and similar services often geolocate to the satellite operator's ground station, which may be hundreds or thousands of miles from the actual user.
  • Carrier-Grade NAT (CGNAT) β€” ISPs sharing a single public IP among hundreds of customers can't associate that IP with a precise location; it reflects the NAT gateway's location, not any individual subscriber.
  • VPN and proxy exit nodes β€” These geolocate to the exit server, not the real user. A UK user connecting through a US VPN appears to be in the US.
  • Enterprise and corporate IPs β€” Large companies route all their global traffic through central gateways, so employees in different countries appear to be in the same city.

Common Use Cases

Content personalisation β€” Serving language-appropriate content, showing local pricing in the correct currency, or pre-populating country selectors in forms. Country-level geolocation is reliable enough for this.

Streaming rights enforcement β€” Verifying that a user is in a country where content is licensed. Country-level checks are appropriate; the risk of false positives (legitimate users blocked) must be balanced against the cost of rights violations.

Fraud detection β€” Checking whether the IP's geolocation matches the billing address or the user's stated location. A US billing address with an IP geolocating to Eastern Europe is a meaningful fraud signal β€” especially when combined with other risk factors.

Regulatory compliance β€” GDPR compliance checks, sanctions screening (blocking access from sanctioned countries), and data residency enforcement all use country-level geolocation.

Analytics and reporting β€” Understanding where your users come from, which regions have the most traffic, and how usage patterns vary geographically.

Best Practices for Developers

Never use IP geolocation as the sole input for a consequential decision. Combine it with other signals: browser language preferences, user-provided location, timezone, and behavioural patterns. When geolocation data is used to restrict access, always provide a path for legitimate users to verify their identity or appeal the decision. Treat geolocation as a probabilistic signal with known accuracy limitations, not as a ground truth.

Try IP Analysis β†’
Powered by IPQS

Need proxy detection, VPN detection, or abuse scoring in your own application?