How to use the subnet calculator
- Type an IPv4 address. You can paste CIDR notation such as
10.0.5.77/22and the prefix is picked up automatically. - Choose a CIDR prefix or type a subnet mask. The two stay in sync, so typing 255.255.252.0 selects /22.
- Read the network, broadcast, first and last usable host, host count, wildcard mask, class and address type. The binary view highlights the network bits.
- Optionally pick a longer prefix under Split into subnets to list every smaller network inside the block. This is handy for VLAN or VPC planning.
CIDR notation explained
An IPv4 address is 32 bits, written as four 8-bit octets. Classless Inter-Domain Routing (CIDR) adds a slash and a prefix length, such as /24. That number says how many leading bits belong to the network. The remaining 32 − prefix bits number the hosts inside it. The subnet mask is the same idea written as an address, with the prefix bits set to 1 and the host bits set to 0.
Worked example: 10.0.5.77/22
A /22 mask is 22 ones: 11111111.11111111.11111100.00000000 = 255.255.252.0, so the wildcard is 0.0.3.255. The third octet 5 is 00000101. Keeping its top six bits gives 00000100 = 4, so the network is 10.0.4.0. Setting the ten host bits to 1 gives the broadcast 10.0.7.255. The usable range is 10.0.4.1 – 10.0.7.254, which is 210 − 2 = 1,022 hosts. 10.0.0.0/8 is RFC 1918 space, so the address is private.
Splitting a network
Each bit you add to the prefix doubles the number of subnets and halves their size. A /24 split into /26 networks gives 4 subnets of 64 addresses: 192.168.1.0, .64, .128 and .192. Each has 62 usable hosts. To size a subnet, find the smallest power of two that is at least hosts + 2. For 50 hosts that is 64 addresses, which means a /26.
Subnet cheat sheet (/8 to /32)
| CIDR | Subnet mask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 |
| /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 (RFC 3021) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
Special IPv4 ranges
| Block | Purpose |
|---|---|
| 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | Private networks (RFC 1918). Not routed on the public internet |
| 100.64.0.0/10 | Carrier-grade NAT shared address space (RFC 6598) |
| 127.0.0.0/8 | Loopback (localhost) |
| 169.254.0.0/16 | Link-local / APIPA, used when DHCP fails |
| 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | Documentation and examples (RFC 5737) |
| 224.0.0.0/4 | Multicast (old Class D) |
| 240.0.0.0/4 | Reserved (old Class E), including 255.255.255.255 broadcast |
Tips
- Classful A/B/C labels are historical. Since CIDR (RFC 4632) any prefix length can be used, and the class only tells you the first-octet range.
- Cloud providers reserve extra addresses. AWS keeps 5 per VPC subnet, so a /24 there gives 251 usable hosts, not 254.
- Leading zeros such as 192.168.01.1 are rejected because some systems read them as octal.
Sources
- IETF RFC 4632: Classless Inter-domain Routing (CIDR)
- IETF RFC 1918: Address Allocation for Private Internets; RFC 6598: Shared Address Space
- IETF RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links
- IANA IPv4 Special-Purpose Address Registry (RFC 6890)