Every IPv4 prefix from /0 to /32 in one searchable table: dotted subnet mask, wildcard mask, binary and hex, total addresses and usable hosts, with notes on classful and special ranges. Click any row for the block size, example subnets and more.
Last updated:
CIDR
Subnet mask
Binary
Hex
Wildcard
Addresses
Usable hosts
Notes
No prefix matches that filter.
Advertisement
Advertisement
How to use the Subnet Mask Cheat Sheet
Scan the table or type a prefix, mask, wildcard or host count into Filter.
Narrow the view with Show: class A, B or C ranges, or only the most used prefixes.
Enter Hosts needed and press Find mask to jump to the smallest prefix that fits.
Click a row (or use the arrow keys and Enter) to see binary bits, block size and example subnets.
Download the CSV or copy the table to keep a printable cheat sheet.
How to read a subnet mask
An IPv4 subnet mask is 32 bits: a run of 1s for the network part followed by 0s for the host part. The CIDR prefix simply counts the 1s. Because the 1s are always contiguous, each octet of a mask can only be one of nine values:
Octet value
Binary
1-bits
Block size (256 − value)
0
00000000
0
256
128
10000000
1
128
192
11000000
2
64
224
11100000
3
32
240
11110000
4
16
248
11111000
5
8
252
11111100
6
4
254
11111110
7
2
255
11111111
8
1
Subnetting shortcuts
Addresses = 232 − prefix. Each step of the prefix halves (or doubles) the size.
Block size in the interesting octet = 256 − mask value. Network addresses are multiples of the block size.
Broadcast = next network address − 1. First host = network + 1, last host = broadcast − 1.
Wildcard = 255 − each mask octet.
Example: which subnet does 172.16.45.200/27 belong to? The mask is 255.255.255.224, block size 32. 200 lies between 192 and 224, so the network is 172.16.45.192, the broadcast 172.16.45.223 and the hosts .193 to .222.
Special IPv4 blocks worth memorising
Block
Purpose
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
Private networks (RFC 1918)
100.64.0.0/10
Carrier-grade NAT shared space (RFC 6598)
127.0.0.0/8
Loopback
169.254.0.0/16
Link-local (automatic addressing)
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24
Documentation examples (RFC 5737)
224.0.0.0/4
Multicast
240.0.0.0/4
Reserved (former Class E)
Frequently asked questions
How many hosts are in each subnet?
A prefix /n has 2^(32 − n) addresses; subtract 2 for the network and broadcast addresses to get usable hosts. So /24 has 254 usable hosts, /26 has 62, /28 has 14 and /30 has 2. /31 (2 hosts on point-to-point links) and /32 (1 host) are exceptions.
How do I convert a CIDR prefix to a subnet mask?
Write n one-bits followed by 32 − n zero-bits and convert each group of 8 bits to decimal. /20 is 11111111.11111111.11110000.00000000, which is 255.255.240.0. The only octet values a mask can contain are 0, 128, 192, 224, 240, 248, 252, 254 and 255.
What is the block size of a subnet?
It is 256 minus the mask value in the interesting octet, the last octet that is not 255. For 255.255.255.224 the block size is 32, so networks start at .0, .32, .64, .96 and so on. This is the quickest way to subnet in your head.
What are the classful default masks?
Class A (first octet 1-126) used 255.0.0.0 (/8), Class B (128-191) used 255.255.0.0 (/16) and Class C (192-223) used 255.255.255.0 (/24). Classful addressing was replaced by CIDR in 1993, but the terms are still used to describe network sizes.
What is a wildcard mask in the table?
The wildcard mask is the subnet mask with every bit inverted, i.e. 255.255.255.255 minus the mask. Cisco ACLs and OSPF network statements use it, so /24 appears as 0.0.0.255.
Which subnet sizes are used most?
/24 for typical LANs, /25 to /28 for smaller VLANs and server segments, /29 for small static IP blocks, /30 or /31 for router-to-router links, /32 for host routes and loopbacks, and /16 or larger for whole private address plans.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.