LocalBench

CIDR Notation Explained for Developers

Published September 19, 2026

CIDR notation — a block like 192.168.1.0/24 — packs an IP address and a network size into one compact string. The part after the slash, the prefix length, is the piece that trips people up: it's not a host count or a subnet index, it's the number of bits (out of 32, for IPv4) that are fixed as the "network" portion of the address, with the rest available for hosts.

How the prefix length determines network size

An IPv4 address is 32 bits. A /24 fixes the first 24 bits as the network — leaving 8 bits (2⁸ = 256 addresses) for hosts. A /16 fixes 16 bits, leaving 16 for hosts (2¹⁶ = 65,536 addresses). The pattern: every bit you add to the prefix cuts the address space in half. Going from /24 to /25 doesn't shrink a network by a little — it splits it exactly in two, from 256 addresses down to 128.

  • /8 — 24 host bits → 16,777,216 addresses
  • /16 — 16 host bits → 65,536 addresses
  • /24 — 8 host bits → 256 addresses (the most common "one subnet per LAN" size)
  • /28 — 4 host bits → 16 addresses
  • /30 — 2 host bits → 4 addresses

Network address, broadcast address, and usable hosts

Within any block, the first address (all host bits zero) is the network address, identifying the subnet itself rather than a host — and the last address (all host bits one) is the broadcast address, used to reach every host on that subnet at once. Neither is normally assignable to a device, which is why a /24's 256 addresses yield only 254 usable hosts: 256 total, minus the network address, minus the broadcast address.

There are two documented exceptions where that -2 rule doesn't apply: a /31 (RFC 3021) has no separate network/broadcast address at all — both of its 2 addresses are usable, intended for a point-to-point link between exactly two devices — and a /32 is a single host route with no "range" to speak of.

Worked example: 192.168.1.0/24

  • Network address: 192.168.1.0
  • Broadcast address: 192.168.1.255
  • Usable host range: 192.168.1.1 – 192.168.1.254 (254 hosts)
  • Subnet mask: 255.255.255.0

The subnet mask (255.255.255.0 here) is just another way to express the same prefix length — 24 binary 1s followed by 8 binary 0s. CIDR notation and dotted-decimal subnet masks are interchangeable; CIDR is just more compact.

Try it yourself

Paste a CIDR block or a dotted subnet mask into our CIDR / Subnet Calculator to get the network address, broadcast address, usable host range, wildcard mask, and total address count instantly — including the /31 and /32 special cases above. Runs entirely in your browser.

← Back to all guides