Subnet Calculator
Enter an address and prefix to get the network, broadcast, usable range and host count.
Binary view
Split this network
Dividing it into equal subnets:
| Prefix | Subnets | Hosts each | First subnet |
|---|
Common prefixes: /8 · /16 · /20 · /22 · /23 · /24 · /25 · /26 · /27 · /28 · /29 · /30 · /31 · /32 · all prefixes
Guide & FAQWhat the prefix length means · Why two addresses are unusable · The mask and the wildcard · Private ranges · Ranges worth recognising · Frequently asked questions
What the prefix length means
An IPv4 address is 32 bits. The number after the slash says how many of those bits identify the network; the rest identify a host within it. In 192.168.1.0/24 the first 24 bits are the network, leaving 8 bits — 256 addresses — for hosts.
Each bit you take away from the prefix doubles the size of the network. A /23 is twice a /24; a /25 is half. That doubling is why subnet sizes are always powers of two and why you cannot have a network of exactly 100 addresses — you take a /25 and leave 28 addresses unused.
Why two addresses are unusable
In every subnet larger than a /31, the first and last addresses are reserved. The first, with all host bits zero, is the network — it names the subnet rather than a machine in it. The last, with all host bits one, is the broadcast address, which reaches every host at once.
So a /24 holds 256 addresses but only 254 usable ones. This is the arithmetic behind the constant off-by-two in capacity planning, and it gets painful at the small end: a /30 has four addresses and only two you can assign, which is why point-to-point links traditionally waste half their space.
Two prefixes are special. A /31 would have no usable addresses under that rule, so RFC 3021 redefines it for point-to-point links: both addresses are usable, and there is no broadcast. A /32 is a single address — a host route, a loopback, or a firewall rule matching exactly one machine.
The mask and the wildcard
The same information is written three ways depending on which tool you are talking to. A prefix length of 24 is the subnet mask 255.255.255.0, and its inverse — the wildcard mask 0.0.0.255 — is what Cisco access lists and OSPF statements expect. A wildcard is simply the mask with every bit flipped, so a bit that is 0 in the wildcard must match and a bit that is 1 is ignored.
Private ranges
Three blocks are reserved for private use and are never routed on the public internet:
| Range | CIDR | Addresses | Where you see it |
|---|---|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | 16,777,216 | Large corporate networks and cloud VPCs |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | 1,048,576 | Docker's default bridge, mid-size networks |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | 65,536 | Home routers, almost universally |
The 172 range trips people up because it is not the whole of 172.x: it stops at 172.31, so 172.32.0.0 is public address space belonging to someone else.
Ranges worth recognising
| Block | What it is |
|---|---|
127.0.0.0/8 | Loopback — the whole /8, not just 127.0.0.1 |
169.254.0.0/16 | Link-local. An address here usually means DHCP failed |
100.64.0.0/10 | Carrier-grade NAT. Appears in mobile networks and some ISPs |
224.0.0.0/4 | Multicast |
0.0.0.0/0 | The default route — every address, which is why it means "anywhere" in a firewall rule |
Frequently asked questions
How many hosts are in a /24?
256 addresses, of which 254 are usable. The first is the network address and the last is the broadcast address, and neither can be assigned to a machine.
What is the subnet mask for /24?
255.255.255.0. The prefix length counts the leading 1 bits in the mask, so 24 ones followed by 8 zeros gives three full octets of 255 and one of 0.
Is a smaller prefix number a bigger network?
Yes, and this is the usual source of confusion. The number counts network bits, so fewer bits leaves more for hosts. A /16 is 256 times larger than a /24.
Why can a /31 be used when it has no usable hosts?
Under the normal rule a /31 would be entirely network and broadcast. RFC 3021 makes an exception for point-to-point links, where there is no need for a broadcast address, so both addresses are assignable.
What is a wildcard mask?
The bitwise inverse of the subnet mask, used by Cisco access lists and OSPF. For a /24 the mask is 255.255.255.0 and the wildcard is 0.0.0.255. A zero bit must match; a one bit is ignored.
How do I split a /24 into smaller subnets?
Each extra prefix bit halves the network. A /24 splits into two /25s, four /26s, eight /27s and so on. The calculator above shows the first subnet at each size.