What Is an IP Address? IPv4, IPv6, and How Geolocation Works

A practical guide to IP addresses — what they are, the difference between IPv4 and IPv6, public vs private IPs, and how IP geolocation works.

Every device that communicates on a network needs an address. That address is an IP address — a number assigned to your computer, phone, router, or server so that other devices know where to send data. Understanding IP addresses is one of those fundamentals that pays dividends every time you're debugging a network issue, configuring a server, or trying to understand why a geolocation lookup returned the wrong city.

What Is an IP Address?

IP stands for Internet Protocol. An IP address is a numerical label assigned to each device connected to a network that uses the Internet Protocol for communication. It serves two main purposes: host identification (which device is this?) and location addressing (where is this device on the network?).

Think of it like a postal address. The street address tells the mail carrier both who you are and where to find you. An IP address does the same thing — it tells routers how to get packets from A to B.

IPv4: The Classic Format

The format most people recognize is IPv4 — four groups of numbers separated by dots:

192.168.1.1
8.8.8.8
172.16.254.1

Each group is a number between 0 and 255, which means each group is exactly 8 bits (one byte). Four bytes = 32 bits total = about 4.3 billion possible addresses.

That sounds like a lot, but the internet ran out. IPv4 exhaustion has been an ongoing problem since the 1990s, which is why techniques like NAT (Network Address Translation) were invented — letting thousands of devices share a single public IP — and why IPv6 was developed.

IPv6: The Modern Format

IPv6 uses 128 bits instead of 32, written as eight groups of four hexadecimal digits:

2001:0db8:85a3:0000:0000:8a2e:0370:7334

Leading zeros in each group can be omitted, and one run of consecutive all-zero groups can be replaced with :::

2001:db8:85a3::8a2e:370:7334

The address space is enormous: 2¹²⁸ ≈ 340 undecillion addresses. That's roughly 670 quadrillion addresses per square millimeter of Earth's surface. We're not running out anytime soon.

IPv6 adoption has been slow but steady. As of 2024, around 40-45% of Google traffic comes from IPv6-capable clients. If you hit an API or load a page, there's a decent chance IPv6 is involved somewhere in the path.

Public vs. Private IP Addresses

Not all IP addresses are visible on the public internet. The Internet Assigned Numbers Authority (IANA) reserved three ranges for private networks:

Range CIDR Common Use
10.0.0.0 – 10.255.255.255 10.0.0.0/8 Large corporate networks
172.16.0.0 – 172.31.255.255 172.16.0.0/12 Medium networks
192.168.0.0 – 192.168.255.255 192.168.0.0/16 Home routers

When you check your IP on a site like this one, you see your public IP — the address your router uses to communicate with the outside world. Your laptop's 192.168.1.x address is private, invisible to external services.

This is why when you look up your own IP, it shows your ISP's address (or your office's address), not your specific machine. NAT at your router translates between your private address and the public one.

Special IP Addresses Worth Knowing

127.0.0.1 (localhost) — The loopback address. Traffic sent here never leaves your machine. Used constantly in development: http://localhost:3000.

0.0.0.0 — Means "all available interfaces" in server binding contexts. When a server listens on 0.0.0.0:8080, it accepts connections on any network interface.

255.255.255.255 — The broadcast address. Sends a packet to every device on the local network.

169.254.x.x (APIPA) — Automatic Private IP Addressing. If your device can't reach a DHCP server, it assigns itself an address in this range. Seeing a 169.254 address usually means DHCP failed.

How IP Geolocation Works

When you use an IP lookup tool, it returns a location — country, region, city, sometimes coordinates. But your ISP didn't broadcast your home address. How does geolocation work?

IP geolocation databases are built by aggregating multiple data sources:

  1. Regional Internet Registry (RIR) data — ARIN, RIPE, APNIC, and other regional registries publish which organizations own which IP blocks, often with country information.

  2. BGP routing data — Border Gateway Protocol announcements reveal which networks are geographically associated with which IP ranges.

  3. Active measurement — Companies like MaxMind and ip-api run probes that measure network latency from known geographic points to infer location.

  4. User-submitted corrections — Some services let users report incorrect locations, improving accuracy over time.

The result is a probabilistic mapping. Country-level accuracy is typically 95-99%. City-level accuracy drops to 50-80% depending on the provider and region. Rural areas and mobile IPs are harder to pin down. VPNs and proxies will show the VPN server's location, not yours.

Why Your IP Lookup Shows the Wrong Location

Several things can cause geolocation to be off:

  • VPN or proxy — Your traffic exits through a different country.
  • Corporate network — Your company's internet traffic may all route through a central office in a different city.
  • ISP routing — Your ISP may route traffic through a hub city before reaching the internet, and that hub's address gets registered.
  • Outdated database — IP blocks get reassigned. Geolocation databases need regular updates to stay accurate.
  • Mobile carriers — Mobile network IPs are often registered to the carrier's headquarters, not your actual location.

Checking Your IP Address

The simplest way to check your public IP is to use an IP lookup tool — it shows your IP as seen by external servers, which is your real public-facing address. You can also check from the command line:

# Linux/macOS — asks an external service
curl ifconfig.me

# Or using DNS
dig +short myip.opendns.com @resolver1.opendns.com

# Your private/local IP
ip addr show        # Linux
ipconfig            # Windows
ifconfig            # macOS

For server infrastructure, knowing your IP matters for firewall rules, allowlists, and debugging connectivity issues. For everyday use, it's mostly trivia — until you need it, and then it's essential.

Try looking up any IP address with the IP Lookup tool — it shows country, region, ISP, timezone, and coordinates using the ip.guide API.