Network
Subnet Mask Cheat Sheet
Every IPv4 prefix with its subnet mask, wildcard mask and host count, plus the octet values, reserved ranges and IPv6 sizes you need when planning a network. To work out a specific address, use the subnet calculator.
IPv4 subnet masks, /0 to /32
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts | Common use |
|---|---|---|---|---|---|
| First octet /0–/8. The mask changes in the first number. | |||||
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,29616,777,216 × /24 | 4,294,967,294 | |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,6488,388,608 × /24 | 2,147,483,646 | |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,8244,194,304 × /24 | 1,073,741,822 | |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,9122,097,152 × /24 | 536,870,910 | |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,4561,048,576 × /24 | 268,435,454 | |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728524,288 × /24 | 134,217,726 | |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864262,144 × /24 | 67,108,862 | |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432131,072 × /24 | 33,554,430 | |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,21665,536 × /24 | 16,777,214 | Largest private block (10.0.0.0/8) |
| Second octet /9–/16. The mask changes in the second number. | |||||
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,60832,768 × /24 | 8,388,606 | |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,30416,384 × /24 | 4,194,302 | Carrier-grade NAT (100.64.0.0/10) |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,1528,192 × /24 | 2,097,150 | |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,5764,096 × /24 | 1,048,574 | Private block 172.16.0.0/12 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,2882,048 × /24 | 524,286 | |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,1441,024 × /24 | 262,142 | |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072512 × /24 | 131,070 | |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536256 × /24 | 65,534 | 192.168.0.0/16; largest AWS VPC |
| Third octet /17–/24. The mask changes in the third number. | |||||
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768128 × /24 | 32,766 | |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,38464 × /24 | 16,382 | |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,19232 × /24 | 8,190 | |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,09616 × /24 | 4,094 | Default subnet size in an AWS default VPC |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,0488 × /24 | 2,046 | |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,0244 × /24 | 1,022 | Medium site or campus VLAN |
| /23 | 255.255.254.0 | 0.0.1.255 | 5122 × /24 | 510 | |
| /24 | 255.255.255.0 | 0.0.0.255 | 2561 × /24 | 254 | Typical LAN; smallest block routed on the internet |
| Fourth octet /25–/32. Subnets smaller than a /24. | |||||
| /25 | 255.255.255.128 | 0.0.0.127 | 1281/2 of a /24 | 126 | |
| /26 | 255.255.255.192 | 0.0.0.63 | 641/4 of a /24 | 62 | Small VLAN or DMZ |
| /27 | 255.255.255.224 | 0.0.0.31 | 321/8 of a /24 | 30 | |
| /28 | 255.255.255.240 | 0.0.0.15 | 161/16 of a /24 | 14 | Smallest AWS VPC subnet |
| /29 | 255.255.255.248 | 0.0.0.7 | 81/32 of a /24 | 6 | Small static IP block from an ISP; smallest Azure subnet |
| /30 | 255.255.255.252 | 0.0.0.3 | 41/64 of a /24 | 2 | Point-to-point link (classic) |
| /31 | 255.255.255.254 | 0.0.0.1 | 21/128 of a /24 | 2 | Point-to-point link without wasted addresses (RFC 3021) |
| /32 | 255.255.255.255 | 0.0.0.0 | 11/256 of a /24 | 1 | A single host; loopback or a firewall rule for one IP |
Usable hosts leave out the network and broadcast addresses. A /31 keeps both for point-to-point links, and a /32 is one address.
Mask values in one octet
| Bits | Value | Binary | Wildcard | Block size |
|---|---|---|---|---|
| 0 | 0 | 00000000 | 255 | 256 |
| 1 | 128 | 10000000 | 127 | 128 |
| 2 | 192 | 11000000 | 63 | 64 |
| 3 | 224 | 11100000 | 31 | 32 |
| 4 | 240 | 11110000 | 15 | 16 |
| 5 | 248 | 11111000 | 7 | 8 |
| 6 | 252 | 11111100 | 3 | 4 |
| 7 | 254 | 11111110 | 1 | 2 |
| 8 | 255 | 11111111 | 0 | 1 |
Block size is the step between subnets in that octet. With 255.255.255.224 (/27), networks start at .0, .32, .64 and so on.
Private and reserved ranges
| Block | Used for | Defined in |
|---|---|---|
| 10.0.0.0/8 | Private network | RFC 1918 |
| 172.16.0.0/12 | Private network (172.16.0.0 – 172.31.255.255) | RFC 1918 |
| 192.168.0.0/16 | Private network | RFC 1918 |
| 100.64.0.0/10 | Carrier-grade NAT (shared address space) | RFC 6598 |
| 127.0.0.0/8 | Loopback | RFC 1122 |
| 169.254.0.0/16 | Link-local; cloud metadata at 169.254.169.254 | RFC 3927 |
| 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 | RFC 5771 |
| fc00::/7 | IPv6 unique local (the private range) | RFC 4193 |
| fe80::/10 | IPv6 link-local | RFC 4291 |
| 2001:db8::/32 | IPv6 documentation | RFC 3849 |
IPv6 prefix sizes
| Prefix | Contains | Addresses | Typical use |
|---|---|---|---|
| /32 | 65,536 /48s | 296 | Typical allocation from a registry to an ISP |
| /48 | 65,536 /64s | 280 | One organisation or site |
| /56 | 256 /64s | 272 | Common delegation to a home or small business |
| /60 | 16 /64s | 268 | Smaller home delegation some ISPs use |
| /64 | 1 LAN | 264 | A single network segment; SLAAC requires exactly /64 |
| /127 | 2 addresses | 21 | Point-to-point link between routers (RFC 6164) |
| /128 | 1 address | 20 | A single host or loopback |
Related tools
3 tools
Subnet Calculator
Calculate IP subnet ranges, network address, broadcast, subnet mask, wildcard mask and usable hosts from any CIDR notation
CIDR Aggregator
Merge a list of IPs, ranges and CIDR blocks into the fewest CIDRs, find duplicates and overlaps, and export nginx, Apache, iptables or nftables rules
WireGuard AllowedIPs Calculator
Route everything through WireGuard except your LAN, an IP or any subnet: subtracts CIDR ranges and returns the exact AllowedIPs line
Frequently asked questions
5 Q&A
Count the 1-bits in the mask. Each 255 is 8 bits, and the octet table on this page gives the rest:
255.255.240.0 is 8 + 8 + 4 = /20.2(32 − prefix) − 2, because the first address is the network and the last is the broadcast. The exceptions are /31, which has 2 usable addresses on point-to-point links, and /32, a single address.
The subnet mask inverted: every 255 becomes 0 and every 0 becomes 255. Cisco ACLs and OSPF use it. The wildcard for
255.255.255.0 is 0.0.0.255.Stateless address autoconfiguration (SLAAC) builds each host’s address from a 64-bit interface identifier, so a LAN prefix must be exactly /64. Shorter prefixes are for grouping LANs, not for a single segment.