IP Addresses & Routing

What Is an IP Address?

An IP address tells the network where to deliver data. Learn how it works, where yours comes from and how to read both versions.

Key takeaways

  • An IP address labels a network interface so routers know where to deliver packets and where replies should go.
  • IPv4 addresses are 32 bits, written as four numbers; IPv6 addresses are 128 bits, written in hexadecimal groups.
  • Part of every address names the network and the rest names a particular host on that network.
  • Most home devices use private addresses and share one public address through the router.
  • An address can change, and it identifies a connection more than a person or a specific device.

An IP address is a number that identifies a network connection so that data can be delivered to it. Every packet you send over the internet carries two of them: the address it came from and the address it is headed to. Routers read the destination address and pass the packet along, one hop at a time, until it arrives.

You have more than one IP address right now. Your laptop or phone has an address on your local network, your router has another one facing your internet provider, and the websites you visit have their own. This guide explains what those numbers mean, how a device gets one and what you can safely conclude from seeing one.

What the address is for

The Internet Protocol, or IP, is the set of rules for moving small chunks of data called packets between networks. IP needs a way to say "this goes there," and the address is that label.

A useful comparison is a postal address, with two differences. First, an IP address belongs to a network connection rather than a building: move your laptop to a coffee shop and it gets a different one. Second, nobody along the way needs to know the whole route. Each router only decides which neighbor is a step closer.

Names such as example.com are for people. Before your browser can connect, it asks the Domain Name System to translate the name into an address. DNS, the internet's directory, covers that step. After the lookup, the traffic itself is addressed with numbers.

How addresses carry a web request
Your laptop DNS resolver Web server What is the address of example.com? 1 Here is the server's IP address 2 Packet: from your address, to the server 3 Reply: addresses swapped 4 The source of the request becomes the destination of the answer. Your laptop DNS resolver Web server What is the address of example.co m? 1 Here is the server's IP address 2 Packet: from your address, to the server 3 Reply: addresses swapped 4 The source of the request becomes the destination of the answer.

Every packet carries both a source and a destination address.

What an IPv4 address looks like

IP version 4 is the older and still very widely used form. An IPv4 address is a 32-bit number. To make it readable, it is split into four 8-bit pieces called octets, each written in decimal and separated by dots:

192.168.1.25

Each octet can be from 0 to 255, because 8 bits can hold 256 different values. A string such as 192.168.1.300 is therefore not a valid address.

Thirty-two bits allow about 4.3 billion combinations. That sounded enormous when the protocol was designed and turned out to be too few, which is the story told in the IPv4 address shortage.

What an IPv6 address looks like

IP version 6 was created mainly to fix the shortage. Its addresses are 128 bits long, written as eight groups of up to four hexadecimal digits separated by colons:

2001:db8:0:0:0:0:0:25
2001:db8::25

Those two lines are the same address. A double colon stands in for one run of all-zero groups. The space is so large that devices can hold several IPv6 addresses at once without anyone running short.

Feature IPv4 IPv6
Length 32 bits 128 bits
Written as Four decimal numbers Hexadecimal groups
Example 203.0.113.7 2001:db8::7
Typical home setup Private addresses behind one shared public one Each device can have a globally unique address

The two versions don't talk to each other directly. Many networks run both side by side. For the longer comparison, read IPv6 explained for people who know IPv4.

The network part and the host part

An address is really two pieces joined together. The front portion identifies a network, and the remainder identifies one interface on that network. A number called the prefix length says where the split falls.

In 192.168.1.25/24, the /24 means the first 24 bits (the first three octets) are the network. Everything starting with 192.168.1. is a neighbor that your device can reach directly. Anything else has to go through a router.

Taking apart 192.168.1.25/24
192.168.1 1 .25 2 /24 3 Network portion Shared by every device on this local network. Routers use it to decide where packets go. 1 Host portion Picks out one interface among its neighbors. 2 Prefix length Says that the first 24 of the 32 bits belong to the network. 3 192.168.1 1 .25 2 /24 3 Network portion Shared by every device on this local network. Routers use it to decide where packets go. 1 Host portion Picks out one interface among its neighbors. 2 Prefix length Says that the first 24 of the 32 bits belong to the network. 3

You will also see this written as a subnet mask, 255.255.255.0, which means the same thing as /24. To go further, see what the slash in CIDR notation means or try the CIDR calculator.

Where your address comes from

On most networks you never type an address. A device that joins asks for one using DHCP, the Dynamic Host Configuration Protocol, and a server (usually built into your router) lends it an address for a set period. It also hands over the prefix length, the router to use and the DNS servers. The exchange is described in DHCP explained.

Your router gets its own outside address from your internet provider in a similar way. The provider received its blocks of addresses from a regional internet registry, which in turn drew from a global pool coordinated by IANA, the Internet Assigned Numbers Authority.

IPv6 adds a second method: devices can build their own addresses from a prefix the router announces.

An address can also be set by hand. That is common for servers and network gear, and it brings the responsibility of avoiding duplicates.

Public and private addresses

Some IPv4 ranges are set aside for use inside homes and organizations: addresses beginning 10., those from 172.16. through 172.31., and those beginning 192.168.. These private addresses are reused by countless networks and are not routed across the public internet.

Your router bridges the two worlds with network address translation, or NAT. It rewrites outgoing packets so they appear to come from its single public address, then remembers which inside device each reply belongs to. NAT explained walks through it, and public vs. private IP addresses shows how to tell which you are looking at.

Other addresses you will bump into

A few values mean something special:

  • 127.0.0.1 (or ::1 in IPv6) is your own device talking to itself.
  • An address starting 169.254. usually means your device asked for DHCP and got no answer.
  • 192.0.2.x, 198.51.100.x and 203.0.113.x are reserved for documentation, which is why examples use them.

The full tour is in reserved and special IPv4 ranges.

IP addresses, MAC addresses and ports

Three identifiers work together and are easy to confuse.

A MAC address is a hardware-level identifier used to deliver frames within a single local network. It does not travel across the internet. An IP address gets a packet from network to network. A port number picks which program on the receiving machine should get the data, so a server can run web and mail services on the same address.

As a packet crosses the internet, the IP addresses normally stay the same from end to end (NAT being the notable exception), while the MAC addresses are replaced at every local hop. See MAC addresses vs. IP addresses and ports explained.

What an address does and does not tell anyone

Websites need your public address to send replies, so they see it. From it they can usually work out which provider or network you are using and make a rough guess at your region. They generally cannot learn your name or street address from the number alone, although your provider keeps records that connect subscribers to addresses, and those can be obtained through legal processes whose rules vary by place.

One public address often covers a whole household, an office or even many unrelated customers of one provider. It may also change from time to time. Treat it as a clue about a connection, not as a fingerprint of a person. What your IP address reveals about you goes into the detail.

Looking at your own address

On Windows, open a terminal and run:

ipconfig

On macOS:

ifconfig

On Linux:

ip addr

Each lists your network interfaces and the addresses on them. Those are your local addresses. The public one may be different, and you can see what a web server receives from you with the request header echo tool or in your router's status page. Phone steps and more are in how to find your IP address on any device.

When an address matters to you

Most days you never think about the number. It becomes useful in a handful of situations:

  • Reaching a local device. A printer, a network drive or a router's admin page is often opened by typing its address.
  • Troubleshooting. The address your device holds shows at a glance whether it received proper settings. A normal private address suggests the local setup worked; a 169.254 one says it didn't.
  • Allowing access. Some work systems and servers only accept connections from addresses on a list.
  • Reading logs. If you run a website, every request in the log starts with the visitor's address.
  • Hosting something. For others to reach a server you run, a name has to point to an address they can get to.

A quick way to narrow down a connection fault is to test in layers. First ping your router's address. If that works, your device and local network are probably fine. Then ping a public address:

ping 192.168.1.1
ping 1.1.1.1
ping example.com

(On Linux and macOS, press Ctrl+C to stop.) If the public address answers but the name does not resolve, the trouble is with DNS rather than with your connection. Bear in mind that some devices and networks ignore ping on purpose, so silence alone is not proof of a fault.

Common questions

Can two devices have the same IP address?

On the same network, no: that causes an address conflict, and one or both devices lose reliable connectivity. On separate private networks, yes. Your neighbor's printer and your laptop can both be 192.168.1.25 without ever noticing each other.

Does my phone have an IP address on mobile data?

Yes. The carrier assigns one, and it is often an IPv6 address, a shared IPv4 address or both. It usually differs from the address your phone has on Wi-Fi.

Can I choose my own public address?

Not freely. It comes from your provider's blocks. You can ask the provider about a fixed one, restart the connection and hope for a new one (no guarantee), or route traffic through a VPN so sites see the VPN server's address instead.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in IP Addresses & Routing →

Latest news on this topic