What this calculator does
This tool takes an IPv4 address and a CIDR prefix length (the number after the slash, e.g. /26) and computes the subnet's key parameters: the network address, the broadcast address, the subnet mask in dotted-quad form, the first and last usable host addresses, and the total and usable host counts. It works for any prefix from /0 to /32 and is useful for network design, firewall rules, and exam practice.
How to use it
Enter an IPv4 address such as 192.168.1.130 and a prefix length such as 26. Submit to see the full breakdown. The calculator treats the address as a 32-bit number, applies the mask with bitwise operations, and converts the results back to dotted decimal.
The formula explained
A CIDR prefix of n means the first n bits are network bits, so the subnet mask is n ones followed by (32 − n) zeros. The network address is IP AND mask, which zeroes out the host bits. The broadcast address is network OR (NOT mask), which sets every host bit to 1. Total addresses equal 2^(32 − n); usable hosts are total minus 2 (one for the network, one for broadcast) for prefixes up to /30.
Worked example
For 192.168.1.130/26: the /26 mask is 255.255.255.192. The last octet 130 AND 192 = 128, so the network is 192.168.1.128. The block size is 64, so the broadcast is 192.168.1.191. Usable range is 192.168.1.129 to 192.168.1.190, giving 62 usable hosts out of 64 total addresses.
FAQ
Why do /31 and /32 behave differently? A /32 is a single host; a /31 (RFC 3021) uses both addresses for point-to-point links, so neither subtracts the network/broadcast pair.
What is the subnet mask for /24? /24 is 255.255.255.0, giving 256 total and 254 usable hosts.
Is this IPv6 compatible? No — this calculator is for IPv4 addresses only.