TSToolSphere
Back to all articles
web

CIDR Subnetting Explained: Prefixes, Masks, and Host Counts

2026-07-286 min read

Try it: free CIDR / Subnet Calculator

Calculate network address, broadcast address, subnet mask, and host counts from an IPv4 CIDR block.

Open →

What the prefix actually means

CIDR (Classless Inter-Domain Routing) notation writes an IP block as an address plus a slash and a number — 192.168.1.0/24 — where that number is how many leading bits of the 32-bit address are fixed as the network portion. The remaining bits identify individual hosts within that network. A /24 fixes the first 24 bits (the first three octets), leaving 8 bits — 256 possible values — for host addresses.

192.168.1.0/24
└─────────┘ └┘
 24 network    8 host bits → 2^8 = 256 addresses
   bits

Why usable hosts are two fewer than the total

Within any subnet, the first address (all host bits zero) is reserved as the network address itself, and the last address (all host bits one) is reserved as the broadcast address — neither is assignable to an actual device. A /24's 256 total addresses therefore yield 254 usable host addresses, not 256. This "total minus 2" rule holds for every prefix except /31 (used for point-to-point links, where both addresses are usable per RFC 3021) and /32 (a single host, no network/broadcast distinction at all).

Prefix Total addresses Usable hosts
/24 256 254
/28 16 14
/30 4 2
/31 2 2 (point-to-point exception)
/32 1 1 (single host)

Subnet mask vs. prefix — the same information, two notations

A subnet mask (255.255.255.0) and a CIDR prefix (/24) encode identical information — which bits are network bits — just written differently. The mask writes it as four decimal octets where each 255 means "all 8 bits fixed" and 0 means "all 8 bits free for hosts"; the prefix just states the total count of fixed bits directly. Converting between them is a matter of counting: /24 → three full 255 octets, then 0; a mask like 255.255.255.192 → 24 + 2 = /26 (since 192 in binary is 11000000, two more network bits).

Why this matters for real network planning

Choosing the right prefix size when splitting a larger block into subnets (a VLAN plan, a cloud VPC's subnet layout) is exactly a question of how many hosts each subnet actually needs, since a prefix determines a hard ceiling — requesting a /28 (14 usable hosts) for a segment that will eventually need 20 devices means re-subnetting later, not just adding more devices to the existing block.

Common mistakes

  • Forgetting the network and broadcast addresses aren't assignable, off-by-two-ing a capacity plan for a subnet.
  • Confusing prefix length with the resulting host count directly. A smaller prefix number means a larger network — /16 has far more hosts than /28, since fewer bits are fixed as network bits.
  • Applying the "minus 2" rule to /31 or /32 blocks. Both are special cases with different, smaller reservations (or none at all for /32).

FAQ

How many usable hosts does a /24 network have?
254 — 256 total addresses minus the reserved network and broadcast addresses.

Why is a /16 network larger than a /24 network?
A smaller prefix number fixes fewer bits as network bits, leaving more bits free for host addresses — /16 fixes only 16 bits (65,536 total addresses) versus /24's 24 bits (256 addresses).

Are the network and broadcast address reservations true for every subnet size?
For every size except /31 (a point-to-point exception where both addresses are usable) and /32 (a single host, with no separate network/broadcast address at all).

Calculate network ranges, masks, and host counts for any CIDR block with the CIDR / Subnet Calculator, or convert between address notations with the IP Address Converter — both entirely client-side.

Looking for other tools?

Explore ToolSphere Homepage →