IP Subnet Calculator
Enter an IPv4 address with a prefix or subnet mask, see the whole subnet, and divide it.
Enter an address and mask on the left.
Subnet mask cheat sheet: /0 to /32
Every IPv4 prefix length with its dotted mask, wildcard mask, total addresses and usable hosts. Usable hosts subtract the network and broadcast addresses, except at /31 and /32 (see below).
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
How it works
A subnet mask marks how many leading bits of an address name the network; the rest number the hosts inside it.
Enter any address in the subnet together with its mask, as a prefix (/24) or dotted (
255.255.255.0), and the calculator clears the host bits to find the network, sets them all to find
the broadcast address, and counts what is left between them.
Usable hosts, and the two exceptions
An IPv4 subnet gives up its first address to the network identifier and its last to broadcast, so a /24 has 256
addresses and 254 usable hosts. That rule breaks twice at the bottom of the table. A /31 has two
addresses and both are usable on a point-to-point link (RFC 3021). A /32 is one host. Both are
reported as the RFCs define them rather than as 2ⁿ − 2.
Reading the binary view
The bar in each binary row sits where the prefix ends: network bits to its left, host bits to its right. The network address is the input with everything right of the bar set to zero; the broadcast is the same with everything set to one. That is the whole calculation, and seeing it is the fastest way to check an answer by hand.
Splitting a subnet
Equal subnets come in powers of two. Ask for five and you get eight, each a /27 of a /24, because five need three more prefix bits. Splitting by prefix instead gives every subnet of that size. Very large splits are capped at 256 listed rows, with the true total stated alongside.
For IPv6 prefixes, or CIDR blocks written without an address in mind, use the CIDR Calculator. To turn an arbitrary start-end range into blocks, use the CIDR Range Calculator. More utilities are listed on the tools index.
Example
10.20.30.77 255.255.255.192 is in 10.20.30.64/26: network 10.20.30.64,
broadcast 10.20.30.127, hosts 10.20.30.65 to 10.20.30.126, 62 usable,
wildcard 0.0.0.63. Dividing 192.168.0.0/24 into 4 subnets gives four /26s starting at
.0, .64, .128 and .192, with 62 usable hosts each.
Frequently asked questions
How many usable hosts are in a subnet?
Two to the power of the host bits, minus two: one address is the network identifier and one is broadcast. A /24 has 8 host bits, so 256 addresses and 254 usable hosts. The exceptions are /31, where RFC 3021 makes both addresses usable on a point-to-point link, and /32, a single host.
Can I enter a subnet mask instead of a prefix length?
Yes. 192.168.1.10 255.255.255.0, 192.168.1.10/255.255.255.0 and 192.168.1.10/24 all describe the same subnet. A mask whose one-bits are not contiguous, such as 255.0.255.0, is rejected rather than guessed at, because no prefix length matches it.
What is a wildcard mask?
The subnet mask with every bit inverted: 0.0.0.255 for a /24. Cisco access lists and OSPF network statements take a wildcard instead of a mask, so it is listed beside the mask for every subnet.
I asked for 5 subnets and got 8. Why?
Equal subnets come in powers of two, because each extra prefix bit doubles the count. Five subnets need three more bits, which makes eight. The calculator shows all eight so you can see which three are spare.
Does the address class still matter?
Not for routing. Classful addressing was replaced by CIDR in 1993 (RFC 4632), so a 10.x address can carry any mask. The class is shown because certification exams and older documentation still refer to it.
Related tools
CIDR Calculator
Network, broadcast, mask and usable range for any block — and split it into subnets.
LocalCIDR Range Calculator
Convert between a start-end IP range and the CIDR blocks covering it.
LocalIP Address Converter
Every representation of an address at once — dotted, binary, integer and hex.
LocalPrivate & Public IP Classifier
Tell whether an address is routable, private, loopback or otherwise reserved.
LocalCIDR Overlap Checker
Find which blocks in a list overlap, contain or duplicate each other.
LocalIPv6 Calculator
Expand, compress and inspect an IPv6 address or prefix.
Local