Subnetting for beginners: CIDR, masks, and usable hosts
Subnetting feels hard until you realize itâs mostly two questions:
- How many addresses are in this subnet?
- What is the network/broadcast range for a given IP and prefix?
Once you can answer those, you can design networks, avoid overlapping ranges, and write firewall rules that do what you actually intend. This guide is written for beginners and focuses on practical understanding rather than memorizing tables.
1) IPv4 addresses are 32 bits (the dots are just formatting)
An IPv4 address like 192.168.1.10 is four numbers separated by dots. Each number is a byte (8 bits), so the full address is 32 bits.
Subnetting is the process of deciding how many of those bits identify the network versus the host.
2) CIDR prefix: â/24â means 24 network bits
A CIDR prefix is the /number part. The prefix tells you how many bits are âfixedâ for the network. The remaining bits are host bits.
- /24 â 24 network bits, 8 host bits
- /26 â 26 network bits, 6 host bits
- /30 â 30 network bits, 2 host bits
Host bits determine the size. With h host bits, the subnet has 2^h total addresses.
3) Subnet mask: the same idea as the prefix, written as dotted decimals
A subnet mask is another way to represent the prefix. A /24 mask is 255.255.255.0. A /26 mask is
255.255.255.192. You do not need to memorize masks if you have a calculator, but it helps to recognize the common ones.
4) Network address, broadcast address, and âusable hostsâ
In many traditional IPv4 subnets:
- The network address is the first address in the range (all host bits = 0).
- The broadcast address is the last address in the range (all host bits = 1).
- Usable hosts are the addresses in between.
Thatâs why âusable hostsâ is often total addresses â 2. (There are exceptions such as /31 pointâtoâpoint usage and
/32 singleâhost routes.)
5) Worked example: 192.168.1.10/24
With /24, there are 8 host bits. Total addresses = 2^8 = 256. Usable hosts are typically 256 â 2 = 254.
The range is:
- Network address:
192.168.1.0 - Broadcast address:
192.168.1.255 - Usable hosts:
192.168.1.1to192.168.1.254
If youâve ever seen home routers using 192.168.1.x, this is why itâs common: itâs a tidy subnet with room for many devices.
6) Worked example: splitting a /24 into four equal subnets
Suppose you have 10.0.5.0/24 and want 4 equal subnets. Four subnets means you need 2 extra network bits (because 2^2 = 4).
So you move from /24 to /26.
A /26 has 6 host bits: total addresses 2^6 = 64 per subnet, usable hosts typically 62.
The four /26 networks inside the /24 are:
10.0.5.0/26(addresses .0 to .63)10.0.5.64/26(addresses .64 to .127)10.0.5.128/26(addresses .128 to .191)10.0.5.192/26(addresses .192 to .255)
This âblock sizeâ pattern is why people memorize some masks: for /26, blocks increment by 64 in the last octet.
7) Common subnet sizes (youâll see these often)
You donât need to memorize everything, but recognizing a few is valuable:
- /24 â 254 usable hosts
- /25 â 126 usable hosts
- /26 â 62 usable hosts
- /27 â 30 usable hosts
- /28 â 14 usable hosts
- /29 â 6 usable hosts
- /30 â 2 usable hosts
The IP Subnet Calculator on this site includes a classful cheat sheet table so you can look these up quickly.
8) Mistakes that cause real outages
- Overlapping subnets: two networks that share addresses will create routing ambiguity.
- Using the wrong prefix in firewall rules: a /16 rule is massively wider than a /24 rule.
- Forgetting âusable hostâ constraints: a /30 is not a general-purpose LAN subnet.
- Assuming âclassfulâ rules apply everywhere: modern networks use CIDR; class labels are historical shortcuts.
9) Use a calculator to stay fast and accurate
In practice, the quickest workflow is:
- Enter the IP and prefix.
- Copy the computed network range into documentation or firewall tickets.
- Sanity-check usable hosts for DHCP pools.
For our sourcing and corrections standards, see the Editorial & Accuracy Policy.