Notes › Tech Notes › How many hosts fit in a /22? Host bits, network and broadcast addresses

How many hosts fit in a /22? Host bits, network and broadcast addresses

I was setting up the network for an office and had the 192.168.0.0 block to work with, with more than three hundred devices to connect. The subnet mask field in the router admin panel is where most people just type 255.255.255.0 because it looks familiar. But a /24 block connects fewer machines than 256, and moving to /22 jumps the count by a long way. The arithmetic in between takes two subtractions.

What the number after the slash counts

An IPv4 address is 32 bits. /24 means the first 24 bits identify the network and the remaining 8 bits identify the host. The number of addresses you can encode is 2 to the power of the remaining bits: /24 is 2 to the 8th, or 256; /22 leaves 10 bits, which is 1024; /27 leaves 5 bits, which is 32. Writing the mask the other way round means turning that many leading 1s into four decimal octets: /24 gives 255.255.255.0 and /22 gives 255.255.252.0.

Why 256 addresses only connect 254 hosts

Because the first and last address in every block are reserved: the one with all host bits at 0 is the network address, naming the block itself, and the one with all host bits at 1 is the broadcast address, which reaches the whole block. Neither can be assigned to a network card, so the usable count is 2 to the power of the host bits, minus 2.

PrefixHost bitsBlock sizeUsable hostsDotted mask
/16166553665534255.255.0.0
/221010241022255.255.252.0
/248256254255.255.255.0
/2753230255.255.255.224
/30242255.255.255.252

Losing those 2 addresses is trivial on a /24, but on a /30 it is two of the four, one for each end of a leased line, which uses the block up exactly. That is why point-to-point links usually get a /30 and waste nothing.

Working backwards: how big a block for N devices

In real planning the order is usually reversed: you start with the device count and derive the prefix. Take the smallest host bit count h such that 2 to the h minus 2 is at least the device count. Thirty devices land exactly on the 30 of a /27, with nothing spare; 60 need the 62 of a /26; 100 need the 126 of a /25; 200 need the 254 of a /24; 300 push you to the 510 of a /23; 600 and 1000 both still fit inside the 1022 of a /22. That requirement of more than three hundred devices already rules out 255.255.255.0.

Take the next size up rather than cutting it fine: a /27 for 30 registered devices breaks the moment someone adds two printers, and a DHCP pool keeps holding addresses for devices that are already gone, so real consumption usually runs above the asset list.

A /22 is four /24s, not two

Every extra prefix bit halves the block. Going from /22 to /24 adds 2 bits, which is why /22 equals 4 /24 blocks. Spelled out: 192.168.0.0/22 covers 192.168.0.0 to 192.168.3.255, with usable addresses from 192.168.0.1 through 192.168.3.254, because those 8 bits of the third octet are taken up entirely by 0 to 3, whereas 192.168.0.0/24 stops at 192.168.0.255. Three hundred devices do not fit in one /24; the 1022 of a /22 is what leaves headroom.

Splitting one /22 into three blocks

Once you have 192.168.0.0/22 you do not have to run it as one big broadcast domain. Cutting it into /24, /24 and /23 gives three blocks: 192.168.0.0/24 covers 0.0 to 0.255 with 254 usable; 192.168.1.0/24 covers 1.0 to 1.255 with 254 usable; 192.168.2.0/23 covers 2.0 to 3.255 with 510 usable. They do not overlap and together they cover exactly 0.0 to 3.255 of the parent block, with no address falling outside.

Cutting comes with a cost you have to accept: the blocks no longer share a layer 2 domain, and traffic between them has to be routed at layer 3. A smaller broadcast domain is good, but routing moves from optional to mandatory, and any address on a switch port without a VLAN configured suddenly stops working.

How I double-check when the maths feels risky

In bit arithmetic, one slip in mental maths can cost you half a subnet, and the consequence only shows up after devices are connected and address conflicts appear. My habit is to drop the address and mask into a Subnet Calculator and let it list the network address, broadcast address and usable range as a cross-check, confirming the third octet really reaches 3 before filling anything into a router. When I also want to know which city and ISP a public address belongs to, IP Lookup answers the same kind of question: whose address is this in front of me?

Q: Is 255.255.255.0 any different from /24

Two ways of writing the same thing. The first spreads 32 bits into four decimal octets; the second states how many network bits there are. When a configuration screen only accepts dotted format, subtract the prefix length from 32 to get the host bits.

Q: Does the gateway take one of the usable addresses

Yes. The gateway is a real address inside the block, usually the lowest usable one. Together with the network and broadcast addresses it means a /24 actually hands out one fewer than 254 addresses to end devices.

Q: Why is the first usable address in some blocks not .1

As soon as the block does not start on a full block boundary, the network address is not .0. When prefixes do not line up, the start and end of the block are decided by zeroing and setting the host bits, so reading the range octet by octet is more reliable than memorising a rule.

Q: What happens if the mask is too wide or too narrow

Too narrow (planned as /24 but written 255.255.254.0) swallows the neighbouring block into the same broadcast domain, so two devices that should be isolated start receiving each other's broadcasts. Too wide (planned as /23 but written 255.255.255.0) makes the second half of the block treat its neighbours as off-block and hand packets to the gateway; if the gateway has no proxy ARP, the symptom is that you can ping the gateway but not the desk next door.

Q: What use are small blocks like /29 and /30

Three host bits give 8 addresses and 6 usable, enough for a group of fixed devices plus a few management ports; two host bits give 4 addresses and 2 usable, exactly right for the two ends of a point-to-point link. When allocating blocks for links, pick the smallest tier that covers the usable count and assign what is left to other blocks, which keeps the address space from filling up with fragments too small for anything.

📎 Related articles

PNG compressed three times only lost 426 bytes: the real boundary of lossless compression 2026-10-22 How Many Times Bigger a PNG Gets After Converting From WebP: When It Is Unavoidable and How to Keep the Growth Down 2026-10-22 Three Reasons the Small Text Smudges When a Screenshot Is Shrunk to a Quarter 2026-10-22 Cropped to the Same 300x300, Why Does the Avatar Always Sit Half a Cell Low-Right 2026-10-22 Forecasting 18 months at 1.7 times a month: why the script and the sheet give two numbers 2026-10-22