Most IP intelligence starts with a simple question: where does this address sit, and what network operates it. MaxMind GeoLite2 answers both for free, mapping an IP to a country, an approximate city, and an autonomous system. For a self-hosted fraud stack, it is often the first data source you wire in, because so many downstream signals depend on knowing the network context of a request.
GeoLite2 is not magic, and treating it as ground truth is a common mistake. It infers location from routing and registration data, which means it is confident about networks and cautious about street addresses. This guide covers what the databases actually contain, how accurate each field is, and how to fold GeoLite2 into a detection pipeline without asking it to do more than it can.
What is in the databases
GeoLite2 ships as MMDB files, a binary format optimized for fast IP-range lookups. There are two databases most fraud teams use:
- GeoLite2-City returns country, subdivision, city, approximate coordinates, an accuracy radius, and time zone.
- GeoLite2-ASN returns the autonomous system number and the organization name that operates the network.
The accuracy radius is the field people ignore and should not. It tells you how confident MaxMind is, in kilometers, about the coordinates it returned. A radius of 5 km in a city center is usable; a radius of 1000 km means the location is essentially a country-level guess dressed up with coordinates.
import geoip2.database
city_reader = geoip2.database.Reader('GeoLite2-City.mmdb')
asn_reader = geoip2.database.Reader('GeoLite2-ASN.mmdb')
def lookup(ip):
city = city_reader.city(ip)
asn = asn_reader.asn(ip)
return {
'country': city.country.iso_code,
'city': city.city.name,
'radius_km': city.location.accuracy_radius,
'asn': asn.autonomous_system_number,
'org': asn.autonomous_system_organization,
}
How accurate it really is
Accuracy is not uniform across fields. Country resolution is strong; city resolution degrades sharply outside dense metro areas and on mobile networks, where carrier-grade NAT means one address serves a whole region.
| Field | Practical accuracy | Good for |
|---|---|---|
| Country | High | Geo policy, sanctions screening |
| ASN / org | High | Datacenter vs residential classification |
| City | Medium in metros, low elsewhere | Coarse geo consistency checks |
| Coordinates | Only as good as the accuracy radius | Never precise targeting |
The most valuable field for fraud work is often the ASN, not the city. Knowing that an IP belongs to a hosting provider rather than a consumer ISP is exactly the classification behind datacenter IP detection, and it is far more stable than a city guess. Pair it with the caveats in IP geolocation spoofing, because the address a client presents can be manipulated before it ever reaches your lookup.
Keeping the data fresh
Stale GeoIP data quietly rots your detection. IP blocks are reassigned constantly, a residential range can be sold to a hosting company, and a database from six months ago will misclassify those reassignments. GeoLite2 publishes updates on a regular cadence, and you should automate ingestion rather than shipping a snapshot with your build.
Practical hygiene:
- Refresh the MMDB files on a schedule and reload them without a full redeploy.
- Keep the ASN database as current as the City database; network reassignments move faster than city boundaries.
- Log the database build date alongside decisions so you can explain a past classification even after the data has changed.
Because GeoLite2 is a local file, it fits a self-hosting for data residency posture: IP lookups never leave your infrastructure, which matters when the IP itself is treated as personal data under some regimes.
Using GeoLite2 in a fraud pipeline
GeoLite2 is a feature source, not a verdict engine. Its outputs become inputs to higher-level checks that combine location and network context with the rest of a session.
- Geo consistency: compare the IP country against the browser timezone and language. A mismatch is a classic spoofing tell and feeds ASN and geolocation fraud analysis.
- Impossible travel: two logins from countries too far apart to bridge in the elapsed time is a strong account-takeover signal, detailed in impossible travel detection. The accuracy radius should widen your tolerance so you do not flag two neighboring cities as impossible.
- Network classification: use the ASN to separate consumer ISPs from hosting providers, then combine with IP reputation and proxy checks. GeoLite2 alone will not flag a VPN, so pair it with VPN detection.
The general rule: let GeoLite2 supply coarse, reliable facts about country and network, and let the rest of your stack decide what those facts mean.
Limitations to plan around
Design for the failure modes up front so a single misclassification does not drive a wrong decision.
- Mobile and CGNAT: carrier networks concentrate many users behind few addresses, so city precision collapses and per-IP rate limiting misfires.
- VPNs and proxies: GeoLite2 reports where the exit node is, not where the user is. It will confidently place a user in the datacenter they tunneled through.
- Free-tier lag: GeoLite2 updates less often than the paid GeoIP2 product, so reassignments take longer to reflect. If your decisions are sensitive to that lag, the paid database or a specialized IP intelligence feed may be warranted.
None of these are reasons to skip GeoLite2; they are reasons to treat its output as one weighted input inside a confidence score rather than a standalone gate.
Frequently asked questions
Is GeoLite2 accurate enough for fraud detection?
GeoLite2 is reliable at the country and ASN level and reasonable at the city level in dense areas, but it is not precise enough to pinpoint a user. Use it for coarse geolocation and network classification, not for location decisions that demand street-level accuracy.
What is the difference between GeoLite2 and GeoIP2?
GeoLite2 is the free, lower-resolution version of MaxMind’s databases; GeoIP2 is the paid, more frequently updated product with higher accuracy. Both share the same MMDB format and query libraries, so upgrading later is straightforward.
GeoLite2 earns its place as the local, privacy-friendly foundation of an IP intelligence layer: fast lookups, strong country and ASN data, and an honest accuracy radius that tells you when to trust the coordinates. Wire it in as a feature source, keep it fresh, and let your scoring layer turn its facts into decisions. The device fingerprinting overview and the docs show where IP intelligence connects to the rest of a Prynt deployment.
Run it yourself
Prynt is open-source, self-hostable device intelligence — visitor IDs, bot & fraud Smart Signals, and behavioral biometrics you own end to end.