IP geolocation is the practice of estimating the physical location of a device, network or user from the IP address it uses on the Internet. In internet addressing, an address identifies a network interface, not a place, so every geolocation result is an inference built from external evidence: registry allocations, routing announcements, network measurements and data volunteered by operators or users.
The output is typically a country, region, city, postal code, approximate coordinates and an accuracy radius, often enriched with the network operator, the autonomous system number and flags for hosting, VPN or proxy use. Accuracy is high at country level and much weaker at city level, which shapes how the data should be used.
How IP geolocation databases are built
IP geolocation works by combining several independent data sources into a database that maps address ranges, usually expressed as CIDR prefixes, to locations. No single source is reliable on its own, so commercial and open providers weigh the evidence and publish the most probable location for each prefix together with a confidence estimate.
The starting point is the registry record. Regional Internet Registries such as ARIN, RIPE NCC, APNIC, LACNIC and AFRINIC record which organization holds each block and in which country it is registered. This record identifies the holder of the address block, which may be headquartered far from the customers who actually use the addresses.
The following table summarizes the main inputs and what each contributes.
| Source | What it provides | Main weakness |
|---|---|---|
| Registry and WHOIS data | Holder and registered country of a block | Reflects the holder, not the user |
| BGP routing data | Which autonomous system announces a prefix | Large networks span many countries |
| Latency measurements | Distance bounds from known probe locations | Signal speed and routing add error |
| Reverse DNS hostnames | City or airport codes in router names | Naming is inconsistent and outdated |
| Operator geofeeds | Location published by the network itself | Only as accurate as the operator |
| User-consented signals | GPS or Wi-Fi location tied to an address | Privacy limits and sample bias |
Operators can publish self-declared geofeeds in the CSV format defined by RFC 8805, and RFC 9632 describes how to reference such a feed from registry records. Providers increasingly trust these feeds because they come from the party that knows where the addresses are deployed.
Accuracy levels and what limits them
IP geolocation accuracy falls sharply with granularity: country attribution is correct for the large majority of fixed broadband addresses, while city-level results are right only part of the time and coordinates are rarely meaningful at street level. Published accuracy figures vary by provider, region and network type, so any single number should be treated with caution.
| Level | Typical reliability | Suitable uses |
|---|---|---|
| Country | High for most fixed networks | Licensing, compliance, language defaults |
| Region or state | Moderate to high | Tax estimates, regional content |
| City | Moderate, often within 25 to 100 km | Local suggestions, analytics |
| Postal code | Low and inconsistent | Rough segmentation only |
| Coordinates | Centroid with an accuracy radius | Never a precise address |
Several mechanisms degrade results. Carrier-grade NAT (CGNAT) places thousands of mobile subscribers behind a small pool of public addresses that often exit at a regional gateway hundreds of kilometers away. Anycast announces the same prefix from many sites, so one address has no single location. Addresses are also reassigned and transferred, and databases lag behind those changes by days or weeks.
When a provider has little evidence, it often falls back to a country or regional centroid. Coordinates that land in the geographic center of a country or a lake are a sign of this default, not of a real device in that spot.
IP geolocation compared with other location methods
IP geolocation is passive and requires no user permission, which makes it convenient but coarse compared with methods that read the device itself. The comparison below places it among the alternatives.
| Method | Typical precision | Consent needed | Spoofing resistance |
|---|---|---|---|
| IP geolocation | Country to city | No | Low |
| Browser Geolocation API | Meters to hundreds of meters | Yes | Moderate |
| GNSS on the device | A few meters outdoors | Yes | Moderate |
| Wi-Fi positioning | Tens of meters in cities | Yes | Moderate |
| Cell tower data | Hundreds of meters to kilometers | Carrier access | High |
Because it only needs the source address of a connection, IP geolocation is the default first signal for anonymous web traffic. Services that need precision ask for device location with explicit consent and treat the IP result as a plausibility check rather than the answer.
Practical uses and implementation choices
Organizations use IP geolocation for content localization, licensing enforcement, fraud scoring, analytics and traffic routing. Each use tolerates a different error rate, so the design question is always what happens when the lookup is wrong.
- Localization: choose a default language or currency, but always let the user change it.
- Geo-restriction: block or allow content by country, accepting that VPNs bypass the check.
- Fraud prevention: compare the IP country with the billing country as one risk signal among many.
- Security operations: flag logins from unusual countries or from known hosting ranges.
- Traffic engineering: steer users to nearby servers, although DNS-based steering often relies on the resolver address instead.
Implementations either query a hosted lookup API or load a local database file into the application. Local databases avoid network latency and keep user addresses in-house, but they must be updated at least weekly to follow address reassignments. Both IPv4 and IPv6 ranges need coverage, and IPv6 data is generally thinner because the address space is vast and allocations change more often.
Limitations, privacy and common mistakes
The most serious error is treating IP geolocation as evidence of a person’s exact location. Default coordinates have led to real cases where households near a national centroid received complaints intended for unknown internet users, which shows why results must never be presented as an address.
In many jurisdictions an IP address combined with location data is personal data, for example under the GDPR, so collection, retention and purpose need a legal basis. The table lists frequent implementation mistakes.
| Mistake | Consequence | Better practice |
|---|---|---|
| Hard blocking on city data | Legitimate users locked out | Restrict only at country level |
| Ignoring VPN and proxy flags | Restrictions are trivially bypassed | Combine with anonymizer detection |
| Stale database files | Reassigned ranges misplaced | Automate frequent updates |
| Treating coordinates as exact | False accusations, wrong addresses | Show the accuracy radius |
| Using the proxy address | Every user appears at the CDN | Read the trusted client header |
Applications behind a reverse proxy or content delivery network must take the client address from a trusted forwarding header and validate it, otherwise every lookup returns the location of the proxy.
In everyday language
Every device online uses an IP address, which works like a return address on an envelope. IP geolocation is an educated guess about where that envelope came from, made by looking up which company owns the address and where that company usually uses it.
The guess is usually right about the country and often close for the city, but it cannot find a house or a person. A phone network, a VPN or a large company network can make someone appear far from where they really are. Think of it as a postmark showing the sorting office, not the sender’s front door.
Seen in the real world
A European online retailer uses IP geolocation on its storefront. When a visitor arrives from an address registered to a French broadband provider, the site preselects French and euro prices, while a banner lets the visitor switch both. The lookup runs against a local database refreshed every three days, so it adds no noticeable delay to page loads.
At checkout, the fraud team uses the same lookup as one risk signal. An order with a billing address in Lyon, an IP address in a data center range in another continent and a newly created account receives extra verification, while an order with a matching country passes normally. Over a quarter, the team finds that IP mismatch alone produced too many false alarms, mainly from travelers and corporate VPN users, so it now triggers review only when combined with other indicators.