What is a subnet?
A subnet is a smaller network carved out of a larger IP address block. Splitting a network this way keeps broadcast traffic contained, makes it easier to apply security rules between groups of devices, and lets you hand out addresses in an organised way instead of one flat pool.
For example, an office might give staff laptops, printers, guest Wi-Fi and servers their own subnets. A firewall can then allow printers to talk to laptops while keeping guests away from servers. The subnet calculator above shows how much room each of those networks has.
CIDR notation and netmasks
CIDR (Classless Inter-Domain Routing) notation writes an address and its network size together, as in 192.168.1.0/24. The number after the slash is the prefix length: how many of the 32 bits are fixed as the network portion. The remaining bits are free to number hosts.
The same information can be written as a netmask, a 32-bit value with ones for the network bits and zeros for the host bits. A /26 is 26 ones followed by six zeros:
/26 = 11111111.11111111.11111111.11000000
= 255.255.255.192
Because the ones must be contiguous, only 33 masks are valid, from /0 to /32. Each step of one in the prefix halves the number of addresses.
How to calculate a subnet by hand
It helps to know the method even when you use a calculator, for example in an exam or when checking a configuration. Take 192.168.10.77/26:
- Find the mask. /26 gives 255.255.255.192. The interesting octet is the last one, 192.
- Find the block size. 256 − 192 = 64. Subnets in this range start at multiples of 64: 0, 64, 128 and 192.
- Find the network address. 77 falls between 64 and 127, so the network address is 192.168.10.64.
- Find the broadcast address. It is one less than the next block: 192.168.10.127.
- Find the host range. The first usable host is .65 and the last is .126, so there are 62 usable hosts.
The wildcard mask is simply the inverse of the netmask. Here it is 0.0.0.63.
Subnet mask cheat sheet
This table lists every prefix from /8 to /32 with its netmask, wildcard mask and host counts. Usable hosts are the total minus the network and broadcast addresses, except for /31 and /32.
Splitting a network and VLSM
To split a network into equal parts, increase the prefix length. Each extra bit doubles the number of subnets and halves their size. Splitting 192.168.1.0/24 into four gives four /26 subnets:
Equal splits are simple but can waste addresses. With Variable Length Subnet Masking (VLSM) you size each subnet to what it needs. A good rule is to allocate the largest requirement first so every block stays aligned. Here is one plan for a single /24:
The remaining space, 192.168.1.228 to 192.168.1.255, is still free for future subnets.
Combining networks: the reverse of splitting is route summarization, or supernetting. Two adjacent, aligned blocks such as 192.168.0.0/24 and 192.168.1.0/24 can be advertised as one 192.168.0.0/23.
Private and special IPv4 ranges
Not every IPv4 address is available on the public internet. These ranges have a defined purpose, and the calculator labels them in the Address type field.
IP address classes
Early IPv4 grouped addresses into classes by their first octet. Classful addressing has been replaced by CIDR, but the terms still appear in textbooks, certification exams and some device menus, so the calculator reports the class for reference.
Where subnetting is used
- Home and office networks. Separate VLANs for staff, guests, cameras and servers.
- Cloud networks. Planning VPC and virtual network address space, then dividing it into public and private subnets across zones.
- Firewall and router rules. Access lists and routing tables refer to networks as address and mask pairs.
- Point-to-point links. A /30 or /31 connects two routers without wasting addresses.
- Study and certification. Subnetting is a core skill for CCNA, Network+ and similar exams, and a calculator is handy for checking your answers.
Common mistakes
- Assigning the network or broadcast address to a host. On a normal subnet the first and last addresses are reserved.
- Overlapping subnets. Two subnets that share addresses cause routing problems. Check ranges before you assign them.
- Mixing up netmask and wildcard. Cisco ACLs use the wildcard, so a /24 is written 0.0.0.255, not 255.255.255.0.
- Sizing for today only. Leave room to grow, because renumbering a network later is painful.
- Entering an invalid mask. Masks must be contiguous ones followed by zeros. 255.255.0.255 is not valid.
Key terms
- Network address
- The first address in a subnet. It identifies the network itself and is not assigned to a host.
- Broadcast address
- The last address in a subnet. A packet sent to it reaches every host in that subnet.
- Netmask (subnet mask)
- A 32-bit value that separates the network portion of an address from the host portion.
- Wildcard mask
- The bitwise inverse of the netmask, used in router and firewall rules.
- Prefix length
- The number of network bits, written after a slash in CIDR notation.
- VLSM
- Using different prefix lengths within one address block to fit each subnet to its needs.
- Usable host range
- The addresses between the network and broadcast addresses that can be assigned to devices.