How does IP geolocation work?

Turning a network address into a place on a map, and why the map is often wrong.

Start here: nothing in the address is a location

This is the fact that makes the rest make sense. There is no field inside 203.0.113.42 that says Pennsylvania. The number identifies a network endpoint and nothing else. Every location you have ever been shown from an IP address is an inference built from other records.

Once you know that, "why is it wrong" stops being mysterious. The question is not why the address lies. It is how good the guess can be.

Where a location guess comes from No part of an IP address encodes a place. A geolocation database combines registry records, routing announcements, latency measurement and user-submitted corrections into an estimate. Nothing in 203.0.113.42 says "Easton, Pennsylvania" The number is an identifier, not a coordinate. Everything below is inference. Registry Which company holds this block, and where it operates Routing Which networks announce it, and from where Measurement Round-trip times from many known points, triangulated Corrections Reports from users and providers who know better A geolocation database publishes one best guess per block Every website you visit buys or licenses one of these. Two sites can disagree about you on the same day.
Four independent sources, combined into one published best guess per address block. Different providers weigh them differently, which is why two websites can disagree about you on the same afternoon.

Where the four sources come from

Registry records

When a provider is allocated a block of addresses, that allocation is registered with a Regional Internet Registry such as ARIN, RIPE NCC or APNIC. The record names the organization and usually a country. That is the floor: it is why country-level accuracy is high and why an address rarely lands on the wrong continent.

Routing announcements

Networks announce to each other which address ranges they carry, using BGP. Watching those announcements from many vantage points shows which networks a block sits behind and where those networks physically interconnect. It narrows a country down toward a region.

Active measurement

This is the clever part. A provider sends packets to addresses in a block from many machines whose locations are known exactly, and times the replies. Light in fiber covers roughly 125 miles per millisecond of round trip, so a consistent 2ms reply from a known city puts you within a plausible radius of it. Doing that from several directions triangulates.

Corrections

Providers and end users report bad records, and the databases absorb them. This matters more than it sounds, because it is the only source that can fix a specific wrong answer rather than improve an average. It is also the lever available to you, covered below.

Some providers additionally buy location data directly from internet providers. That produces better answers and raises obvious privacy questions, and it is not universal.

How accurate is it really?

Accuracy is not one number. It collapses as you zoom in, and the drop between region and city is where most people's expectations break.

How accurate IP geolocation is by level Country level accuracy is very high. Region is moderate. City is roughly a coin flip and worse on mobile, satellite and VPN connections. Street level is not something IP geolocation can do at all. Accuracy falls off a cliff as you zoom in Country very high Region moderate City a coin flip Street not possible Bars are illustrative rather than measured, and every provider publishes different figures. Worst on mobile carriers, satellite links, VPNs, and corporate networks that leave through one office. In those cases the answer describes the network's exit point, which can be hundreds of miles away.
Country is close to reliable. City is roughly a coin flip in general, and much worse than that on the connection types below. Street level is not something IP geolocation does at all, whatever a television show suggested.

Published figures put country accuracy above 95 percent for most providers. City accuracy is commonly quoted between 50 and 80 percent, and the honest reading of that range is that it depends enormously on who your provider is and where you live. Dense urban areas on a fixed-line provider do well. Everything else does worse.

The five reasons it gets you wrong

Your provider hands off somewhere else

A large provider may carry traffic from an entire region to a single point of presence before it reaches the wider internet. Everyone in that region then looks like they are in that one city. If you are consistently placed in a bigger city an hour away, this is almost always why.

You are on a mobile network

Carriers aggregate traffic from enormous areas before it hits the internet, and they place customers behind carrier-grade NAT. The address the internet sees can belong to a gateway hundreds of miles from your phone.

You are on satellite

Traffic reaches the ground somewhere, and that somewhere can be a different state or a different country. This is the failure mode that puts people on the wrong side of a border.

You are on a VPN or proxy

Working as intended. Your apparent location becomes the server's. This is usually the point, and it is worth remembering when a service behaves oddly and you have forgotten the tunnel is up.

The database is out of date

Address blocks are transferred and resold, and databases lag. A block that moved from a company in one city to a provider in another can carry the old location for months. This is the one that produces genuinely bizarre answers, and it is the one worth reporting.

How to get a wrong location fixed

Almost nobody writes this down, and it does work. The important thing to understand is that there is no central registry to correct. Each provider maintains its own database, so a correction has to be filed with each one you care about, and it will not propagate.

  1. Find out who is actually wrong. The site showing you a bad city licensed its data from somewhere. Checking your address against two or three of the major providers' own lookup pages usually shows that some are right and some are not, which tells you where to file.
  2. Use the provider's correction form. The large geolocation vendors each publish one. You will normally need the address or range, the correct city and postal code, and something supporting the claim.
  3. If you control the address block, fix it at the source. Organizations that hold their own allocation can publish accurate location data in the registry record, which is the closest thing to fixing it everywhere at once.
  4. If it is your provider's fault, tell your provider. A single customer report rarely moves a large provider, but a wrong record affecting a whole region is a real support issue and is sometimes treated as one.
Expect it to take weeks

Databases publish on a cycle, and the sites that use them update on their own schedule after that. A correction accepted today may not show up in the service that annoyed you for a month or more.

What geolocation is used for

UseWhat accuracy it needs
Sending you to a nearby serverRegion is plenty. This is the use it is genuinely good at
Regional licensing for streamingCountry, which is why the country level is the one everyone invests in
Fraud scoring on a loginCountry, plus a signal for whether the address is residential or a data center
Choosing a currency or languageCountry, and it should always be overridable
Showing local weather or shopsCity, which is the level it is worst at, and why these are so often wrong
Locating a personNot a thing it can do. See the accuracy chart above

Where our number comes from

The location on our front page comes from AWS CloudFront, which adds geographic headers to requests as they pass through its edge network. Our API reads those headers and returns them with your address. We do not run our own database, we do not store the result, and we do not enrich it with anything else.

That means our answer is exactly as good as CloudFront's, and it will sometimes disagree with another site. Given everything above, that is expected rather than surprising. We show the accuracy caveat next to the map for the same reason.

Where to swim next