Spunk Autos

Websites and web tools

IP geolocation: a portable pocket guide

IP geolocation guesses where a visitor is from the network address their request comes from. This short reference covers how the guess is made, how far to trust it, and how a business with several locations, such as a tire shop chain or a mobile mechanic, can use it without annoying customers.

How it works in four lines

  1. Regional registries hand out blocks of IP addresses to networks, such as internet providers and hosting companies.
  2. Geolocation databases map those blocks to places, using registry records, network routing data and other signals.
  3. Your server or a service looks up the visitor's address in such a database.
  4. It returns a country, often a region and city, and a rough radius of confidence.

Quick facts to keep handy

ItemValue
IPv4 address space2^32 = 4,294,967,296 addresses
IPv6 address space2^128 addresses
A /24 IPv4 block256 addresses
A /22 IPv4 block1,024 addresses
Usual accuracyCountry is often right; city is a guess

Why the answer is often wrong

  • Mobile networks may route many users through gateways far from where they stand.
  • Carrier-grade NAT puts many customers behind one shared public address.
  • VPNs, privacy relays and corporate networks show the exit point, not the person.
  • Address blocks get sold or moved, and databases lag behind.
  • A database may place an address at the centre of a country or region when it knows nothing finer.

Good uses on a business site

  • Pre-select the nearest branch on a booking form, while letting the visitor change it.
  • Show prices in the likely currency for an online parts store, with a visible switch.
  • Flag unusual logins or orders for a manual review, as one signal among several.
  • Group analytics roughly by region to see where enquiries come from.

Uses to avoid

  • Hiding content or services without an override; travellers and VPN users get stuck.
  • Showing a precise map pin of the visitor; it is likely wrong and feels intrusive.
  • Assuming a mobile mechanic's customer is at the guessed city; ask for the address.

Privacy points

IP addresses can count as personal data under some privacy laws. Say in your privacy notice that you use them for location hints, store only what you need, such as the country, and set a retention period. If a third-party service performs the lookup, check where it sends and keeps the data.

Test your own setup

Look up your office's public address, your phone on mobile data, and a VPN exit if you use one. Compare the results with where each one really is. That short test shows your team how much weight the feature deserves.