CIDR
Also known as: Classless Inter-Domain Routing, CIDR notation, slash notation, prefix length
CIDR (Classless Inter-Domain Routing) is the notation that writes a block of IP addresses as an address followed by a slash and the number of fixed leading bits — 192.168.1.0/24 — replacing the rigid class A/B/C system with prefixes of any length.
Overview
The number after the slash is a bit count, not an address count. A /24 means the first 24 bits identify the network and the remaining 8 are free for hosts, giving 2^8 = 256 addresses. Each bit you add to the prefix halves the block, so /25 is 128 addresses and /26 is 64. That inversion is the thing to internalise: a bigger number after the slash means a smaller network.
CIDR arrived in 1993 to replace classful addressing, where a leading octet below 128 meant a /8 and an organisation needing 500 addresses had to be given a /16 worth 65,536. The waste was accelerating IPv4 exhaustion. Allowing an arbitrary prefix meant that organisation could be handed a /23 instead, and it also made route aggregation possible — a router can advertise 10.0.0.0/16 rather than 256 separate /24 routes, which is what kept global routing tables from collapsing under their own weight.
Two addresses in an ordinary IPv4 block are not assignable: the first is the network address naming the subnet, the last is the broadcast address. So a /24 offers 254 usable hosts, not 256. Two prefixes break that rule and are worth knowing: RFC 3021 permits a /31 on a point-to-point link where no broadcast address is needed, so both addresses are usable, and a /32 is a single host route used for loopbacks and firewall rules. Subtracting two regardless is a common bug that yields 0 or -1 usable hosts.
IPv6 uses the same notation with 128 bits instead of 32 and no broadcast address to reserve. A /64 is the conventional size for one link because SLAAC autoconfiguration assumes 64 host bits, and a site is typically delegated a /48 or /56 — leaving room for tens of thousands of /64s, which is why IPv6 subnetting is about hierarchy rather than conservation.