Binary math, CIDR notation, address classes, subnet calculation, and VLSM — everything in one reference.
Every IPv4 address is 32 bits — written as four 8-bit octets in dotted-decimal notation.
A subnet mask divides the 32 bits into a network portion and a host portion.
Private addresses are not routable on the public internet. NAT translates them to a public IP at the network edge.
| CIDR | Subnet Mask | Wildcard | Hosts/Subnet | Subnets (from /24) | Last Octet Increment | Common Use |
|---|---|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,214 | — | — | Class A network |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,606 | — | — | Large ISP block |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,302 | — | — | CGN / RFC 6598 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,574 | — | — | 172.16 private |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,534 | 1 | 256 | Class B / data center |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,766 | 2 | 128 | Large campus |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,382 | 4 | 64 | Campus segment |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,190 | 8 | 32 | Building block |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,094 | 16 | 16 | Large VLAN |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,046 | 32 | 8 | Medium VLAN |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,022 | 64 | 4 | Server farm |
| /23 | 255.255.254.0 | 0.0.1.255 | 510 | 128 | 2 | Merged /24s |
| /24 | 255.255.255.0 | 0.0.0.255 | 254 | 256 | 1 | Standard LAN ★ |
| /25 | 255.255.255.128 | 0.0.0.127 | 126 | 2 | 128 | Half a /24 |
| /26 | 255.255.255.192 | 0.0.0.63 | 62 | 4 | 64 | Small segment |
| /27 | 255.255.255.224 | 0.0.0.31 | 30 | 8 | 32 | Small team LAN |
| /28 | 255.255.255.240 | 0.0.0.15 | 14 | 16 | 16 | DMZ / mgmt VLAN |
| /29 | 255.255.255.248 | 0.0.0.7 | 6 | 32 | 8 | Small server group |
| /30 | 255.255.255.252 | 0.0.0.3 | 2 | 64 | 4 | Point-to-point link ★ |
| /31 | 255.255.255.254 | 0.0.0.1 | 2* | 128 | 2 | P2P (RFC 3021) — no broadcast |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 256 | 1 | Host route / loopback |
| # | Network Addr | First Host | Last Host | Broadcast |
|---|---|---|---|---|
| 1 | 192.168.10.0/26 | 192.168.10.1 | 192.168.10.62 | 192.168.10.63 |
| 2 | 192.168.10.64/26 | 192.168.10.65 | 192.168.10.126 | 192.168.10.127 |
| 3 | 192.168.10.128/26 | 192.168.10.129 | 192.168.10.190 | 192.168.10.191 |
| 4 | 192.168.10.192/26 | 192.168.10.193 | 192.168.10.254 | 192.168.10.255 |
VLSM allows subnets of different sizes within the same address space — eliminating waste by right-sizing each segment. Used in almost all modern networks.
| Dept | Need | Prefix | Network | Range | Hosts |
|---|---|---|---|---|---|
| Sales | 100 | /25 | 10.0.0.0 | .1 – .126 | 126 |
| IT | 50 | /26 | 10.0.0.128 | .129 – .190 | 62 |
| Mgmt | 20 | /27 | 10.0.0.192 | .193 – .222 | 30 |
| WAN Link | 2 | /30 | 10.0.0.224 | .225 – .226 | 2 |
| Unused / Reserved | 10.0.0.228 | .228 – .255 | 28 | ||
| Decimal | Binary | Used in Mask? | Host Bits Remaining | Prefix Contribution |
|---|---|---|---|---|
| 0 | 00000000 | Yes (host octet) | 8 | +0 |
| 128 | 10000000 | Yes | 7 | +1 |
| 192 | 11000000 | Yes | 6 | +2 |
| 224 | 11100000 | Yes | 5 | +3 |
| 240 | 11110000 | Yes | 4 | +4 |
| 248 | 11111000 | Yes | 3 | +5 |
| 252 | 11111100 | Yes | 2 | +6 |
| 254 | 11111110 | Yes | 1 | +7 |
| 255 | 11111111 | Yes (net octet) | 0 | +8 |
256 − mask_octet. For /26 → 256−192 = 64. Subnets land on multiples of 64./30 (2 usable hosts) in traditional setups, or /31 per RFC 3021 on modern routers — saves addresses on WAN links./22. The block must start on a boundary.10.0.0.64/26 is valid (64 ÷ 64 = 1). 10.0.0.70/26 is NOT (70 is not a multiple of 64)./24 → 0.0.0.255. Used in Cisco ACLs and OSPF network statements to match ranges.240.0