IPv4 Subnet Calculator
Enter an IPv4 address and a prefix such as /26 or a mask such as 255.255.255.192. The binary view shows which bits belong to the network and which to hosts.
What the results mean
- Subnet mask: the prefix written as four bytes. /26 is 26 one-bits, 255.255.255.192.
- Network address: the address with every host bit set to 0 (address AND mask). It names the subnet.
- Broadcast address: every host bit set to 1. Packets sent there reach all hosts on the subnet.
- Usable hosts: 2host bits − 2 for /30 and shorter prefixes. /31 links use both addresses (RFC 3021) and /32 is a single host.
- Wildcard mask: the inverted mask, used by some router access lists.
Worked example: 10.20.30.40 with 255.255.240.0
255.255.240.0 is /20, leaving 12 host bits (4,096 addresses). The third byte 30 is 0001 1110; masking with 240 (1111 0000) keeps 0001 0000 = 16. So the network is 10.20.16.0, the broadcast is 10.20.31.255 and the usable hosts are 10.20.16.1 to 10.20.31.254, 4,094 addresses.
Why /31 and /32 show no broadcast address
For 203.0.113.7/31 on a point-to-point link, 203.0.113.6 and 203.0.113.7 are both usable endpoints. A /32 identifies one address. The calculator shows n/a for broadcast in both cases.
Everything is calculated in your browser. Need the bits of a single number? Use decimal to binary, or AND two values with the bitwise calculator.
Related guides
Other Number System Conversions
Related numeral systems converters for number conversion between binary, decimal, hexadecimal, octal, and ASCII text.