Guides · Network
Subnetting For Beginners: CIDR, Masks, And /24 Math
Subnetting is just counting in binary. This guide walks through what /24 means, how CIDR works, and why /30 is the smallest useful IPv4 subnet.
By Cody · 8 min read · Published
The one fact that makes everything else easy
An IPv4 address is 32 bits. The “slash” in CIDR notation (the /24 in 192.0.2.0/24) tells you how many of those 32 bits identify the network, and the remaining bits identify the host.
/24= 24 network bits + 8 host bits.- 8 host bits = 2⁸ = 256 total addresses.
- Minus network address and broadcast address = 254 usable hosts.
That is the entire trick. Every subnet question reduces to “how many host bits do I have, and what does 2-to-the-power-of-that look like?”
The CIDR cheat sheet you actually use
Memorize these and you can do 90% of day-to-day subnetting in your head:
Prefix Mask Total IPs Usable /30 255.255.255.252 4 2 /29 255.255.255.248 8 6 /28 255.255.255.240 16 14 /27 255.255.255.224 32 30 /26 255.255.255.192 64 62 /25 255.255.255.128 128 126 /24 255.255.255.0 256 254 /23 255.255.254.0 512 510 /22 255.255.252.0 1,024 1,022 /21 255.255.248.0 2,048 2,046 /20 255.255.240.0 4,096 4,094 /16 255.255.0.0 65,536 65,534 /8 255.0.0.0 16,777,216 16,777,214
Pattern: each step up halves the count, each step down doubles it. Use the subnet calculator for anything that needs to be exact.
Where the network address and broadcast come from
For 192.0.2.0/24:
- Network address:
192.0.2.0— all host bits set to 0. - First usable host:
192.0.2.1 - Last usable host:
192.0.2.254 - Broadcast address:
192.0.2.255— all host bits set to 1.
For 192.0.2.16/28 (one of sixteen /28s inside 192.0.2.0/24):
- Network:
192.0.2.16 - First usable:
192.0.2.17 - Last usable:
192.0.2.30 - Broadcast:
192.0.2.31
The pattern is identical at every prefix length — the math just operates on a different number of host bits.
Picking a subnet size
Practical defaults that age well:
- Point-to-point link between two routers:
/30(4 IPs, 2 usable). Or/31if the gear supports RFC 3021. - Small office LAN (under 50 devices):
/26(62 usable) gives you headroom. - Typical office or data-center VLAN:
/24(254 usable). The classic size; familiar to every network engineer. - Container / pod network: usually
/16or larger, sliced into smaller per-node ranges by the orchestrator. - Very small reserved block for monitoring, single host on a tunnel:
/32.
Pick the smallest subnet that fits two or three years of expected growth. Going too big bloats broadcast domains; going too small forces re-numbering pain later.
IPv6 — the same math, much more space
IPv6 addresses are 128 bits. The same CIDR notation works: 2001:db8::/32 means 32 network bits and 96 host bits.
The standard subnet size for a LAN in IPv6 is /64. That gives you 2⁶⁴ addresses per subnet — far more than any LAN needs. You do not subnet smaller than /64 for a hosts subnet because SLAAC and several other IPv6 features expect that size.
For a typical end site, the allocation is usually /48 (65,536 LAN-sized /64s) or /56 (256 /64s). Both are deliberately generous — the IPv6 design philosophy is that address scarcity should never drive architecture decisions again.
Subnetting on the wire
Once you have picked a CIDR block, two pieces of router config make it work:
- The router interface on that LAN gets an IP inside the block, usually the first or last usable.
- The router announces the block to the rest of the network — statically, via OSPF/BGP, or via your provider's routing protocol of choice.
Inside the block, every host either has a static IP or gets one via DHCP. The router becomes the default gateway; the subnet mask tells each host which destinations are local (same broadcast domain, send by ARP) versus remote (send via gateway).
Splitting a /24 into four /26s
- Example input
192.0.2.0/24- Example result
192.0.2.0/26 hosts: 192.0.2.1 - 192.0.2.62 broadcast: 192.0.2.63 192.0.2.64/26 hosts: 192.0.2.65 - 192.0.2.126 broadcast: 192.0.2.127 192.0.2.128/26 hosts: 192.0.2.129 - 192.0.2.190 broadcast: 192.0.2.191 192.0.2.192/26 hosts: 192.0.2.193 - 192.0.2.254 broadcast: 192.0.2.255
Four equal /26s fit inside one /24. Each gives 62 usable hosts. The Codynet subnet calculator works any of these splits.
Related tools
FAQ
Why does a /24 hold 256 addresses but only 254 usable hosts?
The first address in any IPv4 subnet is the network address (the subnet's identity) and the last is the broadcast address (used to address every host on the subnet at once). Neither can be assigned to a real host. 256 total addresses minus those two = 254 usable.
What is the smallest useful IPv4 subnet?
A /30 — four addresses, two usable hosts. It is the classic size for a point-to-point link between two routers. /31 also exists (two addresses, both usable) for point-to-point per RFC 3021, but not every device supports it.
Why is /32 used everywhere if there are no usable hosts in it?
/32 is a single host. It is the right way to refer to one specific IP in route tables, firewall rules, and access lists. Not a subnet for hosts to live in — just notation for one address.
How is IPv6 different?
IPv6 subnetting is the same math at a different scale. The standard subnet size for a LAN is /64. There is no broadcast address (IPv6 uses multicast instead) so every address in a /64 is technically usable. RFC 6177 also abandoned the old IPv4 idea that you should give end sites a tiny range — modern IPv6 allocations are usually /48 or /56.
Does subnet size affect performance?
Indirectly. Bigger broadcast domains mean more ARP traffic, more broadcast handling on every host, and bigger fault domains when something misbehaves. Common rule of thumb: do not exceed a /23 (510 hosts) for a typical Ethernet LAN. Split into separate VLANs / subnets instead.
Last reviewed: 2026-05-14.