How subnetting works
An IPv4 address is 32 bits. The prefix length (the /26 in 192.168.10.37/26) says how many of those bits identify the network. The remaining bits identify hosts within it. The subnet mask is the same information written as four octets: /26 = 26 one-bits = 255.255.255.192.
- Network address: all host bits set to 0. It identifies the subnet and can’t be assigned to a device.
- Broadcast address: all host bits set to 1. Packets sent here reach every host in the subnet.
- Usable hosts: 2host bits − 2. A /26 has 6 host bits, so 64 − 2 = 62 usable addresses.
- Wildcard mask: the inverse of the subnet mask (
0.0.0.63), used in Cisco ACLs and OSPF network statements.
/31 and /32 are special. A /31 has no network or broadcast address, so both addresses are usable. That makes it ideal for point-to-point router links (RFC 3021) and saves half the addresses of a /30. A /32 is a single host, used for loopbacks and host routes. This calculator handles both correctly.
Subnet cheat sheet
| CIDR | Subnet mask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
Private and special IPv4 ranges
| Range | Purpose |
|---|---|
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | Private networks (RFC 1918). Not routed on the internet |
100.64.0.0/10 | Carrier-grade NAT shared space (RFC 6598). Common with ISPs and mobile networks |
169.254.0.0/16 | Link-local / APIPA. A device that failed to get DHCP often has one of these |
127.0.0.0/8 | Loopback (localhost) |
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | Documentation examples (TEST-NET-1/2/3) |
224.0.0.0/4 | Multicast (e.g. 224.0.0.5 = all OSPF routers) |
VLSM in practice
Variable Length Subnet Masking gives each segment a subnet sized to its needs instead of cutting everything into equal pieces. List your segments in the VLSM planner: an office LAN of 100 users, 50 guests, 20 servers, a 2-host router link. The planner allocates them largest first, so every block lands on a correct boundary without gaps. It also shows exactly how much space is left for growth.
- Start from the block you were assigned (for example
192.168.10.0/24). - For each segment, add 2 (network + broadcast) and round up to a power of two: 100 hosts → 128 → /25.
- Allocate the biggest first, then the next biggest straight after it, and so on.
- Leave the remaining space as future expansion. Growth always comes sooner than you think.