What an IP address is
An IP address is a numeric label assigned to each device connected to a network that uses the Internet Protocol. It does two jobs at once. It identifies the host, meaning the specific device, and it helps locate that host within the network so data can be routed to it.
There are two versions in active use today: IPv4 and IPv6. They serve the same purpose but look very different and were designed decades apart.
IPv4: the original address format
IPv4 uses 32 bits, which gives roughly 4.3 billion possible addresses. We write IPv4 addresses in dotted decimal notation: four numbers separated by dots, each ranging from 0 to 255. For example:
192.168.1.50
Each of those four numbers is called an octet because it represents 8 bits. Four octets times 8 bits equals 32 bits total. The value 255 is the largest number 8 bits can hold (binary 11111111), which is why no octet goes higher than that.
When IPv4 was designed in the early 1980s, 4.3 billion addresses seemed like more than the world would ever need. It was not. By the 2010s the central pool of unassigned IPv4 addresses ran dry, which is one of the main reasons IPv6 exists.
IPv6: the modern, much larger format
IPv6 uses 128 bits instead of 32. That produces about 340 undecillion addresses, a number so large it is effectively unlimited for any practical purpose. We write IPv6 in eight groups of four hexadecimal digits separated by colons:
2001:0db8:0000:0000:0000:0000:0000:0001
That is verbose, so IPv6 allows two shortcuts. You can drop leading zeros in each group, and you can replace one run of all-zero groups with a double colon. The address above compresses to:
2001:db8::1
The double colon can only appear once in an address, otherwise the length would be ambiguous. IPv6 also bakes in features that were bolted on later in IPv4, such as simpler header processing and built in support for address autoconfiguration.
Public versus private addresses
Not every address is reachable from the open internet. Certain ranges are reserved as private and are meant only for use inside a local network such as a home or office. The common IPv4 private ranges are:
- 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
When your laptop shows an address like 192.168.1.50, that is a private address handed out by your home router. The rest of the internet never sees it. Public addresses, by contrast, are globally unique and routable, and they are assigned to organizations by regional internet registries.
You can check the public address the world sees for your connection with the WhatIP my-ip tool, and look up details about any public address with the ip-lookup tool.
NAT: how many devices share one public address
If private addresses are not routable, how does your phone reach a website? The answer is Network Address Translation, or NAT. Your home router holds one public IP address on its internet-facing side and a private address on the inside. When a device sends a packet out, the router rewrites the source address from the private one to its own public one, and records the translation in a table. When the reply comes back, the router looks up the table and forwards the packet to the right internal device.
This is why a household with a dozen devices can share a single public IPv4 address. NAT is a clever workaround for IPv4 scarcity. IPv6 has so many addresses that NAT is usually unnecessary, and devices can hold globally unique addresses directly.
Subnets and CIDR notation
A subnet is a logical subdivision of a larger network. Splitting a network into subnets keeps traffic organized, improves performance, and lets administrators apply security rules to groups of devices.
Modern addressing uses CIDR notation, written as an address followed by a slash and a number, like:
192.168.1.0/24
The number after the slash is the prefix length: how many of the leading bits identify the network rather than individual hosts. In a /24, the first 24 bits are the network portion and the remaining 8 bits identify hosts. Eight host bits give 256 total addresses, of which 254 are usable for devices (the first is the network address and the last is the broadcast address).
A worked example
Suppose you are handed the block 10.20.30.0/24 and asked how many devices it can hold and what its address range is.
- The prefix is /24, so 32 minus 24 leaves 8 host bits.
- Two to the power of 8 is 256 total addresses.
- Subtract 2 (network and broadcast) for 254 usable host addresses.
- The range runs from 10.20.30.0 (network) to 10.20.30.255 (broadcast).
- Usable host addresses are 10.20.30.1 through 10.20.30.254.
Now split it into two equal subnets by borrowing one host bit, turning it into two /25 blocks:
- 10.20.30.0/25 covers 10.20.30.0 to 10.20.30.127 (126 usable hosts)
- 10.20.30.128/25 covers 10.20.30.128 to 10.20.30.255 (126 usable hosts)
If you would rather not do this by hand, the WhatIP subnet-calculator does the math for you.
How routing uses addresses
Routing is the process of moving a packet from its source to its destination across many networks. Each router along the path makes one decision: which neighbor should receive this packet next so it gets closer to its goal.
A router keeps a routing table, a list of destination network prefixes paired with the next hop to send matching traffic toward. When a packet arrives, the router compares the destination address against every prefix in the table and picks the most specific match, the one with the longest matching prefix. This is called longest prefix match. A route for 10.20.30.0/25 wins over a broader 10.20.0.0/16 route if both match, because the /25 is more specific.
The packet then hops from router to router, each one repeating the lookup, until it reaches the network that directly contains the destination address. There the last router delivers it to the host. The clean separation between the network portion and host portion of an address is exactly what makes this scalable: routers in the core only need to know how to reach networks, not every individual device.
How a device knows its own address
Most devices do not have their addresses typed in by hand. On a typical home or office network, a service called DHCP, the Dynamic Host Configuration Protocol, hands out addresses automatically. When your laptop joins the network, it broadcasts a request, the DHCP server (usually built into the router) offers an available address from its pool, and the laptop accepts it along with related settings like the gateway and DNS servers to use. The address comes with a lease, a set period after which the device must renew it, which lets the network recycle addresses that are no longer in use.
IPv6 adds another option called stateless address autoconfiguration. A device can generate much of its own address from information the router advertises, without needing a central server to assign it. This is part of why IPv6 networks can operate with far less manual setup than IPv4 networks of the same size.
Special-purpose addresses
A few address ranges are reserved for specific jobs and never appear as normal public hosts. The loopback address 127.0.0.1 always refers to the device itself, which is why developers test local software against it. The block 169.254.0.0/16 is link-local, used automatically when a device cannot get an address from DHCP. Knowing these special cases helps you read an address correctly: seeing 127.0.0.1 tells you traffic never left the machine, while a 169.254 address often signals that DHCP failed and the device fell back to self-assignment.
Common pitfalls
- Confusing private and public addresses. Seeing 192.168.x.x on your machine is normal and does not mean you are exposed. That is your private address behind NAT.
- Off-by-one subnet math. Remember to subtract 2 for the network and broadcast addresses in IPv4 when counting usable hosts.
- Forgetting IPv6 compression rules. The double colon shortcut can appear only once per address.
- Assuming a static address. Many home connections use dynamic addresses that change over time, so the public address you see today may differ tomorrow.
Understanding these basics gives you the vocabulary to read any address, reason about networks, and use tools like ip-lookup and the subnet-calculator with confidence.