Guide
Working out an IPv4 subnet from an address and a prefix
Anyone who has set up a router, a VLAN or a cloud network has met the question “which addresses belong together?”. A subnet calculator answers it from two inputs: an address and either a prefix such as /26 or a mask such as 255.255.255.192. The page returns the network address, broadcast address, the range of usable hosts, the wildcard mask and a few facts that help when you are reading a design or checking a classmate’s homework.
How the arithmetic works
An IPv4 address is 32 bits. The prefix length says how many of the leading bits name the network; the rest number the hosts. The calculator turns the prefix into a mask (26 ones followed by 6 zeros) and performs a bitwise AND with the address. That gives the network address, the lowest value in the block. Setting every host bit to 1 gives the broadcast address, the highest value. Everything strictly between the two is available for hosts. The prefix notation itself is standardised in RFC 4632.
Reading the result
The output lists the network in CIDR form, the dotted mask, the wildcard mask (the mask inverted, used by Cisco-style access lists), the broadcast address, the first and last usable host, the number of addresses in the block and the number of usable hosts. Two further lines are easy to overlook. “Address class” is historic: classes A, B and C were dropped in 1993 when classless addressing arrived, but exam questions and some documentation still use them. “Kind of address” tells you whether the block is private (RFC 1918), shared carrier-grade NAT space, loopback, link-local, documentation or ordinary public space.
Edge cases that surprise people
A /31 has only two addresses, and the usual rule of subtracting two would leave none. RFC 3021 lets both be used on a point-to-point link, so the calculator reports two usable hosts and no broadcast. A /32 is one address, used for loopbacks and host routes. If you type a host address instead of a network address, the tool does not complain; it shows the block that the host belongs to and says so, which is exactly what you want when you only know a device’s address and prefix. Masks that are not contiguous, such as 255.0.255.0, are rejected because they are not valid subnet masks.
A worked example
Take 192.168.1.130/26. The mask is 255.255.255.192 and the last octet of the mask is 11000000. The address’s last octet, 130, is 10000010; ANDing leaves 10000000, which is 128. So the network is 192.168.1.128/26, the broadcast address is 192.168.1.191 (the last octet becomes 10111111), the usable range is 192.168.1.129 to 192.168.1.190, and the block holds 64 addresses of which 62 are usable. The wildcard mask is 0.0.0.63. The page also marks the block as private under RFC 1918 and offers to split it: choosing /27 gives two subnets, /28 gives four, and so on down to /32.
Limits
IPv6 prefixes are accepted too, but they get a shorter answer (first and last address, the size of the block and how many /64 networks it holds), because IPv6 has no broadcast address and nobody counts hosts in a /64; the IPv6 Subnet Calculator goes further with prefix planning. A split lists only the first 64 subnets. The page is pure arithmetic. It cannot tell whether an address is in use, whether a router is configured correctly or whether two blocks overlap on your real network. When you must fit subnets of different sizes into one block, the VLSM Calculator does the allocation for you.
Related tools
- VLSM Calculator plans several subnets of different sizes inside one block.
- Wildcard Mask Calculator writes the access-list and OSPF lines for a mask.
- Broadcast Address Calculator does the same sum for a whole list of addresses at once.
- IP to Binary Converter shows the bits behind the network and host parts.
Checked against the current version of the Subnet Calculator on .

