Esta página solo está disponible en inglés.
IP Geolocation Methods and Limits
Reviewed September 2026. Provider databases and network assignments change continuously, so validate results against a dated test set before production use.
What IP geolocation can tell you
IP geolocation estimates where a network address is used. It does not reveal a device's GPS position or a person's street address. Country results are usually easier to estimate than a city or postal code, but no universal accuracy percentage applies across providers, regions, address families, and network types.
Mobile gateways, carrier-grade NAT, VPNs, proxies, anycast, corporate networks, and recently reassigned blocks can place an address far from the user. Treat the returned coordinates as a representative point within an uncertainty area, not as proof that a person was present there.
How providers make the estimate
Geolocation databases combine routing and allocation information with reports from network operators, commercial data partners, and user corrections. A Regional Internet Registry allocation describes who received a block, not necessarily where each address is used. BGP announcements can identify the network that originates a route, while reverse DNS and public routing records sometimes add useful context. None of those sources establishes a device location on its own.
Most services return fields with different meanings: country and subdivision are administrative areas, city is an estimated locality, latitude and longitude identify a representative point, and an accuracy radius expresses uncertainty. Preserve the provider's field-level confidence or radius when supplied. Do not derive a more precise label by reverse geocoding a representative coordinate.
Address families and routing edge cases
IPv4 exhaustion, reassignment, and shared addressing make historical data age quickly. IPv6 has a much larger address space, so a provider may infer at a prefix level rather than have evidence for an individual address. Store the address family and normalized network prefix separately from the result so evaluations can reveal different behavior. Do not assume an IPv4 and IPv6 address used by the same household will map to the same city.
Anycast services intentionally advertise one address from several facilities. Carrier-grade NAT and mobile gateways aggregate many devices behind a small set of public addresses. A corporate VPN, cloud egress gateway, proxy, or privacy service reports the exit network. For these cases, country may still be useful for a coarse experience, while city and latitude should usually be omitted from decisions.
Choose the right data source
| Source | Useful for | Common limitation |
|---|---|---|
| Local database | Low-latency, high-volume enrichment | Requires a scheduled, auditable update process |
| Lookup API | Fast integration and provider-managed updates | Adds network latency, availability, and data-transfer considerations |
| Network-owned information | Investigations where the operator can confirm a record | Usually unavailable to ordinary applications and subject to policy |
| User-selected location | Shipping, locale, and eligibility workflows | Needs validation appropriate to the purpose |
Prefer a user-provided address or explicit region choice when the workflow needs a location that affects the user. Query one provider consistently for an experiment, then compare candidates against a reference set. Official accuracy documentation can explain a product's uncertainty model, but it cannot replace evaluation on the networks your service receives.
A reproducible 2026 evaluation
- Build an independently verified sample that represents your real countries, networks, IPv4/IPv6 mix, and traffic.
- Record the provider, product, database or API version, test date, and fields requested.
- Score country, subdivision, city, and distance error separately; do not hide missing or low-confidence results.
- Split results by mobile, fixed broadband, hosting, corporate, and privacy-network traffic where the sample supports it.
- Repeat the test after database updates and track changes, regressions, and correction turnaround.
MaxMind's accuracy guidance explains why an accuracy radius and confidence indicators matter. Provider claims should be evaluated on your sample rather than reused as a guarantee.
Implementation pattern
Keep geolocation behind a small service interface so the data source can be updated without changing every application. Cache results according to the provider's update cadence, store the lookup time and source version, and distinguish an unknown value from a confident match.
async function lookupLocation(ip, provider) {
const result = await provider.lookup(ip)
return {
country: result.country ?? null,
region: result.region ?? null,
city: result.city ?? null,
latitude: result.latitude ?? null,
longitude: result.longitude ?? null,
accuracyRadiusKm: result.accuracyRadiusKm ?? null,
confidence: result.confidence ?? null,
checkedAt: new Date().toISOString()
}
}
Validate IP input before lookup, set a timeout, and handle provider errors without turning them into a false location. Do not log full IP addresses unless the operational need and retention period are documented.
Cache and update deliberately
Cache a normalized result by address or approved prefix only for the period justified by the source update cadence and the product purpose. A long-lived cache may preserve a stale assignment; a very short cache may make an API dependency expensive and fragile. Save a source identifier, database build date or API response version, lookup time, and policy version alongside the result. This makes an outcome explainable when a provider corrects a range.
Run database imports in a staging table or versioned directory, validate record counts and a fixed set of known test cases, then atomically switch readers to the new build. Keep the previous build long enough to compare regressions and roll back an operational error. Refreshing a database should be observable work, with a recorded job result rather than an unexplained file replacement.
Evaluate providers with a representative test set
Start with ground truth you are allowed to use. A consented device test can pair an address observation with a participant-confirmed country or broad region. Partner data may be more representative when it has a documented collection purpose and correction process. Do not use a city guessed from a different geolocation provider as ground truth.
- Define the decisions the result will support and the maximum error each can tolerate.
- Sample by traffic share and by risk: country, IPv4 or IPv6, fixed, mobile, cloud, corporate, and privacy-network traffic.
- Freeze input addresses and verified labels, then query each candidate on the same date.
- Calculate country exact-match rate, subdivision exact-match rate, city exact-match rate when labels justify it, and coordinate distance error separately.
- Report coverage, unknown values, confidence distribution, and sample sizes next to every score.
- Review false matches by cohort and repeat after a provider update or material routing change.
For a coordinate result, calculate great-circle distance from the verified reference only when both locations are meaningful and consented. Report median and high-percentile distance, not an average alone. For a country decision, a false country is more important than a coordinate several kilometers from a city centroid. Publish exclusions such as roaming devices rather than silently removing difficult cases.
Use uncertainty in product decisions
A locale suggestion can use country with a visible control to change it. Regional traffic routing can use a broad region with a safe default. Fraud detection should combine device, account, transaction, and user-verifiable signals, then measure disparate error rates and recovery outcomes. Do not use a geolocation estimate as the sole basis for pricing, credit, legal eligibility, employment attendance, health service access, or a security lockout.
Build rules from explicit fields. For example, an application may mark a request for review when a declared country differs from a high-confidence network country, while preserving a normal reauthentication path. It should not label the user deceptive solely because a mobile carrier or VPN exits elsewhere.
Appropriate uses
- Suggesting a locale, language, currency, or shipping country that the user can correct.
- Routing traffic to a nearby region while retaining a fallback.
- Adding one risk signal to a fraud-review model, never acting on it alone.
- Aggregating coarse regional analytics after minimization and retention review.
- Checking whether an approved proxy exits from an expected country or region.
High-risk uses to avoid
Do not use an IP estimate as proof of residence, identity, eligibility, legal jurisdiction, workplace attendance, or exact movement. A mismatch should trigger confirmation or review, not an automatic accusation or denial. Give users a correction and appeal path.
Privacy and operations
Collect the least precise location needed. Document purpose, access, retention, deletion, and any user notice or consent. Restrict raw addresses and precise results, aggregate analytics early, and remove data when the purpose expires. VPNs and proxies locate the exit network rather than the user; see how to hide an IP address for the related privacy boundary.
Monitor provider latency, failures, unknown rates, confidence distribution, correction volume, and outcome differences by network type.