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 in a subnet | 2^(32−26) − 2 = 62 |
| Number of subnets | 2^(borrowed bits) |
How many subnets are created when splitting a network | Splitting /24 → /26 = 2^2 = 4 |
| Block size | 256 − mask octet |
The 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 | P2P |
/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 |
/7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 | |
/6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 | |
/5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 | |
/4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 | |
/3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 | |
/2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 | |
/1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 | |
/0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 |
* /31 uses both addresses for hosts per RFC 3021 (point-to-point links only).
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
Example: /20 = 255.255.240.0
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 |
IPv4 Address Classes
Classful addressing is mostly historical, but understanding classes helps when reading legacy documentation or preparing for certifications.
| Class | First Octet Range | Default Mask | CIDR | Networks | Hosts/Net | Purpose |
|---|---|---|---|---|---|---|
| A | 1 – 126 | 255.0.0.0 | /8 | 126 | 16,777,214 | Large orgs |
| B | 128 – 191 | 255.255.0.0 | /16 | 16,384 | 65,534 | Medium orgs |
| C | 192 – 223 | 255.255.255.0 | /24 | 2,097,152 | 254 | Small orgs |
| D | 224 – 239 | — | — | — | — | Multicast |
| E | 240 – 255 | — | — | — | — | Reserved |
127.0.0.0/8 is reserved for loopback. 0.0.0.0/8 is used for “this network” in routing contexts. Neither is assignable.
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 | Class | Common Use |
|---|---|---|---|---|---|
10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | 255.0.0.0 | 16,777,216 | A | Enterprise, cloud VPCs |
172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | 255.240.0.0 | 1,048,576 | B | Mid-size networks |
192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | 255.255.0.0 | 65,536 | C | Home, small office |
Other Special Address Ranges
| Range | CIDR | Purpose | RFC |
|---|---|---|---|
127.0.0.0/8 | /8 | Loopback | RFC 1122 |
169.254.0.0/16 | /16 | Link-local (APIPA) | RFC 3927 |
100.64.0.0/10 | /10 | Carrier-grade NAT (CGN) | RFC 6598 |
192.0.2.0/24 | /24 | Documentation (TEST-NET-1) | RFC 5737 |
198.51.100.0/24 | /24 | Documentation (TEST-NET-2) | RFC 5737 |
203.0.113.0/24 | /24 | Documentation (TEST-NET-3) | RFC 5737 |
198.18.0.0/15 | /15 | Benchmarking | RFC 2544 |
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.
VLSM — Variable Length Subnet Masking
VLSM lets you assign different prefix lengths to different segments, avoiding wasted address space. Always allocate the largest subnet first.
Practical Example
Given: 192.168.10.0/24. Requirements: Engineering (50 hosts), Sales (25 hosts), Management (10 hosts), WAN link (2 hosts).
| Segment | Hosts Needed | Prefix | Assigned Subnet | Usable Range | Broadcast |
|---|---|---|---|---|---|
| Engineering | 50 | /26 | 192.168.10.0/26 | .1 – .62 | .63 |
| Sales | 25 | /27 | 192.168.10.64/27 | .65 – .94 | .95 |
| Management | 10 | /28 | 192.168.10.96/28 | .97 – .110 | .111 |
| WAN Link | 2 | /30 | 192.168.10.112/30 | .113 – .114 | .115 |
192.168.10.116/30 through 192.168.10.255 is still available for future growth.
Supernetting (Route Aggregation)
Supernetting combines multiple contiguous networks into a single larger CIDR block. This reduces routing table size.
Example: Aggregating 4 × /24 Networks
| Network | Binary (3rd octet) |
|---|---|
10.1.0.0/24 | 00000000 |
10.1.1.0/24 | 00000001 |
10.1.2.0/24 | 00000010 |
10.1.3.0/24 | 00000011 |
First 22 bits are identical → Summary route: 10.1.0.0/22
IPv6 Subnetting Quick Reference
IPv6 uses 128-bit addresses. The standard interface prefix for SLAAC is /64 — this is not optional on most LANs.
| Prefix | Typical Use | Available /64 Subnets |
|---|---|---|
/128 | Single host (loopback) | — |
/64 | Standard LAN subnet | 1 |
/56 | End-site allocation (residential ISP) | 256 |
/48 | Standard site allocation | 65,536 |
/32 | ISP allocation | 4,294,967,296 |
Common IPv6 Prefixes
| Prefix | Purpose |
|---|---|
::1/128 | Loopback |
::/0 | Default route |
fe80::/10 | Link-local |
fc00::/7 | Unique local (ULA — like RFC 1918) |
2000::/3 | Global unicast (public) |
ff00::/8 | Multicast |
Powers of 2 — Quick Lookup
You need these constantly when calculating subnets and host counts. Worth memorizing up to 2¹⁶.
| 2ⁿ | Value | 2ⁿ | Value |
|---|---|---|---|
| 2⁰ | 1 | 2⁹ | 512 |
| 2¹ | 2 | 2¹⁰ | 1,024 |
| 2² | 4 | 2¹¹ | 2,048 |
| 2³ | 8 | 2¹² | 4,096 |
| 2⁴ | 16 | 2¹³ | 8,192 |
| 2⁵ | 32 | 2¹⁴ | 16,384 |
| 2⁶ | 64 | 2¹⁵ | 32,768 |
| 2⁷ | 128 | 2¹⁶ | 65,536 |
| 2⁸ | 256 | 2²⁴ | 16,777,216 |
Step-by-Step: How to Subnet
Follow these steps to subnet any network from scratch.
Step 1 — Determine host requirements
List all network segments and how many hosts each one needs.
Step 2 — Find the right prefix length
For each segment, find the smallest n where 2ⁿ − 2 ≥ required hosts. The prefix is 32 − n.
Step 3 — Calculate network details
- Block size = 2n (where n = host bits)
- Network address = first address in the block
- First usable = network address + 1
- Last usable = broadcast − 1
- Broadcast = last address in the block
Step 4 — Verify
- No overlapping ranges between subnets
- Host count ≥ requirement for each segment
- All subnets fit within the original network
Worked Example: 192.168.1.0/26
FAQ
What is the difference between a subnet mask and a wildcard mask?
255.255.255.192 → wildcard 0.0.0.63.
When should I use /31 vs /30 for point-to-point links?
/30 gives you 4 addresses (2 usable) — the traditional choice. /31 (RFC 3021) gives you 2 addresses with both usable, saving address space. Most modern routers support /31. Use /31 when both endpoints support it; use /30 for legacy equipment.
What is CIDR notation?
/24 means the first 24 bits identify the network. CIDR replaced classful addressing (A/B/C) to allow more flexible allocation of IP address space. A /24 is equivalent to the old Class C subnet mask 255.255.255.0.
Why is /64 the standard for IPv6 LANs?
/64 on a LAN breaks SLAAC. This is by design — IPv6 has enough address space that conserving at the subnet level is unnecessary.
How do I quickly find the network address from an IP and prefix?
192.168.1.200/26: block size = 64, so 200 ÷ 64 = 3.125 → 3 × 64 = 192. Network address = 192.168.1.192.
