Subnet Mask Cheat Sheet: Every CIDR Value with Hosts, Ranges & Wildcards
If you've ever stared at a /26 and blanked on how many hosts that is, you're in good company. Subnet masks are one of those things every network engineer, DevOps practitioner, and sysadmin uses daily — but the conversion math is tedious enough that even veterans keep a reference handy.
This cheat sheet gives you everything in one place: the complete /0–/32 table, the most common subnet masks explained in plain English, commands to find your subnet mask on any OS, and a walkthrough of the binary math if you ever need to do it without a calculator.
What Is a Subnet Mask?
A subnet mask is a 32-bit number that divides an IP address into two parts: the network portion and the host portion. It works alongside an IP address to define which addresses belong to the same local network.
Written in dotted-decimal notation, a subnet mask looks like an IP address:
255.255.255.0 (common for home and small office networks)
255.255.255.128
255.255.0.0
But subnet masks always follow a strict pattern: all the 1s come first, all the 0s come after. There's no interleaving.
255.255.255.0 in binary:
11111111.11111111.11111111.00000000
|-------- network bits ---------|--- host bits ---|
The number of leading 1-bits is the prefix length — what you see in CIDR notation after the slash. A /24 means 24 bits are network bits, leaving 8 bits for hosts.
Why subnets exist: Without subnetting, every device on the internet would need to be on one giant flat network, and routers would need to track every individual IP. Subnetting lets you carve address space into smaller, manageable chunks — security zones, VLANs, cloud VPCs, and department networks are all defined by subnets.
The Complete Subnet Mask Cheat Sheet (/0–/32)
| CIDR | Subnet Mask | Wildcard | Total Addresses | Usable Hosts | Notes |
|---|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 | Entire IPv4 address space |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 | Half of IPv4 space |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 | |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 | |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 | |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 | |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 | |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 | |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | Class A |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 | |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 | |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 | |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 | |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 | |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 | |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | Class B |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | Class C — most common |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | Half of a /24 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | Quarter of a /24 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | Small office VLAN |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | Point-to-point links |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | Router-to-router links |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | Point-to-point (RFC 3021) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | Single host / loopback |
Usable hosts = Total addresses − 2 (network address and broadcast address are reserved). Exception: /31 and /32 don't follow this rule — /31 is defined for point-to-point links (RFC 3021), and /32 refers to a single host.
The Most Common Subnet Masks Explained
While the full table is handy, most real-world subnetting uses a small set of prefix lengths. Here's what you actually encounter:
/8 — Large Private Network (10.0.0.0/8)
- Mask: 255.0.0.0
- Hosts: 16,777,214
- Used for: Large enterprises, cloud provider internal networks (AWS VPCs default to /16, but the RFC 1918 range is /8), carrier-grade NAT
/16 — Medium Network (172.16.0.0/16, 192.168.0.0/16)
- Mask: 255.255.0.0
- Hosts: 65,534
- Used for: Mid-size corporate networks, Kubernetes pod CIDR, Docker's default bridge network
/24 — The Default "Class C"
- Mask: 255.255.255.0
- Hosts: 254
- Used for: Almost everything — home networks, small offices, cloud subnets, individual VLANs
- The most familiar subnet:
192.168.1.0/24gives you.1through.254
/25 — Split a /24 in Half
- Mask: 255.255.255.128
- Hosts: 126 per subnet
- Used for: Separating a segment into two (public vs private, two floors, two departments)
- First half:
.0–.127, second half:.128–.255
/26 — Quarter of a /24
- Mask: 255.255.255.192
- Hosts: 62 per subnet
- Used for: Small server subnets, DMZs, cloud availability zones
- Gives four subnets from a /24:
.0,.64,.128,.192
/27 — 30 Hosts
- Mask: 255.255.255.224
- Hosts: 30 per subnet
- Used for: Small branch offices, individual cloud VLANs, management networks
/28 — 14 Hosts
- Mask: 255.255.255.240
- Hosts: 14 per subnet
- Used for: Firewall DMZ zones, small server clusters, AWS Load Balancer subnets (require /28 or larger)
/29 — 6 Hosts
- Mask: 255.255.255.248
- Hosts: 6 per subnet
- Used for: Hosting a small number of servers, ISP-assigned ranges for customer links
/30 — 2 Hosts (Point-to-Point)
- Mask: 255.255.255.252
- Hosts: 2 per subnet
- Used for: Router-to-router WAN links, where you only need two endpoints
- Classic use: each end of a leased line gets one IP
/32 — Single Host
- Mask: 255.255.255.255
- Hosts: 1
- Used for: Static routes to a specific host, firewall rules targeting one IP, loopback addresses
How to Find Your Subnet Mask
Windows
ipconfig
Look for the "Subnet Mask" line under your active adapter:
Ethernet adapter Ethernet:
IPv4 Address. . . : 192.168.1.45
Subnet Mask . . . : 255.255.255.0
Default Gateway . : 192.168.1.1
For more detail including CIDR notation:
Get-NetIPAddress -AddressFamily IPv4 | Select-Object InterfaceAlias, IPAddress, PrefixLength
Linux
# Show all interfaces with CIDR notation
ip addr show
# Or just the main interface
ip addr show eth0
Output example:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP>
inet 10.0.1.5/24 brd 10.0.1.255 scope global eth0
The /24 is your prefix length. Convert it to dotted-decimal using the cheat sheet above.
# Legacy command (still works on most systems)
ifconfig eth0
macOS
ifconfig en0 | grep inet
Output:
inet 192.168.1.45 netmask 0xffffff00 broadcast 192.168.1.255
The netmask 0xffffff00 in hex = 255.255.255.0 in dotted-decimal = /24 in CIDR.
To convert hex netmask to dotted-decimal: each hex pair is one octet (ff = 255, 00 = 0).
Cloud / Infrastructure
AWS EC2:
# Instance metadata service
curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/<mac>/subnet-ipv4-cidr-block
Docker container:
docker inspect <container_name> | grep -i subnet
Kubernetes pod:
kubectl get pod <pod-name> -o jsonpath='{.status.podIP}'
# Subnet comes from the CNI plugin — check your node's CIDR
kubectl get node <node-name> -o jsonpath='{.spec.podCIDR}'
How to Calculate Subnets Without a Calculator
If you need to work out subnet boundaries in your head (or in an interview), here's the method:
Step 1: Find the Block Size
The block size is the number of addresses in each subnet. It's 256 − the last non-255 octet of the mask.
Examples:
255.255.255.0→ block size = 256 − 0 = 256 (the /24)255.255.255.128→ block size = 256 − 128 = 128 (the /25)255.255.255.192→ block size = 256 − 192 = 64 (the /26)255.255.255.224→ block size = 256 − 224 = 32 (the /27)255.255.255.240→ block size = 256 − 240 = 16 (the /28)255.255.255.248→ block size = 256 − 248 = 8 (the /29)255.255.255.252→ block size = 256 − 252 = 4 (the /30)
Step 2: Find Which Subnet an IP Belongs To
Divide the host octet by the block size and round down. Multiply back to get the network address.
Example: What subnet does 10.0.0.75 belong to with a /26 mask?
- Block size = 256 − 192 = 64
- 75 ÷ 64 = 1 (round down)
- Network address = 1 × 64 = 64 → subnet is
10.0.0.64/26 - Broadcast = 64 + 64 − 1 = 127 →
10.0.0.127 - Usable hosts:
10.0.0.65to10.0.0.126
Step 3: List All Subnets
Start at 0, keep adding the block size until you reach 256:
For /27 (block size 32) within 192.168.1.0/24:
192.168.1.0/27 → hosts .1–.30, broadcast .31
192.168.1.32/27 → hosts .33–.62, broadcast .63
192.168.1.64/27 → hosts .65–.94, broadcast .95
192.168.1.96/27 → hosts .97–.126, broadcast .127
192.168.1.128/27 → hosts .129–.158, broadcast .159
192.168.1.160/27 → hosts .161–.190, broadcast .191
192.168.1.192/27 → hosts .193–.222, broadcast .223
192.168.1.224/27 → hosts .225–.254, broadcast .255
Eight /27 subnets fit inside one /24. That's always true: each step down in prefix adds one bit, which doubles the number of subnets and halves the hosts per subnet.
IP Subnet Cheat Sheet: Quick Reference
| Prefix | Mask | Hosts | Fits inside /24 |
|---|---|---|---|
| /24 | 255.255.255.0 | 254 | 1 |
| /25 | 255.255.255.128 | 126 | 2 |
| /26 | 255.255.255.192 | 62 | 4 |
| /27 | 255.255.255.224 | 30 | 8 |
| /28 | 255.255.255.240 | 14 | 16 |
| /29 | 255.255.255.248 | 6 | 32 |
| /30 | 255.255.255.252 | 2 | 64 |
| /32 | 255.255.255.255 | 1 | 256 |
Common Subnetting Mistakes
Forgetting network and broadcast addresses are not usable. A /28 has 16 total addresses but only 14 usable. If you assign .0 or .15 to a host, things break.
Overlapping subnets in routing tables. If 10.0.1.0/24 and 10.0.0.0/16 both exist in your routing table, traffic to 10.0.1.5 can match both. Most routers use longest-prefix match (the /24 wins), but misconfigured firewall rules often don't — leading to traffic bypassing security controls.
Using /30 when you mean /29. It's a common off-by-one error. A /30 gives 2 usable hosts (router-to-router). If you need 6 hosts, you need /29, not /30.
Forgetting that AWS subnets reserve 5 addresses (not 2). AWS reserves the first four IPs and the last IP in every subnet for internal use. A /28 in AWS gives you only 11 usable addresses, not 14.
Misreading CIDR when it spans octets. A /17 isn't just "half of the last two octets" — it means 17 bits of network, which puts the boundary mid-way through the third octet. Use the cheat sheet or a calculator for anything above /24.
Calculate Subnets Instantly
Rather than doing the binary math manually, use our Subnet Calculator to instantly find the network address, broadcast address, usable host range, and number of hosts for any IP and prefix length. The CIDR Calculator shows you how CIDR blocks relate to each other and whether two ranges overlap.
For understanding how IP addresses look in binary — which makes subnetting clicks — try our IP to Binary converter.
Summary
- A subnet mask defines which part of an IP address is the network and which part is the host
- CIDR notation (
/24,/26) is shorthand for the number of network bits - Usable hosts = 2^(host bits) − 2 (minus network and broadcast addresses)
- The most common subnets: /24 (254 hosts), /25 (126), /26 (62), /27 (30), /28 (14), /29 (6), /30 (2)
- Block size = 256 − last non-255 mask octet — this is the key to mental subnetting
- Cloud providers often reserve extra addresses beyond the standard 2