The eight subnet masks worth memorising
There are 33 valid subnet masks and you will use about eight of them. This guide is about which eight, why those, and the arithmetic that gets you any of the other 25 in a few seconds without looking anything up. The complete table, every prefix from /0 to /32, is the CIDR reference page.
Last reviewed:
Looking for the complete table instead? Every prefix from /0 to /32, with mask, wildcard and host count, is on the CIDR reference.
How to use the cheat sheet
Find the prefix you are working with in the left column, then read across for its mask and how many hosts it holds. Working the other way, if you know how many hosts you need, scan the host column for the smallest prefix that fits and use its mask.
The full sortable table, with every prefix from /0 to /32 and a copy button on each row, lives on the CIDR reference page. Each prefix also has its own page with a live calculator.
The eight, and why these eight
These are not the eight most common prefixes by count. They are the eight that each answer a question you will actually be asked: how big is a LAN, how do I halve one, how small can a link be, how big is a site block.
| Prefix | Mask | Usable hosts | What it is for |
|---|---|---|---|
| /30 | 255.255.255.252 | 2 | Point-to-point link between two routers |
| /29 | 255.255.255.248 | 6 | A small block of static IPs from a provider |
| /28 | 255.255.255.240 | 14 | A rack, a management segment, a small DMZ |
| /27 | 255.255.255.224 | 30 | A small office VLAN |
| /26 | 255.255.255.192 | 62 | A quarter of a /24, the usual first split |
| /25 | 255.255.255.128 | 126 | Half a /24 |
| /24 | 255.255.255.0 | 254 | The default LAN, and what people mean by class C |
| /16 | 255.255.0.0 | 65,534 | A site or campus supernet, subdivided before use |
A /31 is a ninth worth knowing about, though not for its host count: it is two addresses, both usable, for point-to-point links under RFC 3021. It halves the address cost of every /30 link on kit that supports it.
Getting the other 25 without a table
Two facts cover the rest. First, a prefix of /n holds 2 to the power of (32 minus n) addresses, and two fewer usable hosts. Second, each step longer halves the block, so the host counts run 254, 126, 62, 30, 14, 6, 2 downwards and 254, 510, 1022, 2046 upwards. Learn that ladder in both directions and the numbers are free.
For the mask itself, use the block size. The last non-255 octet is 256 minus the block size: a block of 64 addresses gives 256 minus 64, which is 192, so /26 is 255.255.255.192. The same works in the third octet for prefixes between /16 and /24, counting in whole /24s: a /22 is four /24s, so the third octet steps by 4 and the mask is 255.255.252.0.
That is genuinely the whole method. The reason to memorise eight rather than 33 is that the eight are the ones you need fast, and the arithmetic covers the rest quicker than looking them up would.
The numbers worth memorising
A few prefixes come up constantly. A /24 is 255.255.255.0 with 254 hosts, the default LAN. A /30 is 255.255.255.252 with 2 hosts, the classic point-to-point link. A /26 is 255.255.255.192 with 62 hosts, a common small segment. A /16 is 255.255.0.0 with 65,534 hosts, a large site block.
Learn the host counts as powers of two minus two: /24 is 2^8 - 2 = 254, /25 is 2^7 - 2 = 126, /26 is 2^6 - 2 = 62, and so on down. Once that clicks, you rarely need the sheet at all.
Frequently asked questions
What is the mask for a /26?
A /26 has the mask 255.255.255.192, with 64 addresses and 62 usable hosts.
How many hosts are in a /30?
A /30 has 4 addresses and 2 usable hosts, which is why it is used for point-to-point links.
What is the smallest subnet?
A /32 describes a single address (one host route). A /31 has two usable addresses under RFC 3021 and is used for point-to-point links.
Sources
Everything technical on this page is checkable against the documents below. Where a document and common practice disagree, the guide says so rather than picking one quietly.
- RFC 1878: Variable Length Subnet Table for IPv4
- RFC 3021: Using 31-bit prefixes on IPv4 point-to-point links
Spotted something wrong? Tell us and it gets corrected. How the data is maintained is described on the about page.