IPv4 Subnets
I've gotten tired of doing binary math to calculate IPv4 subnets in my head, so I created the following two reference tables. The first table is small and can be used to easily slide horizontally to look up information for a subnet within an octet. Where as the second larger table can be used to slide vertically to look up information for any possible 32 bit subnet.
- Bits
- The number of bits in the netmask, counting from the left (MSB) to the right (LSB).
- Netmask
- The doted quad netmask in decimal notation.
- Hexmask
- The doted quad netmask in hexadecimal notation.
- Wildcard
- The wildcard is a Cisco nomenclature that is a binary inversion of the netmask.
- Sub Networks
- The number of sub networks for the given netmask.
- Host IPs
- The number of usable host IPs for the given netmask. - Remember that you loose two usable IPs to network and broadcast addresses.
- Binary
- The decimal value of the given bit.
| Bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|---|
| Netmask | 0 | 128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 |
| Hexmask | 0 | 80 | C0 | E0 | F0 | F8 | FC | FE | FF |
| Wildcard | 255 | 127 | 63 | 31 | 15 | 7 | 3 | 1 | 0 |
| Sub Networks | 0 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 |
| Host IPs | 254 | 126 | 62 | 30 | 14 | 6 | 2 | 0 | 0 |
| Binary | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Bits | Netmask | Hexmask | Wildcard | Sub Networks | Host IPs | Binary |
|---|---|---|---|---|---|---|
| 0 | 0.0.0.0 | 0.0.0.0 | 255.255.255.255 | 0 | 4,294,967,294 | 4,294,967,296 |
| Bits | Netmask | Hexmask | Wildcard | Sub Networks | Host IPs | Binary |
| 1 | 128.0.0.0 | 80.0.0.0 | 127.255.255.255 | 2 | 2,147,483,646 | 2,147,483,648 |
| 2 | 192.0.0.0 | C0.0.0.0 | 63.255.255.255 | 4 | 1,073,741,822 | 1,073,741,824 |
| 3 | 224.0.0.0 | E0.0.0.0 | 31.255.255.255 | 8 | 536,870,910 | 536,870,912 |
| 4 | 240.0.0.0 | F0.0.0.0 | 15.255.255.255 | 16 | 268,435,454 | 268,435,456 |
| 5 | 248.0.0.0 | F8.0.0.0 | 7.255.255.255 | 32 | 134,217,726 | 134,217,728 |
| 6 | 252.0.0.0 | FC.0.0.0 | 3.255.255.255 | 64 | 67,108,862 | 67,108,864 |
| 7 | 254.0.0.0 | FE.0.0.0 | 1.255.255.255 | 128 | 33,554,430 | 33,554,432 |
| 8 | 255.0.0.0 | FF.0.0.0 | 0.255.255.255 | 256 | 16,777,214 | 16,777,216 |
| Bits | Netmask | Hexmask | Wildcard | Sub Networks | Host IPs | Binary |
| 9 | 255.128.0.0 | FF.80.0.0 | 0.127.255.255 | 512 | 8,388,606 | 8,388,608 |
| 10 | 255.192.0.0 | FF.C0.0.0 | 0.63.255.255 | 1,024 | 4,194,302 | 4,194,304 |
| 11 | 255.224.0.0 | FF.E0.0.0 | 0.31.255.255 | 2,048 | 2,097,150 | 2,097,152 |
| 12 | 255.240.0.0 | FF.F0.0.0 | 0.15.255.255 | 4,096 | 1,048,574 | 1,048,576 |
| 13 | 255.248.0.0 | FF.F8.0.0 | 0.7.255.255 | 8,192 | 524,286 | 524,288 |
| 14 | 255.252.0.0 | FF.FC.0.0 | 0.3.255.255 | 16,384 | 262,142 | 262,144 |
| 15 | 255.254.0.0 | FF.FE.0.0 | 0.1.255.255 | 32,768 | 131,070 | 131,072 |
| 16 | 255.255.0.0 | FF.FF.0.0 | 0.0.255.255 | 65,536 | 65,534 | 65,536 |
| Bits | Netmask | Hexmask | Wildcard | Sub Networks | Host IPs | Binary |
| 17 | 255.255.128.0 | FF.FF.80.0 | 0.0.127.255 | 131,072 | 32,766 | 32,768 |
| 18 | 255.255.192.0 | FF.FF.C0.0 | 0.0.63.255 | 262,144 | 16,382 | 16,384 |
| 19 | 255.255.224.0 | FF.FF.E0.0 | 0.0.31.255 | 524,288 | 8,190 | 8,192 |
| 20 | 255.255.240.0 | FF.FF.F0.0 | 0.0.15.255 | 1,048,576 | 4,094 | 4,096 |
| 21 | 255.255.248.0 | FF.FF.F8.0 | 0.0.7.255 | 2,097,152 | 2,046 | 2,048 |
| 22 | 255.255.252.0 | FF.FF.FC.0 | 0.0.3.255 | 4,194,304 | 1,022 | 1,024 |
| 23 | 255.255.254.0 | FF.FF.FE.0 | 0.0.1.255 | 8,388,608 | 510 | 512 |
| 24 | 255.255.255.0 | FF.FF.FF.0 | 0.0.0.255 | 16,777,216 | 254 | 256 |
| Bits | Netmask | Hexmask | Wildcard | Sub Networks | Host IPs | Binary |
| 25 | 255.255.255.128 | FF.FF.FF.80 | 0.0.0.127 | 33,554,432 | 126 | 128 |
| 26 | 255.255.255.192 | FF.FF.FF.C0 | 0.0.0.63 | 67,108,864 | 62 | 64 |
| 27 | 255.255.255.224 | FF.FF.FF.E0 | 0.0.0.31 | 134,217,728 | 30 | 32 |
| 28 | 255.255.255.240 | FF.FF.FF.F0 | 0.0.0.15 | 268,435,456 | 14 | 16 |
| 29 | 255.255.255.248 | FF.FF.FF.F8 | 0.0.0.7 | 536,870,912 | 6 | 8 |
| 30 | 255.255.255.252 | FF.FF.FF.FC | 0.0.0.3 | 1,073,741,824 | 2 | 4 |
| 31 | 255.255.255.254 | FF.FF.FF.FE | 0.0.0.1 | ‐ | ‐ | 2 |
| 32 | 255.255.255.255 | FF.FF.FF.FF | 0.0.0.0 | ‐ | ‐ | 1 |
| Bits | Netmask | Hexmask | Wildcard | Sub Networks | Host IPs | Binary |