Subnet Masks and CIDR Notation Explained
Developer · Published October 9, 2026 · Updated October 24, 2026 · 3 min read
Written by Akinrinmade Michael
An IPv4 address like 192.168.1.10 is really a 32-bit number written as four bytes. A subnet divides that number into two parts: the network (which group of devices) and the host (which device inside the group). Once you see how that split works, subnet masks and slash numbers stop being mysterious.
The subnet mask
The mask marks which bits belong to the network. Where the mask has a 1, the bit is part of the network address, and where it has a 0, the bit is for hosts. 255.255.255.0 is 24 ones followed by 8 zeros.
255.255.255.0 11111111.11111111.11111111.00000000 |----- 24 network bits ------|-- 8 host bits --|
CIDR notation
CIDR writes the mask as a slash and the number of 1 bits. So 255.255.255.0 becomes /24, and 192.168.1.10/24 means "the address 192.168.1.10 on a network whose first 24 bits are the network part". It's shorter to write and harder to get wrong than a dotted mask.
Finding the network address by hand
The network address is the address with all the host bits set to zero. You get it by combining the address and the mask bit by bit, keeping a 1 only where both have a 1. For 192.168.1.10/24 the first three bytes are all network bits and stay as they are, and the last byte becomes zero:
192.168.1.10 = 11000000.10101000.00000001.00001010 mask /24 = 11111111.11111111.11111111.00000000 network = 11000000.10101000.00000001.00000000 = 192.168.1.0
With a mask that cuts through a byte, it takes a little more care. For 192.168.1.130/26, the mask's last byte is 192, so the blocks are 64 addresses long: 0, 64, 128 and 192. The address .130 falls in the block that starts at 128, so the network is 192.168.1.128, the broadcast is .191, and the usable hosts are .129 to .190.
Counting addresses
A /24 leaves 8 bits for hosts, giving 256 addresses, which is 2 to the power of 8. The first is the network address and the last is the broadcast address, and neither can be given to a device. So usable hosts are 2 to the power of (32 minus the prefix), minus 2, which is 254 for a /24.
| Prefix | Mask | Addresses | Usable hosts |
|---|---|---|---|
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /30 | 255.255.255.252 | 4 | 2 |
A /30 is traditionally used for a link between two routers, with exactly two usable addresses. Newer practice uses /31 for the same job, which has two addresses and no network or broadcast, and /32 for a single host.
Private address ranges
10.0.0.0/8, about 16.7 million addresses.172.16.0.0/12, which runs from 172.16.0.0 to 172.31.255.255.192.168.0.0/16, the range behind most home routers.
These are reserved for private networks such as your home or office. They aren't routed on the public internet, so many networks can reuse them. That's also why joining two offices that both use 192.168.1.0/24 causes trouble: the addresses overlap.
Splitting a network
To split a network, make the prefix longer. Each extra bit doubles the number of subnets and halves their size. A /24 split into four becomes four /26 networks:
192.168.1.0/26 hosts .1 - .62 192.168.1.64/26 hosts .65 - .126 192.168.1.128/26 hosts .129 - .190 192.168.1.192/26 hosts .193 - .254
Pick the smallest prefix that fits your devices with room to grow. If a department has 50 devices, a /26 with 62 hosts works. If it grows to 70, you'll have to renumber, so leave room. When different groups need different sizes, give the biggest group its block first, then carve smaller blocks from what's left.
Common mistakes
- Giving a device the network or broadcast address.
- Overlapping subnets, which causes odd, intermittent failures.
- Mixing up the mask and the wildcard mask. Some router rules use the flipped version, such as 0.0.0.255 for /24.
- Planning only for today's device count.
A word on IPv6
IPv6 uses the same slash idea on 128-bit addresses. The standard size for one local network is a /64, which has far more addresses than the whole IPv4 internet, so planning IPv6 is about how many /64 networks you hand out, not about saving addresses.
Enter any address and prefix into the IP Subnet Calculator to see the network, broadcast, host range and mask, and to split it into smaller subnets. The number base converter shows addresses in binary, and the chmod calculator uses a similar bit-by-bit idea for file permissions.