Subnetting Made Simple: CIDR, Subnet Masks and Usable Hosts
Updated 27 September 2026 · 5 min read
A subnet is a block of IP addresses that share the same network part, and CIDR notation such as /26 tells you how big that block is. Once you see the pattern in the block sizes, you can work out most IPv4 subnets in your head. This guide covers the little binary you need, a cheat sheet, and a worked example you can check with our calculator.
The binary you actually need
An IPv4 address is 32 bits, written as four octets of 8 bits each. The prefix length /n means the first n bits identify the network and the remaining bits identify hosts on it. A /24 leaves 8 host bits; a /26 leaves 6.
Each bit in an octet has a value: 128, 64, 32, 16, 8, 4, 2, 1. A subnet mask is a row of 1 bits followed by 0 bits, so a mask octet can only ever be 0, 128, 192, 224, 240, 248, 252, 254 or 255.
To find the network an address belongs to, compare it with the mask bit by bit (a logical AND). Take 192.168.10.77/26:
- Last octet of the address: 77 =
01001101 - Last octet of the mask: 192 =
11000000 - AND of the two:
01000000= 64
So the network is 192.168.10.64/26. The quicker way is the block size: 256 minus the mask octet. For /26 that is 256 - 192 = 64, so networks start at 0, 64, 128 and 192, and 77 falls in the block starting at 64.
CIDR cheat sheet and usable hosts
Usable hosts are 2 to the power of the host bits, minus 2 (one for the network address, one for broadcast). The wildcard mask is explained further down.
| Prefix | Subnet mask | Addresses | Usable hosts | Wildcard |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 | 0.0.0.255 |
| /25 | 255.255.255.128 | 128 | 126 | 0.0.0.127 |
| /26 | 255.255.255.192 | 64 | 62 | 0.0.0.63 |
| /27 | 255.255.255.224 | 32 | 30 | 0.0.0.31 |
| /28 | 255.255.255.240 | 16 | 14 | 0.0.0.15 |
| /29 | 255.255.255.248 | 8 | 6 | 0.0.0.7 |
| /30 | 255.255.255.252 | 4 | 2 | 0.0.0.3 |
| /31 | 255.255.255.254 | 2 | 2 (point-to-point links) | 0.0.0.1 |
| /32 | 255.255.255.255 | 1 | 1 (a single host) | 0.0.0.0 |
Each step down halves the block. Going the other way, a /23 has 510 usable hosts and a /16 has 65,534.
Network address, broadcast and usable hosts
In every subnet, the first address (all host bits 0) is the network address, which names the subnet itself. The last address (all host bits 1) is the broadcast address, which reaches every device on it. Everything in between can be given to devices.
The router or gateway normally takes the first usable address (.1 in a /24), but that is a convention, not a rule. Some networks use the last usable address instead.
Two exceptions to the minus-2 rule:
- /31: on point-to-point links between two routers, both addresses are used as hosts, as allowed by RFC 3021. This saves half the addresses compared with a /30.
- /32: a single address, used for loopback interfaces, firewall rules and routes to one host.
Worked example: splitting 192.168.10.0/24 into four
Say an office has one /24 and wants separate networks for staff, guest Wi-Fi, CCTV and servers. Four subnets need 2 extra network bits, because 2 to the power of 2 is 4. So /24 becomes /26, with mask 255.255.255.192, a block size of 64 and 62 usable hosts in each.
| Subnet | Network | Usable range | Broadcast |
|---|---|---|---|
| Staff | 192.168.10.0/26 | .1 to .62 | 192.168.10.63 |
| Guest Wi-Fi | 192.168.10.64/26 | .65 to .126 | 192.168.10.127 |
| CCTV | 192.168.10.128/26 | .129 to .190 | 192.168.10.191 |
| Servers | 192.168.10.192/26 | .193 to .254 | 192.168.10.255 |
Real needs are rarely equal, so you can use different sizes (variable-length subnetting). Suppose staff need 100 addresses, guests 50 and cameras 20. Allocate the largest first so every block starts on its own boundary:
- Staff:
192.168.10.0/25(126 usable, .1 to .126) - Guests:
192.168.10.128/26(62 usable, .129 to .190) - CCTV:
192.168.10.192/27(30 usable, .193 to .222) - Spare:
192.168.10.224/27for later
A subnet must start on a multiple of its block size. 192.168.10.100/26 is a valid address, but it isn't a network start; it sits inside 192.168.10.64/26.
Wildcard masks
A wildcard mask is the subnet mask flipped: subtract each octet from 255. For /26 that gives 0.0.0.63. A 0 bit means "must match" and a 1 bit means "any value".
You mostly see wildcards on Cisco and similar equipment, in access lists and OSPF:
access-list 10 permit 192.168.10.64 0.0.0.63matches the whole guest subnet.network 192.168.10.64 0.0.0.63 area 0adds it to OSPF.
Private and special ranges
RFC 1918 reserves three ranges for private networks:
| Range | Covers | Addresses |
|---|---|---|
| 10.0.0.0/8 | 10.0.0.0 to 10.255.255.255 | 16,777,216 |
| 172.16.0.0/12 | 172.16.0.0 to 172.31.255.255 | 1,048,576 |
| 192.168.0.0/16 | 192.168.0.0 to 192.168.255.255 | 65,536 |
A common mistake: 172.32.0.1 is a public address, because the /12 stops at 172.31. Other ranges worth recognising are 100.64.0.0/10 for carrier-grade NAT (RFC 6598), 127.0.0.0/8 for loopback, and 169.254.0.0/16 for link-local. A Windows PC showing 169.254.x.x couldn't get an address from DHCP.
Practical tip: for an office, pick something less common than 192.168.0.x or 192.168.1.x, such as 10.20.0.0/16 carved into /24s. Staff connecting by VPN from home routers on 192.168.1.0/24 won't then clash with the office range.
Using the Subnet Calculator
Type an address with its prefix, such as 10.20.30.40/16, into the Subnet Calculator, or enter the address and pick the prefix from the list, which also shows each mask. It returns the network address, subnet mask, wildcard mask, broadcast address, host range and number of usable hosts, plus the address type (private, public, CGNAT, loopback and so on) and the old class.
It is IPv4 only. The class is shown for reference; classful networks were replaced by CIDR in the 1990s, so a 10.x address doesn't have to be a /8. For more on public and private addresses, see What Is My IP Address?
Frequently asked questions
Why does a /24 have 254 usable hosts, not 256?
The first address is the network address and the last is broadcast. Neither can be given to a device, leaving 254.
Is /24 the same as 255.255.255.0?
Yes. They are two ways of writing the same mask: 24 one bits followed by 8 zero bits.
Can an address ending in .0 or .255 be a normal host?
In a /24, no. In a larger subnet, yes: in 192.168.10.0/23, the broadcast is 192.168.11.255, so 192.168.10.255 and 192.168.11.0 are ordinary usable addresses.
How does IPv6 subnetting differ?
IPv6 LANs almost always use a /64, and providers hand out larger blocks such as a /56 or /48 to split into /64s. Our calculator doesn't handle IPv6.