IP to Country to City to ISP for a Fraction of a Cent Per Request

Every device connected to the internet has an IP address, and that IP address carries more information than most people realize. It is not just a technical identifier for routing network packets. It is a geographic marker, an organizational fingerprint, and a behavioral signal that, when properly resolved, answers fundamental questions about who is visiting a website, where they are located, and how they are connected. The process of resolving an IP address to its geographic and organizational metadata is called GeoIP lookup, and it is one of those invisible technologies that powers an enormous amount of the internet's functionality without most users ever knowing it exists. When a website displays prices in the local currency, GeoIP is doing the work. When a streaming service restricts content by region, GeoIP makes the determination. When a fraud detection system flags a transaction because the billing address says London but the IP address says Lagos, GeoIP provides the evidence.

The technology itself is well established. Multiple companies maintain GeoIP databases that map IP address ranges to geographic locations, and these databases are updated regularly as IP allocations change and new ranges are assigned. What has not been well established, until recently, is affordable access to these databases for developers and businesses that need GeoIP capability but cannot justify the pricing models of the major providers. MaxMind, the dominant player in the GeoIP space, charges for database licenses or per-query access at rates that are reasonable for enterprise customers processing millions of lookups daily but disproportionately expensive for smaller applications that need a few thousand lookups per month. The GeoIP APIs at YEB offer the same three tiers of geographic resolution (country, city, and ASN) at per-request pricing that makes even low-volume use cases economically viable.

The three tiers exist because different use cases require different levels of detail. A content localization system that needs to display the correct language and currency for a visitor only needs country-level data. A shipping calculator that needs to estimate delivery costs based on the visitor's region needs city-level data. A security system that needs to verify whether an IP address belongs to a hosting provider, a residential ISP, or a corporate network needs ASN (Autonomous System Number) data. Offering all three tiers separately means that applications pay only for the level of detail they actually use, rather than paying for city-level precision when country-level would suffice.

Country Level Lookup and the Applications It Powers

The country-level GeoIP API is the most commonly used tier and the most affordable per request. Given an IP address, it returns the country code (ISO 3166-1 alpha-2), the country name, and the continent. This is the minimum viable geographic information needed for a surprisingly large number of applications. Content localization is the most obvious: determining the visitor's country and serving the appropriate language, currency, and legal disclaimers. A website that operates in twelve countries needs to show the correct privacy policy footer, the correct VAT notice, and the correct contact information based on where the visitor is located. Doing this with client-side JavaScript (asking the browser for the user's location) is intrusive, requires explicit permission, and fails when the user declines. Doing it with GeoIP is invisible, instant, and works on every request without user interaction.

Regulatory compliance is another major use case that operates entirely at the country level. GDPR applies to visitors from EU member states. CCPA applies to visitors from California (which can be detected with city-level data, but country-level is sufficient to identify US visitors who might fall under CCPA). Content restrictions may apply to specific countries due to licensing agreements, sanctions, or local laws. E-commerce platforms may need to block sales to certain countries due to export controls. All of these decisions require only the country, and the GeoIP country API provides it for a fraction of what a monthly subscription to a full geolocation service would cost.

Analytics platforms use country-level GeoIP to build geographic traffic reports. The WordPress analytics plugin described in the companion article uses this exact API to resolve every visitor's IP address to a country, which populates the country breakdown table on the dashboard. For a website receiving 10,000 visits per day, that is 10,000 GeoIP lookups per day, and at per-request pricing, the total daily cost is measured in cents rather than dollars. At monthly subscription pricing from traditional GeoIP providers, the same volume would cost between $20 and $50 per month depending on the plan tier. Over a year, the difference between per-request and subscription pricing for this volume is substantial enough to matter for any business watching its operational costs.

City Level Lookup and When Precision Matters

The city-level GeoIP API returns everything the country API provides plus the city name, region or state, postal code, latitude, and longitude. This additional precision enables use cases that country-level data cannot support. Local business directories that need to show results relevant to the visitor's city depend on city-level geolocation. Weather widgets that display local conditions need to know the city, not just the country. Real estate platforms that show nearby listings, restaurant discovery apps that surface local recommendations, and news sites that feature regional stories all require city-level resolution to function properly.

The accuracy of city-level GeoIP deserves an honest discussion because it is one of the most commonly misunderstood aspects of the technology. City-level geolocation from IP addresses is not GPS-level precision. It does not pinpoint a specific building or street address. It identifies the city or metropolitan area associated with the IP address range, which is typically the location of the ISP's point of presence rather than the exact location of the end user. In dense urban areas, this is usually accurate to the correct city. In rural areas served by regional ISPs, the resolved city may be the nearest major city where the ISP has infrastructure, which could be fifty or a hundred kilometers from the user's actual location. For the vast majority of use cases (content personalization, approximate shipping estimates, regional analytics), this level of accuracy is more than sufficient. For use cases that require precise location (navigation, emergency services, hyperlocal advertising), GPS remains the appropriate technology.

Fraud detection systems use city-level GeoIP as one signal among many. When a credit card transaction originates from an IP address in Manila but the card's billing address is in Stockholm, the geographic mismatch does not necessarily indicate fraud (the cardholder could be traveling), but it is a strong enough signal to trigger additional verification. The city-level data provides the specificity needed to make this comparison meaningful. Country-level data would flag any transaction where the IP country differs from the billing country, which is too broad for global travelers. City-level data allows the system to consider more nuanced scenarios: an IP in the same country but a different city from the billing address might indicate a moved cardholder rather than a stolen card, while an IP on a different continent is a much stronger fraud signal.

ASN Lookup and Understanding Who Owns the Network

The ASN (Autonomous System Number) API adds an entirely different dimension to IP intelligence. Instead of answering "where is this IP?" it answers "who operates the network this IP belongs to?" An Autonomous System is a collection of IP address ranges managed by a single organization, and the ASN database maps every IP address to its operating organization, including the organization name, the ASN number, and the type of network (ISP, hosting provider, enterprise, educational institution, government). This information is invaluable for use cases where the geographic location matters less than the network identity.

Bot detection is the most immediately practical application of ASN data. Legitimate search engine crawlers operate from IP ranges owned by their parent companies: Google's crawler comes from Google's ASN, Bing's crawler comes from Microsoft's ASN. A request claiming to be Googlebot but originating from an IP address in a residential ISP's ASN is almost certainly a fake bot. The WordPress analytics plugin uses this exact technique, cross-referencing the user agent's claimed identity with the ASN ownership of the source IP, to separate verified crawlers from impostors. This validation is impossible with geographic data alone, because Google operates data centers in many countries, so a geographic check cannot distinguish between a real Googlebot from a US data center and a fake one from a US home internet connection.

Ad targeting and fraud prevention systems use ASN data to distinguish between traffic from residential networks (real users), hosting providers (potential bots or proxies), and corporate networks (potential B2B leads). A click on a paid advertisement that originates from a hosting provider's IP range is far more likely to be fraudulent (click bots, competitor click fraud) than a click from a residential ISP. Filtering these clicks before they are counted (and billed) can save advertisers significant money. Similarly, B2B marketing platforms use ASN data to identify when visitors come from corporate networks, since the ASN organization name often reveals the company, enabling account-based marketing without requiring the visitor to identify themselves.

Per Request Pricing and Why It Changes the Math

The economics of GeoIP services have historically followed the subscription model that dominates the SaaS industry. Monthly plans with tiered request limits, overage charges beyond those limits, and annual contracts that lock in a price regardless of actual usage. For applications with predictable, high-volume GeoIP needs, these plans are often reasonable. For applications with variable or low-volume needs, they represent a fixed cost that bears no relationship to the value extracted.

Consider a seasonal e-commerce store that does 80% of its annual traffic in a six-week holiday period. Under subscription pricing, the store pays the same monthly fee during the ten quiet months as it does during the two peak months. Under per-request pricing, the quiet months cost almost nothing while the peak months cost proportionally to the actual traffic processed. Over a year, the total cost under per-request pricing is typically 40% to 60% lower than the equivalent subscription plan, and the savings are even more dramatic for applications that have unpredictable traffic patterns.

The per-request model also eliminates the planning overhead that comes with tiered subscription plans. Choosing between a plan that allows 10,000 lookups per month and one that allows 100,000 lookups per month requires predicting future traffic volumes, which is inherently uncertain. Choose too low and overage charges apply. Choose too high and unused capacity is wasted. Per-request pricing removes this guesswork entirely. Every lookup costs the same fraction of a cent regardless of whether the monthly total ends up being 500 or 500,000. The only variable is actual usage, and the cost scales linearly with it.

For developers evaluating GeoIP options, the practical question is not which database has the highest accuracy (the major databases are all within a few percentage points of each other for most regions) but which pricing model aligns with the application's usage pattern. Applications with steady, predictable, high-volume traffic may find that a subscription plan offers a better per-request rate due to volume discounts. Applications with variable, unpredictable, or low-volume traffic will almost always find per-request pricing more economical. The GeoIP APIs described here serve the second category, and they do so without sacrificing data quality, response speed, or the breadth of information returned per lookup.

Frequently Asked Questions

How accurate is IP geolocation at the country level?

Country-level GeoIP accuracy is typically above 99% for major ISPs in most countries. Edge cases exist for IP ranges that are reassigned between countries or for satellite internet providers where the gateway may be in a different country than the user, but for the vast majority of lookups, the country identification is reliable.

Can GeoIP determine the exact street address of an IP address?

No. GeoIP resolves to the city or metropolitan area level at best. The coordinates returned by city-level lookups represent the approximate center of the identified city, not the physical location of the device. Street-level precision requires GPS or similar device-based location technologies that involve explicit user permission.

What is an ASN and why is it useful?

An Autonomous System Number (ASN) identifies the organization that operates a block of IP addresses. Knowing the ASN reveals whether an IP belongs to a residential ISP, a hosting provider, a corporation, or a government network. This is useful for bot detection (verifying crawler identity), fraud prevention (flagging traffic from hosting IPs), and B2B marketing (identifying corporate visitors).

How often are the GeoIP databases updated?

The databases are updated regularly to reflect changes in IP address allocations. New IP ranges are assigned, existing ranges are reassigned between organizations, and geographic mappings change as ISPs expand their networks. Regular updates ensure that lookup results remain accurate as the IP landscape evolves.

Does using GeoIP require cookie consent under GDPR?

GeoIP lookups process IP addresses, which are considered personal data under GDPR. However, if the lookup is performed server-side and the IP address is not stored or shared with third parties, many GDPR interpretations consider this a legitimate interest processing that does not require explicit consent. Website owners should consult legal counsel for compliance guidance specific to their jurisdiction and implementation.

Can GeoIP detect VPN or proxy usage?

GeoIP can indicate VPN or proxy usage indirectly. If an IP address belongs to a known VPN provider's ASN, the ASN lookup will identify the organization as a VPN service. Similarly, IP addresses from hosting provider ASNs are more likely to be proxies than residential connections. However, GeoIP alone cannot definitively detect all VPN usage, especially when VPN providers use residential IP ranges.