Subnet mask cheat sheet
The whole IPv4 prefix table in one place, generated from the same code that powers the subnet calculator. Convert a mask you already have using the box below, or read the table straight off.
- CIDR prefix
- /26
- Subnet mask
- 255.255.255.192
- Wildcard mask(ACLs)
- 0.0.0.63
- Total addresses
- 64
- Usable hosts
- 62
- Relative size
- one 4th of a /24
What the prefix actually means
The number after the slash is how many leading bits of the address identify the network. Everything left over identifies the host. A /24 fixes the first 24 bits, leaving 8 bits — 256 addresses — for hosts.
Each step shorter doubles the block. That is worth internalising, because it makes the whole table something you can reconstruct rather than look up: a /23 is two /24s, a /22 is four, a /16 is 256.
The full table
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /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 |
| /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 |
| /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 |
| /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 |
Frequently asked
- Why does a /24 have 254 usable hosts and not 256?
- The first address in a block is the network address and the last is the broadcast address, and neither can be assigned to a host. That leaves 254 of the 256. The exceptions are /31, where RFC 3021 makes both addresses usable on point-to-point links, and /32, which is a single host route.
- What is a wildcard mask for?
- It is the bitwise inverse of the subnet mask, and Cisco ACLs and OSPF use it where other tools use the mask. 0.0.0.255 in a wildcard mask means the same set of addresses as 255.255.255.0 in a subnet mask — the bits set to zero are the ones that must match.
- Are subnet masks always contiguous?
- In every modern system, yes: a valid mask is some number of 1 bits followed by 1 bits only to their left, which is what lets it be written as a single prefix length. Non-contiguous masks were legal in early specifications and are now rejected — which is why 255.255.0.255 is not a mask this or any current tool will accept.
- How do I pick a prefix for N hosts?
- Find the smallest block whose usable host count is at least N, remembering the two reserved addresses. For 100 hosts you need a /25 (126 usable), not a /26 (62). Leave room: renumbering a subnet that has run out is far more work than allocating one size larger at the start.
Doing this for thousands of addresses?
These calculators run in your browser and never send us your input. When you need geolocation, ASN and network data for addresses in bulk, the API answers in one call — no key required to try it.
curl https://api.ipaddresstoday.com/api/v1/8.8.8.8Other free tools
- Subnet calculatorNetwork and broadcast address, subnet mask, wildcard mask, usable host range and host count for any IPv4 block.
- CIDR to IP rangeConvert a CIDR block to its first and last address, or collapse an arbitrary address range into the smallest set of CIDR blocks.
- IP address converterConvert an IPv4 address between dotted-quad, decimal, hexadecimal, binary and octal.
- IPv6 expand & compressExpand an IPv6 address to its full 39-character form, or compress it to the canonical RFC 5952 short form.
- IP range generatorList every address in a CIDR block or a first–last range, ready to paste into a firewall rule or a script.
- Random IP generatorGenerate random IPv4 addresses for test fixtures and load tests — optionally inside a given block, and publicly routable only.
- IP in range checkerCheck whether an address falls inside a CIDR block or a first–last range, and see how two blocks relate to each other.
- IPv4 to IPv6 converterSee an IPv4 address in every standard IPv6 form: IPv4-mapped, 6to4, NAT64 and the deprecated IPv4-compatible notation.
- Reverse DNS name generatorBuild the in-addr.arpa or ip6.arpa PTR name for any address, and list the reverse zones covering a whole block.
- IP list sorter & deduplicatorPaste a messy list of addresses from logs or a spreadsheet. Get them sorted numerically, deduplicated, with the junk separated out.
- Bulk IP lookupLook up country, city, ISP and ASN for a whole list of addresses at once, and export the result as CSV.