CIDR Notation and Subnet Masks: A Practical Cheat Sheet
Short answer: in CIDR notation, 192.168.1.0/24 means "the first 24 bits are the network, the remaining 8 bits are for hosts". A /n prefix leaves 32 − n host bits, so the block holds 2^(32−n) addresses. Type any address and prefix into the IPv4 & IPv6 Subnet Calculator to get the network, mask, broadcast, usable host range and address count at once.
What the slash means
An IPv4 address is 32 bits. The number after the slash says how many of those bits identify the network. The rest identify a host inside it. /24 is the same thing as the netmask 255.255.255.0: 24 ones followed by 8 zeros.
Think of it as a street name and a house number. The prefix is the street, and the host bits are the houses on it. A longer prefix means a shorter street.
The cheat sheet
| Prefix | Netmask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 512 | 510 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 (point-to-point, RFC 3021) |
| /32 | 255.255.255.255 | 1 | 1 (a single host) |
Usable hosts are the total minus two: the network address (all host bits zero) and the broadcast address (all host bits one). A /31 has no separate network and broadcast, which is why both of its addresses are usable on a point-to-point link. Cloud providers often reserve a few more addresses in every subnet (AWS reserves five), so check your provider's rules before you size a subnet.
Private ranges you will meet constantly
RFC 1918 reserves three blocks for private networks:
10.0.0.0/8172.16.0.0/12(that is 172.16.0.0 to 172.31.255.255)192.168.0.0/16
The calculator tells you whether an address is private and whether it is loopback. An A record in DNS holds an IP address like these (see DNS records explained).
A worked example
172.16.5.4/12 looks like a host inside a /12. It is not a network address, so the calculator masks the host bits and reports the network 172.16.0.0/12, broadcast 172.31.255.255 and 1,048,574 usable hosts. This is a common source of firewall mistakes: the address you wrote is not the one the rule actually covers.
Splitting a network
Need smaller pieces? Pick a longer prefix. 192.168.0.0/24 split into /26 gives four subnets with 62 usable hosts each:
192.168.0.0/26 192.168.0.64/26
192.168.0.128/26 192.168.0.192/26
Summarizing blocks (route and firewall tidy-up)
Summarizing merges blocks into the fewest exact ones. 10.0.0.0/24, 10.0.1.0/24 and 10.0.2.0/24 become 10.0.0.0/23 plus 10.0.2.0/24, because three /24 blocks cannot form a single block. The result covers exactly the addresses you listed and nothing else, which is what you want in a firewall rule.
Comparing two ranges
Before you add a rule or a route (for firewall commands, see how to check a shell command before running it), check how two blocks relate. 10.0.0.0/16 and 10.0.5.0/24 give "A contains B". The calculator also reports equal, partly overlapping and disjoint ranges.
Wildcard masks
Cisco-style ACLs use a wildcard mask, which is the netmask inverted. The wildcard mask for /24 is 0.0.0.255. The calculator shows it next to the netmask.
IPv6 in a few lines
IPv6 addresses are 128 bits and follow the same prefix idea. 2001:db8::/32 is a block, and the tool shows it in compressed and fully expanded form together with the first and last address. The size of such blocks (2^96 addresses for a /32) is too large to list, so the tool shows it as a power of two. As a rule of thumb, most IPv6 LAN subnets are a /64. The calculator's scope label (link-local, unique local or global) is only a hint.
How to work out CIDR notation with the Subnet Calculator
- Open the IPv4 & IPv6 Subnet Calculator.
- Enter an address with a prefix, such as
192.168.1.10/24or2001:db8::/32. - Read the network, netmask, wildcard mask, broadcast, usable range and total addresses.
- Split: choose a longer prefix and select "List subnets".
- Summarize: paste one block per line, IPv4 and IPv6 mixed. Lines that cannot be parsed are listed separately.
- Compare: enter two ranges to see whether they overlap.
To read the binary behind a mask or an octet, use the Number Base Converter.
Limits to know
- Input is an address with an optional prefix such as
/24. A dotted netmask like10.0.0.1/255.255.255.0is not accepted: convert it first (255.255.255.0is/24). - Splitting is IPv4 only. It needs a longer prefix than the current one, and the list stops at 1,024 subnets.
- The historic address class and the IPv6 scope are hints. Reason with the prefix, not the class.
- Nothing is uploaded.
Frequently asked questions
What does /24 mean?
The first 24 bits are the network. It equals the mask 255.255.255.0 and holds 256 addresses, 254 usable.
How many hosts are in a /26? 64 addresses in total and 62 usable.
Why do usable hosts subtract two? One address is the network address and one is the broadcast address.
What is a /32? A single host, with no separate network or broadcast address.
What is the difference between a subnet mask and a wildcard mask? The wildcard mask is the subnet mask inverted, used by some ACL syntaxes.
Is 172.16.0.1 a private address?
Yes. It sits inside 172.16.0.0/12.
Related tools and guides
- Number Base Converter for the binary view of a mask
- URL Parser when an IP and port sit inside a URL (see URL encoding)
- DNS Analyzer
- Unix Timestamp Converter
- Shell Command Risk Explainer: firewall commands that open a whole range deserve a second look