Home / Everyday / Subnet Calculator
IPv4 Subnet Calculator (CIDR)
Enter an IPv4 address and a prefix length to see the network address, broadcast address, subnet mask, wildcard mask, usable host range and address class. Optionally split the block into smaller subnets.
What CIDR notation and the mask mean
An IPv4 address is 32 bits, usually written as four decimal numbers. The prefix length after the slash says how many of the leading bits identify the network; the remaining bits identify hosts inside it. A /24 keeps 24 bits for the network, leaving 8 host bits, which gives a mask of 255.255.255.0.
Block size = 2(32 − prefix)
Network = address AND mask
Broadcast = network + block size − 1
For 172.16.5.130/26 the block size is 64. The block containing .130 starts at .128, so the network is 172.16.5.128 and the broadcast address is 172.16.5.191. The wildcard mask is the mask with all bits flipped, 0.0.0.63, as used in some router access lists.
Usable hosts and the special cases
In an ordinary subnet the first address (the network address) and the last (the broadcast address) cannot be assigned to devices, so usable hosts equal 2(32 − prefix) − 2. A /24 offers 254, a /26 offers 62, and a /30 offers 2.
- /31. Defined for point-to-point links in RFC 3021, where both addresses are usable and there is no broadcast address.
- /32. A single host route, such as a loopback or a specific device.
- /0 to /8. Very large blocks that appear mostly in routing tables.
The usable range shown here is the generic arithmetic result. Your platform may reserve more addresses, as some cloud networks do, so check its documentation when planning.
Planning and splitting address space
To plan subnets, start with the number of hosts each group needs, add room to grow, and round up to the next power of two. Needing 100 hosts calls for a /25 (126 usable), not a /26 (62). Use the split option to divide a block into equal smaller subnets and see each range. Splitting a /24 by 2 bits gives four /26 subnets starting at .0, .64, .128 and .192.
The private ranges set aside by RFC 1918 are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Addresses in them are not routed on the public internet, which is why they are reused in homes and offices. The legacy class (A, B or C) is shown for reference only; modern networks use classless prefixes.
Limits
This tool covers IPv4 only. IPv6 uses 128-bit addresses and a different planning approach. If the address you enter has host bits set, such as .10 inside a /24, the calculator still reports the block that contains it. It does not check whether an address is assigned or reachable, and the 64-row cap on the split table keeps large splits readable.
Worked example
A host at 172.16.5.130 sits in a /26 block. The block is then divided into /28 subnets for smaller departments.
Inputs
| IPv4 address | 172.16.5.130 |
|---|---|
| Prefix length (CIDR) | 26 / |
| Split into subnets of prefix (optional) | 28 / |
Result
62 usable hosts, 172.16.5.129 to 172.16.5.190.
| Network address | 172.16.5.128/26 |
|---|---|
| Broadcast address | 172.16.5.191 |
| Subnet mask | 255.255.255.192 |
| Wildcard mask | 0.0.0.63 |
| First usable host | 172.16.5.129 |
| Last usable host | 172.16.5.190 |
| Total addresses | 64 |
| Usable hosts | 62 |
| Mask in binary | 11111111.11111111.11111111.11000000 |
| Legacy class of the address | B |
| Private range (RFC 1918) | Yes |
4 subnets of /28
| Subnet | Host range | Broadcast |
|---|---|---|
| 172.16.5.128/28 | 172.16.5.129 - 172.16.5.142 | 172.16.5.143 |
| 172.16.5.144/28 | 172.16.5.145 - 172.16.5.158 | 172.16.5.159 |
| 172.16.5.160/28 | 172.16.5.161 - 172.16.5.174 | 172.16.5.175 |
| 172.16.5.176/28 | 172.16.5.177 - 172.16.5.190 | 172.16.5.191 |
Accuracy note: Results are calculated in your browser from the values you enter. Check anything that matters for legal, academic or financial purposes against the official source.
Frequently asked questions
How many usable hosts are in a /24 network?
A /24 has 256 addresses. Removing the network and broadcast addresses leaves 254 usable hosts, from .1 to .254 in the last octet.
What is the difference between a subnet mask and a wildcard mask?
The subnet mask has ones for the network bits, such as 255.255.255.0, while the wildcard mask is its inverse, 0.0.0.255. Wildcard masks appear in some router access control lists.
Why does a /31 have two usable addresses?
RFC 3021 allows /31 on point-to-point links, where no broadcast is needed. Both addresses can be used by the two ends of the link, instead of losing two to network and broadcast.
How do I choose the right prefix for a number of hosts?
Find the smallest power of two that is at least the number of hosts plus two, and subtract its exponent from 32. Needing 50 hosts gives 64 addresses, so a /26.
Can I use this for IPv6?
No. The calculator handles IPv4 addresses and CIDR prefixes from /0 to /32. IPv6 subnetting follows similar ideas but with 128-bit addresses and different conventions.