# In IPv4, why is the number of host addresses available per network given by $2^\textrm{host bits} - 2$? This is in the context of classes

For some reason—at least when classes are involved (which I don't know the reason for yet)—in IPv4 the number of host addresses available per network is given by $$2^\textrm{host bits} - 2$$. Why don't we have $$2^\textrm{host bits}$$ host addresses available?

• see answers to this question Jan 30, 2022 at 18:16

The addresses x.x.x.255 are reserved: they are the "broadcast address" (for /8 networks, i.e., where the "host bits" = 8).

The addresses x.x.x.0 are actually fine. However, they used to be reserved, so older sources might consider them unavailable. See https://stackoverflow.com/q/14915188/781723 and https://serverfault.com/q/135267/111679 and https://serverfault.com/q/10985/111679.

Thus, older sources might list it as "minus two"; a more modern view is that it is "minus one".

• What about for, say, /24 networks? If all x.x.x.255 are reserved then the number of available host addresses is $2^8 \times 2^8 \times (2^8 - 1)$ which is not equal to $2^{24} - 1$
– user147634
Jan 29, 2022 at 16:37
• @JosephGriffith I think you mean a /8 network. For a /8 network, the first 8 bits are for the network, and the last 24 bits are for the host. (See en.wikipedia.org/wiki/…) I believe only all-ones and all-zeros in the host portion have any special meaning, but I am not 100% certain.
– D.W.
Jan 29, 2022 at 21:56
• Considering that there is no such thing as "classes" and hasn't been for over 20 years, one can assume that any source that still mentions them belongs to the category of "older sources". Jan 29, 2022 at 22:55