CIDR (Classless Inter-Domain Routing, RFC 4632) is how every modern network is described. An IP address followed by a slash and a number — the prefix length — telling you how many bits at the front of the address name the network.
Old school: class A, B, C. Modern: CIDR. All the sizing is one number.
The Notation
192.168.1.0/24
↑ IP ↑ prefix length
- Prefix length = network bits (leftmost)
- Remaining bits = host bits (rightmost)
- Total is always 32 bits (IPv4) or 128 bits (IPv6)
For IPv4 /24: 24 network bits + 8 host bits = 256 total addresses.
The Formulas
Total addresses = 2^(32 - prefix)
Usable hosts = 2^(32 - prefix) - 2 (subtract network + broadcast)
Subtract 2 because:
- All-host-bits-zero is the network address (
192.168.1.0for/24) - All-host-bits-one is the broadcast address (
192.168.1.255for/24)
Neither can be assigned to a host.
Common Prefixes (IPv4)
| Prefix | Total | Usable | Common use |
|---|---|---|---|
/8 | 16,777,216 | 16,777,214 | Historic Class A, 10.0.0.0/8 RFC 1918 |
/16 | 65,536 | 65,534 | Large enterprise site, 172.16.0.0/12 RFC 1918 (in slices) |
/24 | 256 | 254 | Office LAN, 192.168.x.0/24 RFC 1918 |
/26 | 64 | 62 | Small department |
/28 | 16 | 14 | Small office DMZ |
/29 | 8 | 6 | Firewall interconnect |
/30 | 4 | 2 | Classic point-to-point link |
/31 | 2 | 2 | Modern p2p link (RFC 3021) |
/32 | 1 | 1 | Single host route |
Splitting a Subnet
Add bits to the prefix. Each added bit halves the address space.
Example: split 192.168.1.0/24 into four subnets.
/24→/26(add 2 prefix bits = 4 subnets)- Each
/26has 64 addresses (62 usable) - Subnet boundaries:
.0,.64,.128,.192
192.168.1.0/26 → 192.168.1.0 – 192.168.1.63
192.168.1.64/26 → 192.168.1.64 – 192.168.1.127
192.168.1.128/26 → 192.168.1.128 – 192.168.1.191
192.168.1.192/26 → 192.168.1.192 – 192.168.1.255
Reading a CIDR Block by Hand
To find the network address of 172.16.42.137/20:
/20= 20 network bits = 12 host bits- Convert the host portion of the IP to binary
- Zero out the host bits
Faster method: the network boundary in /20 falls on multiples of 2^(32-20) / 256 = 16 in the third octet. 172.16.42.x — the closest multiple of 16 at or below 42 is 32. So the network is 172.16.32.0/20, covering 172.16.32.0 – 172.16.47.255.
The /31 and /32 Special Cases
/31— RFC 3021 lets you use/31for point-to-point links with 2 usable addresses. No network / broadcast concept. Saves address space vs/30./32— a single-host “subnet”. Used for loopback interfaces, host routes, and single-IP firewall matches.
IPv6 CIDR
Same notation, different bit widths. Common IPv6 prefixes:
| Prefix | Common use |
|---|---|
/48 | Site allocation |
/64 | Standard LAN (per SLAAC) |
/128 | Single host |
There’s no shortage of IPv6 addresses — you don’t fret about /28 vs /29 the way you do with IPv4.
RFC 1918 Private Ranges
Reserved for internal use, never routed on the internet:
10.0.0.0/8— one giant private range172.16.0.0/12— 16/16s (172.16.0.0 to 172.31.255.255)192.168.0.0/16— 256/24s
Tools
Use the subnet calculator to:
- Convert between CIDR and dotted netmask
- List all subnets when splitting a block
- Calculate first / last host, network, broadcast
- Compute available host count
Cheaper than doing the math by hand every time.
Related
Check the Port 25 glossary entry, read the What Is a MAC Address? deep dive, and browse DNS record types — CIDR is what routes IP packets that DNS lookups return.
Common Questions
What does /24 mean in an IP address?
The /24 tells you how many bits at the front of the IP address are the network portion. /24 = first 24 bits are the network, remaining 8 bits are the host — giving 256 total addresses (254 usable, since the first is the network address and the last is broadcast). Example: 192.168.1.0/24 covers 192.168.1.0 through 192.168.1.255.
How many hosts fit in a /16?
65,536 total addresses; 65,534 usable. Formula: 2^(32 - prefix). For /16 that's 2^16 = 65,536. Subtract 2 for the network address (all-host-bits-zero) and broadcast (all-host-bits-one), which cannot be assigned to hosts.
How do I split a /24 into four subnets?
Add 2 bits to the prefix: /24 becomes /26. Each /26 covers 64 addresses (62 usable). For 192.168.1.0/24 the four subnets are 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26, and 192.168.1.192/26.
What is the difference between /30 and /31?
/30 has 4 addresses (2 usable) — classic point-to-point link with 2 hosts, 1 network, 1 broadcast. /31 (RFC 3021, 2000) redefines the semantics: only 2 addresses, both are usable, no network / broadcast — a modern point-to-point link with zero waste. Most modern routers support /31 for backbone links to conserve address space.
Is /32 a valid subnet?
Yes — a /32 is a single-host 'subnet' with exactly one address. Used for loopback interfaces, host routes in routing tables, and firewall rules matching a single IP. It's not a subnet in the traditional sense of holding multiple hosts, but the notation is valid and common.