CIDR & Subnet Cheat Sheet: /8 to /32 Explained

🧮 Networking⏱️ 7 min readFree tool included

Subnetting looks like memorization until you see it's one formula: count the host bits, raise 2 to that power, subtract two. The CIDR prefix after the slash is the number of network bits; everything else follows. Here's the full table with the numbers verified, plus how to size subnets forward and backward without a calculator — though we'll give you one anyway.

Advertisement

Where do the numbers come from?

An IPv4 address is 32 bits. The prefix — say /26 — tells you 26 of those bits identify the network, which leaves 32 − 26 = 6 bits for hosts. Two to the sixth power is 64 total addresses. The first (all zeros in the host part) names the network itself and the last (all ones) is the broadcast address, so 64 − 2 = 62 usable hosts. That's the entire trick, and it explains every row of the table below.

The CIDR cheat sheet

CIDRMaskWildcardTotalUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/12255.240.0.00.15.255.2551,048,5761,048,574
/16255.255.0.00.0.255.25565,53665,534
/20255.255.240.00.0.15.2554,0964,094
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122 (RFC 3021)
/32255.255.255.2550.0.0.011

Every step down the prefix column halves the block; every step up doubles it. A /31 is the odd row: point-to-point links use both addresses under RFC 3021 since there's no need for network or broadcast identifiers on a two-host wire. A /32 is a single host route — what your firewall sees for one machine.

How do you convert a mask to dotted notation?

Write the prefix as that many 1s, pad the remaining bits with 0s, split into four octets. /26 is 11111111.11111111.11111111.11000000 — the last octet has two 1s (128 + 64 = 192), giving 255.255.255.192. The wildcard mask is the complement (flip every bit): 0.0.0.63. If you can do 128, 192, 224, 240, 248, 252, 254, 255 in your head, you can read any octet boundary mask on sight — they're just 256 minus the block size.

How do you size a subnet from a host count?

Flip the problem. Need 300 hosts? Find the smallest n where 2n − 2 ≥ 300: n = 9, because 29 = 512 and 512 − 2 = 510 usable. The prefix is 32 − 9 = /23. Need 50? 26 − 2 = 62 fits, so /26. The subnet calculator has a reverse-sizing box that does exactly this for counts up to 16,777,214, and it shows the equal-split table so you can carve a block into 2, 4, 8, or 16 subnets while you plan.

What does splitting a block look like?

Take 192.168.10.0/24 and cut it four ways. Each piece borrows 2 more network bits (22 = 4 subnets), becoming a /26 with 64 addresses:

Sixteen usable addresses of the original 254 are sacrificed to the new network and broadcast addresses of each piece (248 usable instead of 254) — that's the price of segmentation, and it's usually worth paying for isolation and smaller failure domains.

Which private range should you use?

RFC 1918 gives you three: 10.0.0.0/8 (16,777,214 usable), 172.16.0.0/12 (1,048,574 usable), and 192.168.0.0/16 (65,534 usable). The 172.16 block is the one people mis-size, because /12 is not a /16: it runs 172.16.0.0 through 172.31.255.255, sixteen contiguous /16s. A network diagram that treats 172.20.0.0 as its own naturally-bordered network will be surprised when 172.31.255.254 lands in the same subnet. Also worth knowing off-hand: 169.254.0.0/16 (link-local — the self-assigned range a device uses when DHCP fails), 100.64.0.0/10 (carrier-grade NAT), and 127.0.0.0/8 (loopback).

What about IPv6?

The same prefix arithmetic applies with 128 bits, and the reserved-address bookkeeping mostly disappears: a standard LAN gets a /64 by convention, which is so absurdly large (18,446,744,073,709,551,616 addresses) that sizing math stops mattering. The cheat-sheet era of subnetting is an IPv4 phenomenon — one more reason to keep a binary converter handy while IPv4 lingers in enterprise networks.

Subnet anything, instantly

Enter any address in CIDR or dotted-mask form and get network, broadcast, range, wildcard, host count, and a split table. Free and in-browser.

Subnet Calculator →

The bottom line

Prefix in, everything else out: 32 minus the prefix gives host bits, 2 to the host bits gives total addresses, minus two gives usable. Mask octets are 256 minus block size, wildcard is the flipped mask, and broadcast is the network with host bits set. Print the table, trust the formula, and verify anything that matters in the calculator.

Advertisement

Frequently Asked Questions

How many hosts fit in a /24?

256 total addresses minus the network and broadcast addresses = 254 usable hosts, mask 255.255.255.0. It is the classic "one office VLAN" size and the unit most cloud providers quote subnets in.

What is the difference between /24, /26, and /28?

Each step of one doubles or halves the block. A /24 has 256 addresses (254 usable), a /26 is a quarter of that — 64 addresses, 62 usable, mask 255.255.255.192 — and a /28 is 16 addresses, 14 usable, mask 255.255.255.240. Four /26s fit in a /24; sixteen /28s do.

Why do subnets lose two addresses?

IPv4 reserves the first address (all host bits zero) as the network identifier and the last (all host bits one) as the broadcast address. With n host bits you get 2n total addresses and 2n minus 2 assignable. The exceptions are /31 point-to-point links, where RFC 3021 allows both addresses to be used, and /32 host routes.

What is the smallest subnet for 300 hosts?

A /23: 512 total addresses, 510 usable, mask 255.255.254.0. A /24 only has 254 usable, which falls short. Solve 2n − 2 ≥ your host count, then subtract n from 32 to get the prefix.

Related Tools