> For the complete documentation index, see [llms.txt](https://docs.ipcheck.ing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ipcheck.ing/knowledge-base/concepts/geoip-explained.md).

# GeoIP: How IP Geolocation Works

A website greets you in the right language and offers the right currency. Another one insists you are in a city three hundred kilometres away. Both are using the same kind of data. How?

## There is no location inside an IP address

Start here, because it clears up most of the confusion.

An IP address contains no geographic information whatsoever. It is an identifier for routing, in the same way a phone number is. Nothing in `203.0.113.42` says "Berlin".

What exists instead is a set of **databases** that map address ranges to guessed locations. Several companies build these databases, each using its own mixture of sources and its own judgement. When a website "detects your location from your IP", it is looking your address up in one of these databases and reading back somebody's estimate.

This is why the honest description of GeoIP is *inference*, not measurement.

## Where the data comes from

Four main sources feed these databases, in roughly descending order of reliability.

**Registration records.** The regional internet registries publish who holds each block of addresses, along with a registered country and postal address. This is solid for country-level data and weak for anything finer — a national provider's records may list one head office for addresses used across a whole country.

**Routing data.** Which autonomous system announces a prefix, and where that network operates, is publicly observable. A prefix announced only by a network that operates exclusively in Japan is almost certainly used in Japan. See [What Is an ASN?](/knowledge-base/concepts/what-is-an-asn.md).

**Measurement.** Providers send timed probes from many known locations and use latency to bound where an address can physically be. Light in fibre travels roughly 200 kilometres per millisecond, so a consistent 2 ms round trip from a known city rules out most of the planet. This is how city-level guesses get any precision at all — and it degrades badly when the path is indirect.

**Self-reported corrections.** Network operators can publish location information for their own ranges, and large ones do, because it is in their interest that their customers see the right content. There is also a formal mechanism for publishing this, sometimes called a geofeed. These corrections are usually the most accurate source available — when they exist and are kept current.

On top of all this sits a layer of inference: user-supplied signals, observed behaviour, and cross-checks between the other sources.

## Why country is usually right and city often is not

Country-level accuracy is generally high, because it rests on the strongest sources. Address blocks are allocated to organisations registered in a country, announced by networks operating in that country, and rarely used across borders without the operator noticing.

City-level accuracy is a different matter, and the reasons compound.

* **Address blocks do not follow city boundaries.** A provider assigns a block to a region and moves addresses around inside it as needed.
* **Traffic exits where the equipment is.** Your provider may route an entire province through one facility in the capital. Every customer then appears to be in the capital. This is extremely common with mobile networks.
* **Measurement gets noisy.** Latency-based estimates assume a reasonably direct path. Any detour — and detours are normal — widens the error.
* **Nothing forces an update.** When a block is reassigned to a different city, the database only learns about it when a source it trusts reflects the change.

A reasonable way to hold this: treat the country as probably right, the region as often right, and the city as a hint. Coordinates deserve special caution — they usually point to the centre of an administrative area, not to anything real. Some databases use a country's geographic centre as a placeholder when they know nothing more, which has caused well-documented problems for the people who happen to live there.

| Field          | Typical reliability    | Why                                                  |
| -------------- | ---------------------- | ---------------------------------------------------- |
| Country        | Usually correct        | Registration and routing both support it             |
| Region / state | Often correct          | Depends on how finely the provider is documented     |
| City           | Frequently wrong       | Exit points, block reassignment, stale data          |
| Coordinates    | Rarely a real location | Usually the centre of an area, or a placeholder      |
| Provider / ASN | Usually correct        | Comes from routing data, which is public and current |

## What VPNs, proxies and CGNAT do to it

**A VPN or proxy replaces the answer entirely.** The database now describes the exit server, which is exactly what you asked for. If it reports the wrong city for your VPN server, that is a database inaccuracy about the provider's addresses, not a leak.

**Datacentre ranges are recognisable.** Addresses belonging to hosting networks are flagged as such by most databases. That is how streaming services detect VPN use — not by knowing where you are, but by knowing that ordinary residential customers do not browse from a server rack.

**CGNAT moves your apparent location to the exit point.** Behind carrier-grade NAT you share a public address with many other customers, and the location reported is wherever the provider's translation equipment sits. See [Public, Private & CGNAT Addresses](/knowledge-base/concepts/public-private-cgnat.md).

**Mobile networks are the least precise of all.** Few public addresses, few exit points, and constant reassignment. Being placed in a different city on mobile data is normal, not a fault.

**Recycled addresses carry old data.** Addresses change hands — between providers, between countries. Databases catch up at different speeds, and a recently transferred block can be described wrongly for months.

## What sites do with the answer

Knowing what it is used for helps you judge how much the inaccuracy costs you.

* **Language and currency defaults.** Country-level, so usually correct.
* **Sending you to a nearby server.** Content networks pick a nearby copy of a site, often using the location of your DNS resolver rather than your own address. See [How DNS Works](/knowledge-base/concepts/how-dns-works.md).
* **Licensing and availability.** Streaming catalogues, sports broadcasts and shop availability are decided at country level.
* **Fraud and risk scoring.** A login from an unexpected country triggers extra checks. This is where a wrong country genuinely inconveniences you.
* **Legal and tax requirements.** Consent banners, age rules and sales tax often depend on the country reported.

Notice that almost every important use is country-level. City-level data is mostly used for advertising and for showing you a nearby shop — the places where being wrong is annoying rather than damaging.

## Why databases disagree

Because they are independent products built from different inputs.

Each vendor weights the sources differently, refreshes on its own schedule, applies its own corrections, and makes its own choice about what to say when it is unsure — some guess, some return nothing. Two databases looking at the same address are two analysts reading overlapping evidence and reaching different conclusions.

So when two tools give you different cities, neither is malfunctioning. You are seeing two estimates. And when several independent databases agree, that agreement is itself a meaningful signal — far stronger than any single answer.

## Common misconceptions

**"GeoIP knows my address."** It does not, and cannot. At best it identifies the area your provider routes you through. Precise location on a phone or laptop comes from GPS, Wi-Fi networks nearby, and permissions you granted — a completely separate mechanism.

**"The wrong city means my VPN is leaking."** Usually the opposite of a problem. If the location is not yours and not obviously your provider's, first check that it is your VPN's exit — see [Is My VPN or Proxy Working?](/knowledge-base/diagnose/is-my-vpn-working.md).

**"I can just correct it."** Not directly. Corrections come from the network operator that holds the range. Some database vendors accept individual reports, but a single user cannot change how a range is described.

**"My IPv4 and IPv6 should show the same place."** They frequently do not. IPv6 ranges are newer and less thoroughly documented, so the two often carry different quality of data. See [IPv4 vs IPv6](/knowledge-base/concepts/ipv4-vs-ipv6.md).

{% hint style="info" %}
**See it yourself on MyIP**

MyIP does not pick one database and present its answer as fact. It queries several independent geolocation sources for the same address and shows each result, and you can change which one is preferred in Preferences.

Comparing the cards is the fastest lesson in how this works: where the sources agree, you can trust the field; where they scatter, you are looking at a guess. See [Reading Your IP Cards](/knowledge-base/getting-started/reading-your-ip-cards.md) for a field-by-field walkthrough, and [Why Is My IP Location Wrong?](/knowledge-base/diagnose/why-is-my-ip-location-wrong.md) when the answer looks clearly wrong.
{% endhint %}

## Related concepts

* [What Is an ASN?](/knowledge-base/concepts/what-is-an-asn.md) — the routing data underneath most location guesses
* [Public, Private & CGNAT Addresses](/knowledge-base/concepts/public-private-cgnat.md) — why shared exits move your apparent location
* [IPv4 vs IPv6](/knowledge-base/concepts/ipv4-vs-ipv6.md) — why your two addresses can report different places
* [How DNS Works](/knowledge-base/concepts/how-dns-works.md) — how sites send you to a nearby server


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ipcheck.ing/knowledge-base/concepts/geoip-explained.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
