How Many Hosts Are in a /24?
A /24 subnet contains 256 total addresses, of which 254 are usable for hosts. The two reserved addresses are the network address (all host bits 0) and the broadcast address (all host bits 1). This page explains the math, the edge cases, and why the answer is not always 254.
The short answer
| Value | Count |
|---|---|
| Total addresses | 256 |
| Network address (reserved) | 1 |
| Broadcast address (reserved) | 1 |
| Usable hosts | 254 |
The math
A /24 leaves 8 bits for hosts (32 − 24 = 8). The total number of addresses is 2⁸ = 256. Two are reserved, so usable hosts = 256 − 2 = 254.
host bits h = 32 - prefix = 32 - 24 = 8
total = 2^h = 2^8 = 256
usable = 2^h - 2 = 256 - 2 = 254What the two reserved addresses are
For 192.168.1.0/24:
| Address | Role | Binary (last octet) |
|---|---|---|
| 192.168.1.0 | Network address | 00000000 |
| 192.168.1.1 | First usable host | 00000001 |
| 192.168.1.254 | Last usable host | 11111110 |
| 192.168.1.255 | Broadcast address | 11111111 |
Why subtract 2?
The all-zeros host address identifies the network itself (used in routing tables), and the all-ones host address is the directed broadcast — a packet sent to this address is delivered to every host in the subnet. Both are required by RFC 791 and cannot be assigned to an interface.
Edge cases where the answer changes
/31 — 2 usable, 0 reserved (RFC 3021)
On point-to-point links, RFC 3021 allows a /31 to use both addresses as host addresses, with no dedicated broadcast. A /31 gives 2 usable hosts with zero waste. See How /31 Networks Work.
/32 — 1 address, a single host
A /32 is a host route — one address, no network/broadcast overhead. Used for loopback addresses, firewall rules, and /32 host routes in BGP.
/31 and /32 comparison
| Prefix | Total | Usable hosts | Notes |
|---|---|---|---|
| /30 | 4 | 2 | Traditional point-to-point |
| /31 | 2 | 2 | RFC 3021, no broadcast |
| /32 | 1 | 1 | Single host route |
Host counts for nearby prefixes
| Prefix | Host bits | Total | Usable hosts |
|---|---|---|---|
| /25 | 7 | 128 | 126 |
| /26 | 6 | 64 | 62 |
| /27 | 5 | 32 | 30 |
| /28 | 4 | 16 | 14 |
| /29 | 3 | 8 | 6 |
| /30 | 2 | 4 | 2 |
Each time you borrow one more bit for the network, you halve the host count. For the full table, see the CIDR cheat sheet.
Practical: fitting 254 hosts on a /24
254 is the theoretical maximum. In practice you lose addresses to infrastructure:
- Default gateway: 1
- Switch management IPs: 1–2
- DHCP relay / reserved leases: a handful
- Printers, cameras, IoT: varies
A realistic access VLAN on a /24 supports ~240 endpoints. If you expect to exceed that, plan a /23 or split into two /24s. Use the VLAN sizing calculator to estimate.