Lesson 1 of 4 · 7 min
IPv4 addresses and subnet masks
Read an IPv4 address in binary and see how a mask separates the network from the host.
By Calxo AI · Updated
Meet your laptop’s network address
You open your Wi-Fi settings and spot something like 192.168.1.10. It looks a little mysterious. But break it into four pieces and it becomes much friendlier.
Each number is a group of eight binary digits, called an octet. Each octet can hold a decimal value from 0 to 255. Four octets give us the 32 bits in an IPv4 address.
110000008 bits101010008 bits000000018 bits000010108 bitsThink of an IP address as a delivery label for a network connection. Your laptop can have one for Wi-Fi, another for Ethernet, and another for a VPN. To work out which neighbourhood an address belongs to, we need one more piece: its subnet mask.
Binary is just a row of on/off switches
Before we get to masks, let’s make those ones and zeros less intimidating. Imagine eight switches, each with a value: 128, 64, 32, 16, 8, 4, 2, and 1. Switch a position on with a 1, or leave it off with a 0. Add up the values that are on.
That gives us 192 as 11000000. For 10, switch on 8 and 2: 00001010. That’s the whole trick. You don’t need to memorise every combination.
| Octet | Decimal | Binary |
|---|---|---|
| First | 192 | 11000000 |
| Second | 168 | 10101000 |
| Third | 1 | 00000001 |
| Fourth | 10 | 00001010 |
The mask draws a dividing line
A subnet mask tells us which bits describe the network and which describe an address inside it. In binary, its ones come first, followed by zeros. The ones mark the network; the zeros leave room for hosts.
Take 255.255.255.0. That is 24 ones followed by eight zeros, so we can write it as /24. With 192.168.1.10/24, the first 24 bits identify the network 192.168.1.0. Eight host bits are left.
This block runs from .0 to .255. On a conventional broadcast subnet, .0 names the network and .255 is the broadcast address. Devices use .1 through .254. A host is simply a device or interface using an address on the network.
Let’s find the network for .70
Now try 192.168.1.70 with mask 255.255.255.192. The final mask octet, 192, is 11000000. Two bits in the last octet belong to the network too, giving us /26.
We line up the last address octet with the last mask octet. Keep a 1 only where both rows have a 1. This little operation is called bitwise AND.
Address: 01000110 (70) Mask: 11000000 (192) Bitwise AND: Network: 01000000 (64)
The answer is 64, so our network is 192.168.1.64/26. The mask kept the network bits and cleared the host bits. Notice that the network didn’t start at .0 this time: the prefix decides where the boundary falls.
Private addresses and local communication
Wondering why so many home networks use 192.168? It is part of the private address space. The private ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Different homes and organisations can reuse these addresses internally.
Your device uses its prefix to decide whether a destination is local. If it is on another subnet, traffic normally goes through a router, often your default gateway. A private address alone doesn’t provide Internet access or security, and sharing a subnet doesn’t guarantee communication: connections, VLANs, and firewalls still matter.
Common mistakes
- Reading /24 as 24 hosts. It means 24 network bits.
- Assuming any address ending in .0 is a network address. That depends on the prefix.
- Treating every address outside the private ranges as publicly routable. IPv4 also contains special-use ranges.
Try it yourself
IPv4 subnet explorer
Change the address or prefix. Watch the network bits and host range update.
Blue = network bits (24). Amber = host bits (8).
- Network
- 192.168.1.0/24
- Subnet mask
- 255.255.255.0
- Total addresses
- 256
- Usable host addresses
- 254
- Host range
- 192.168.1.1 – 192.168.1.254
- Broadcast address
- 192.168.1.255
8 host bits → 2^8 = 256 addresses → 254 usable after the network and broadcast reservations. This is address arithmetic; special-use ranges and your network configuration may impose other restrictions.
Check your understanding
Choose an answer for every question, then check your work. You can retry as often as you like.
Sources and scope
These lessons explain IPv4 address arithmetic using IETF specifications. Host counts use conventional network and broadcast reservations, with /31 and /32 exceptions. Address availability also depends on special-use ranges, provider rules, and your configuration.
- RFC 791 — IPv4 address format
- RFC 4632 — CIDR prefixes and address blocks
- RFC 1918 — Private IPv4 address space
- RFC 3021 — /31 point-to-point links