Quick Reference
Key Formulas
These two formulas are the foundation of all subnet calculations.
| Formula | Expression | What It Calculates | Example (/26) |
|---|---|---|---|
| Usable hosts | 2^(32 − prefix) − 2 |
How many devices can be assigned IPs | 2^(32−26) − 2 = 62 |
| Number of subnets | 2^(borrowed bits) |
How many subnets when splitting a network | Splitting /24 → /26 = 2^2 = 4 |
| Block size | 256 − mask octet |
Address increment between subnet boundaries | 256 − 192 = 64 |
Complete IPv4 Subnet Reference Table
All 33 possible IPv4 prefix lengths. Highlighted rows mark classful boundaries (/8, /16, /24).
| CIDR | Subnet Mask | Wildcard Mask | Addresses | Usable Hosts | Class |
|---|---|---|---|---|---|
/32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | Host |
/31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 * | P2P |
/30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | |
/29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | |
/28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | |
/27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | |
/26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | |
/25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | |
/24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | C |
/23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | |
/22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | |
/21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | |
/20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | |
/19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | |
/18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | |
/17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | |
/16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | B |
/15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 | |
/14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 | |
/13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 | |
/12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | |
/11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 | |
/10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 | |
/9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 | |
/8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | A |
* /31 uses both addresses for hosts per RFC 3021 (point-to-point links only). Rows highlighted in blue mark classful boundaries.
Subnet Mask in Binary
Every subnet mask is a sequence of contiguous 1-bits (network) followed by 0-bits (host). Understanding the binary is the key to subnetting.
Example: /24 = 255.255.255.0
Example: /27 = 255.255.255.224
Octet Binary Values
Each bit position in an octet has a fixed decimal value. This is the basis of all binary-to-decimal conversion.
| Bit position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Decimal value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Valid Subnet Mask Octets
Only these nine decimal values can appear in a subnet mask octet. Memorize them.
| Binary | Decimal | Network bits in octet |
|---|---|---|
00000000 | 0 | 0 |
10000000 | 128 | 1 |
11000000 | 192 | 2 |
11100000 | 224 | 3 |
11110000 | 240 | 4 |
11111000 | 248 | 5 |
11111100 | 252 | 6 |
11111110 | 254 | 7 |
11111111 | 255 | 8 |
Subnetting a /24 Network
The most common real-world scenario. This table shows every possible split of a /24 network.
| Prefix | Subnet Mask | Subnets | Hosts/Subnet | Block Size | Example Ranges (192.168.1.x) |
|---|---|---|---|---|---|
/25 | 255.255.255.128 | 2 | 126 | 128 | .0–.127, .128–.255 |
/26 | 255.255.255.192 | 4 | 62 | 64 | .0–.63, .64–.127, .128–.191, .192–.255 |
/27 | 255.255.255.224 | 8 | 30 | 32 | .0–.31, .32–.63, .64–.95, … |
/28 | 255.255.255.240 | 16 | 14 | 16 | .0–.15, .16–.31, .32–.47, … |
/29 | 255.255.255.248 | 32 | 6 | 8 | .0–.7, .8–.15, .16–.23, … |
/30 | 255.255.255.252 | 64 | 2 | 4 | .0–.3, .4–.7, .8–.11, … |
/26: 256 − 192 = 64, so subnets start at .0, .64, .128, .192.
Private (RFC 1918) Address Ranges
These ranges are not routable on the public internet. Use them freely in internal networks.
| RFC 1918 Range | CIDR | Subnet Mask | Total Addresses | Common Use |
|---|---|---|---|---|
10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | 255.0.0.0 | 16,777,216 | Enterprise, cloud VPCs |
172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | 255.240.0.0 | 1,048,576 | Mid-size networks |
192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | 255.255.0.0 | 65,536 | Home, small office |
FAQ
What is the difference between a subnet mask and CIDR notation?
/24 = 255.255.255.0. CIDR (Classless Inter-Domain Routing) notation is shorter and widely used in routing tables, firewall rules, and cloud configuration. Subnet masks are used in older interfaces and some hardware devices.How do I calculate the number of usable hosts?
What is a wildcard mask?
255.255.255.0, wildcard = 0.0.0.255. Wildcard masks are used in ACLs on Cisco devices and in OSPF configuration.