What is an IP address? IPv4 and IPv6 explained

The number every device on the internet uses to find every other device, the difference between IPv4 and IPv6, and public versus private addresses.

3–4 minutes
Coiled green network cable on a white background

An IP address is the number that identifies a device on a network, so data knows where to go. Every server, phone and laptop online has one. Domain names exist so people do not have to remember them; DNS turns names into IP addresses.

An IP address is the number that identifies a device on a network, the way a street address identifies a building. Every server, phone and laptop online has one. Domain names exist so people do not have to remember them: DNS turns example.com into an IP address.

IPv4 and IPv6

IPv4IPv6
Looks like203.0.113.102001:db8:85a3::8a2e:370:7334
Length32 bits128 bits
How manyAbout 4.3 billionAbout 340 undecillion
DNS recordAAAAA

IPv4 ran out of new addresses years ago, which is why IPv6 exists. Most of the internet now runs both side by side. In an IPv6 address, :: stands for a run of zeros, so it can be written shorter.

Public and private addresses

Your home router has one public address that the internet sees. Devices behind it get private addresses, which are reused in millions of homes and never appear on the internet:

  • 10.0.0.0 to 10.255.255.255
  • 172.16.0.0 to 172.31.255.255
  • 192.168.0.0 to 192.168.255.255

The router translates between them, a process called NAT. A server meant to be reached from the internet needs a public address.

Special addresses worth knowing

AddressMeaning
127.0.0.1 and ::1Localhost: the machine itself. A service listening only here is unreachable from outside.
0.0.0.0In a server’s settings, “every address on this machine”. A service listening here is reachable on all networks.
169.254.x.xLink-local: the device failed to get an address from the network. Usually a DHCP or cable problem.
100.64.0.0 to 100.127.255.255Carrier-grade NAT: your provider shares one public address between many customers.
192.0.2.x, 198.51.100.x, 203.0.113.xReserved for documentation, which is why guides like this one use them.

The difference between 127.0.0.1 and 0.0.0.0 explains many “works on the server but not from my laptop” problems. Check what a service listens on with sudo ss -ltnp.

Static and dynamic

Home connections often get a dynamic public address that can change. Servers get a static address that stays the same, which is what DNS records point to.

Dedicated and shared IP addresses

On a VPS or dedicated server, the IP address is yours alone. On shared hosting, hundreds of sites usually share one, and the server picks the right site from the domain name the browser asks for. That works for HTTPS too, because browsers send the name during the secure handshake (a feature called SNI).

A dedicated IP rarely matters for search rankings or speed. It does matter for sending email, because mail providers judge the reputation of the sending IP: on a shared address, a neighbour’s spam affects you. See why emails go to spam.

Reverse DNS

DNS normally maps names to addresses. Reverse DNS maps an address back to a name, using PTR records set by whoever owns the address, which for a server is your hosting provider. Mail servers check it, and it makes logs easier to read:

dig -x 203.0.113.10 +short

What an IP address reveals

An IP address shows roughly where a connection comes from (usually the city or region, from public databases that are often wrong) and which provider it belongs to. It does not reveal a name or street address; only the provider can link it to a customer. Server logs record visitors’ IP addresses, which in many countries counts as personal data.

Find yours

curl -4 ifconfig.me
curl -6 ifconfig.me
ip addr

The first two show the public addresses the internet sees (IPv4 and IPv6). ip addr on Linux (or ipconfig on Windows) lists the addresses on the machine’s own network cards.

What the slash means

You will see addresses like 203.0.113.0/24. The number after the slash says how many bits are the network part. A /24 covers 256 addresses (203.0.113.0 to 203.0.113.255); a single IPv4 address is a /32.

Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.