Calxo Learn

Learn the concept. Understand the formula. Calculate the result.

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.

Picture it
Your laptop’s IPv4 address192.168.1.10
Octet 1192110000008 bits
Octet 2168101010008 bits
Octet 31000000018 bits
Octet 410000010108 bits
8 + 8 + 8 + 8 = 32 bits
Four small groups, one 32-bit address. Each decimal number represents eight binary digits.

Think 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.

Picture it
1281ON
641ON
320off
160off
80off
40off
20off
10off
128 + 64 = 192
A 1 switches a value on. A 0 leaves it off. Here, only 128 and 64 are on: together they make 192.

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.

192.168.1.10 in decimal and binary
OctetDecimalBinary
First19211000000
Second16810101000
Third100000001
Fourth1000001010

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.

Picture it
192.168.1.64/26
Network.64Reserved
Usable hosts.65 → .12662 addresses · .70 lives here
Broadcast.127Reserved
All addresses above begin with 192.168.1.
Address 192.168.1.70 sits inside the usable range. The two end addresses have special jobs on this conventional broadcast subnet.

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.

11000000101010000000000100001010

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.

Open the full subnet calculator →

Check your understanding

Choose an answer for every question, then check your work. You can retry as often as you like.

1. Which subnet mask corresponds to /27?

0 of 1 answered.

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.

How Calxo reviews its content