CIDR / Subnet Calculator
This CIDR subnet calculator works out everything that follows from an address and a prefix length: the network and broadcast addresses, the first and last usable host, the subnet and wildcard masks, the mask in binary, and how many addresses the block holds. The two exceptions to the usual rules are handled properly rather than glossed over — a /31 is a point-to-point link with two usable addresses and no broadcast address at all, and a /32 is a single host route. Both are cases where the familiar subtract-two rule gives the wrong answer, and both come up constantly in real network configuration.
How it works
Works out everything that follows from an address and a prefix length: the network and broadcast addresses, the usable host range, the subnet and wildcard masks, and how many addresses the block holds.
The two exceptions to the usual rules are handled properly. A /31 is a point-to-point link with two usable addresses and no broadcast address, and a /32 is a single host — both of which the "subtract two" rule gets wrong.
Everything runs in your browser — nothing you enter is sent to a server.
What the prefix means
The number after the slash is how many leading bits identify the network. The rest identify the host. A
/24 fixes the first 24 bits, leaving 8 bits — 256 addresses — for hosts.
Every step down the prefix doubles the block:
| Prefix | Mask | Addresses | Usable |
|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 |
| /29 | 255.255.255.248 | 8 | 6 |
| /28 | 255.255.255.240 | 16 | 14 |
| /24 | 255.255.255.0 | 256 | 254 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
The two exceptions
/31 — defined by RFC 3021 for point-to-point links. Both addresses are usable and there is no broadcast address, because a link with exactly two ends has no need to broadcast. The subtract-two rule would say zero usable hosts, which is wrong.
/32 — a single address. Used for host routes, loopback interfaces and firewall rules that target one machine.
Wildcard masks
A wildcard mask is the bitwise inverse of the subnet mask, and it is what Cisco access lists and OSPF expect. It is easy to mistake one for the other, and doing so silently matches the wrong range — which is why both are shown here side by side.
Frequently asked questions
How do I use the subnet calculator?
Enter an address and prefix in CIDR form, such as 192.168.1.0/24. The network, broadcast, host range, masks and address counts are worked out immediately.
Why is the usable count two fewer than the total?
The first address identifies the network and the last is the broadcast address, so neither can be assigned to a host. A /24 holds 256 addresses and 254 usable ones.
What about a /31?
A /31 is the exception. Defined for point-to-point links, it has two usable addresses and no broadcast, because a link with exactly two ends does not need one.
What is a wildcard mask?
The inverse of the subnet mask, used by Cisco access lists and OSPF. A /24 has subnet mask 255.255.255.0 and wildcard mask 0.0.0.255.
Can I enter a host address rather than the network?
Yes. Enter any address in the block and the network is worked out from the prefix. The tool notes when the address you gave is a host rather than the network address.
Is anything sent to a server?
No. The calculation is arithmetic and runs entirely in your browser.
Related tools
IP Address Converter
This IP converter turns an address between dotted, decimal, hex, octal and binary forms.
Bitwise Calculator
This bitwise calculator shows AND, OR, XOR and shifts with the bits lined up.
Number Base Converter
A number base converter for binary, hex, decimal, octal, Roman numerals, balanced ternary, negabinary and more.