IP Subnet Calculator
Calculate IPv4 subnet details from CIDR notation
Invalid CIDR notation. Use the format 192.168.1.0/24 (octets 0-255, prefix 0-32).
Subnet Details
- Network Address
- -
- Broadcast Address
- -
- Subnet Mask
- -
- Wildcard Mask
- -
- First Usable Host
- -
- Last Usable Host
- -
- Usable Hosts
- -
- Total Addresses
- -
- IP Class
- -
- Mask (Binary)
- -
A CIDR block such as 192.168.1.0/24 hides a surprising amount of arithmetic. This calculator turns it into the values network engineers actually need: the network and broadcast addresses, the subnet mask, the wildcard mask, the first and last usable host, total and usable host counts, the legacy address class, and the mask written out in binary. Every field is computed locally in your browser as you type.
How to Use
- Enter an address in strict CIDR form: four decimal octets (0-255) followed by a slash and a prefix length from 0 to 32, for example
10.0.0.0/8. A bare IP address with no/prefixis rejected, because the prefix is what defines the block. - Let the results refresh. The tool recalculates about 300 ms after you stop typing, and you can also press Enter or click Calculate to force an update.
- Read the ten result fields described below.
- Click Copy to place all ten labeled values on your clipboard as plain lines of text.
Reading the Results
- Network address - the first address in the block, with every host bit set to 0. It names the subnet and is not assigned to a device.
- Broadcast address - the last address, with every host bit set to 1. On ordinary subnets it reaches all hosts and is not assignable.
- Subnet mask - the dotted-decimal mask derived from the prefix;
/26becomes255.255.255.192. - Wildcard mask - the bitwise inverse of the subnet mask, used by Cisco ACL entries and OSPF statements.
- First host / Last host - the usable range that sits between the network and broadcast addresses.
- Total hosts -
2^(32 - prefix), the block size including reserved addresses. - Usable hosts - the number of addresses you can actually assign to interfaces.
- IP class - a legacy label (A through E) based on the first octet of the network address.
- Mask binary - the mask split into four 8-bit groups, which makes the network/host bit boundary obvious at a glance.
Worked Examples
| CIDR | Network | Broadcast | Subnet mask | Wildcard | First host | Last host | Usable | Class |
|---|---|---|---|---|---|---|---|---|
| 192.168.1.130/26 | 192.168.1.128 | 192.168.1.191 | 255.255.255.192 | 0.0.0.63 | 192.168.1.129 | 192.168.1.190 | 62 | C |
| 10.0.0.0/30 | 10.0.0.0 | 10.0.0.3 | 255.255.255.252 | 0.0.0.3 | 10.0.0.1 | 10.0.0.2 | 2 | A |
| 172.16.5.200/31 | 172.16.5.200 | 172.16.5.201 | 255.255.255.254 | 0.0.0.1 | 172.16.5.200 | 172.16.5.201 | 2 | B |
| 10.1.2.3/32 | 10.1.2.3 | 10.1.2.3 | 255.255.255.255 | 0.0.0.0 | 10.1.2.3 | 10.1.2.3 | 1 | A |
In the first row, /26 creates blocks 64 addresses wide. The host 192.168.1.130 falls inside the block that starts at 192.168.1.128, so the calculator reports .128 as the network and .191 as the broadcast, leaving 62 usable addresses from .129 to .190.
The Math Behind the Mask
The subnet mask is just the prefix written as a run of 1 bits:
/26= 26 ones followed by 6 zeros =11111111.11111111.11111111.11000000=255.255.255.192.- Wildcard = bitwise NOT of the mask.
- Network = IP AND mask.
- Broadcast = network OR wildcard.
- Total hosts =
2^(32 - prefix). - Usable hosts = total minus 2, for prefixes 0 through 30.
The counts grow quickly: a /24 has 256 total and 254 usable, a /16 has 65,536 and 65,534, and a /8 has 16,777,216 and 16,777,214. Moving one bit shorter in the prefix doubles the block and doubles the host count.
Edge Cases: /31, /32, and /0
The usual “subtract two” rule breaks at the ends of the prefix range, so the calculator special-cases them:
- /31 - RFC 3021 allows point-to-point links to use both addresses, so usable = 2 and no broadcast is reserved.
- /32 - a single-host route. Total = usable = 1, and the network, broadcast, first, and last host fields are all the same address.
- /0 - the default route. Total = 4,294,967,296 and usable = 4,294,967,294, with a mask of
0.0.0.0.
If you type an address whose host bits are already set, such as 192.168.1.130/26, the tool masks them off and reports the network address instead of raising an error. That is usually the desired behavior during planning, but it is worth noticing that your original host is being snapped to a block boundary.
Common Mistakes
- Expecting the entered IP to come back unchanged. The network field always shows the aligned block start, not your original address.
- Confusing total with usable. A
/26reports 64 total but only 62 usable; the network and broadcast addresses are not assignable. - Swapping the wildcard and subnet masks.
0.0.0.255is the wildcard for/24, not a subnet mask. - Assuming /31 has zero usable hosts. Under RFC 3021 both of its addresses are usable.
- Trying IPv6. This calculator is IPv4-only;
2001:db8::/32will be rejected as invalid input. - Leaving off the slash.
192.168.1.0on its own is not valid CIDR input here.
Related Tools
- IP Address Lookup — Look up geolocation and ISP info for any IP address.
- DNS Lookup — Query DNS records for a domain via DNS-over-HTTPS.
- UUID Generator — Generate random RFC 4122 UUIDs.
Frequently Asked Questions
Why does the calculator report 62 usable hosts for a /26 instead of 64?
A /26 block contains 2^(32-26) = 64 addresses in total, but the first address is the network identifier and the last is the broadcast address, so neither can be assigned to a device. Subtracting those two reserved addresses leaves 62 usable hosts (the .129 through .190 range in a 192.168.1.128/26 block).
I entered 192.168.1.130/26 but got 192.168.1.128 as the network. Did I do something wrong?
No. The tool aligns your input to the subnet boundary by clearing the host bits (network address = IP AND mask). With /26 the blocks are 64 addresses wide, so .130 falls inside the block that starts at .128. The original address is still shown implicitly by the block; it is not preserved as a separate field.
Why does a /31 show 2 usable hosts when /30 shows 2 as well?
/30 follows the classic rule: 4 total minus network and broadcast leaves 2 usable. /31 is special-cased by RFC 3021 for point-to-point links, where broadcast is unnecessary, so both of its 2 addresses are usable. /32 goes further and reports 1 usable host for a single-address host route.
What is the wildcard mask, and why is it different from the subnet mask?
The wildcard mask is the bitwise inverse of the subnet mask. For /26 the subnet mask is 255.255.255.192, so the wildcard is 0.0.0.63. Cisco ACLs and OSPF network statements use the wildcard form, where a 0 bit means must match and a 1 bit means ignore.
How many addresses does a /0 or /8 block contain?
Total hosts is 2^(32 - prefix). /0 contains 4,294,967,296 addresses (4,294,967,294 usable), /8 contains 16,777,216 (16,777,214 usable), and /16 contains 65,536 (65,534 usable). The counts grow by a factor of two for every prefix step shorter.
Does this tool support IPv6 CIDR blocks?
No. It parses only IPv4 dotted-decimal addresses with a prefix from /0 to /32, and it rejects anything else, including IPv6 like 2001:db8::/32. For IPv6 subnetting you need a separate IPv6-aware calculator.
Reviewed by the HandyTools Hub team · Last updated