IPv4 Subnet Calculator
Enter an IPv4 address and prefix length (CIDR). This tool calculates the network address, broadcast address, subnet mask, wildcard mask, and usable host range.
VLSM planner
Split one or more base networks into right-sized subnets for each department or purpose. Larger requirements are packed first so every block stays properly aligned — no gaps, no overlaps. With several base networks, each subnet goes into the first one that still has room.
Worked example
Enter 192.168.10.37/27.
A /27 mask is 255.255.255.224, so each subnet is 32 addresses. 37 falls in the block that starts at 32: network 192.168.10.32, broadcast 192.168.10.63, usable hosts 192.168.10.33 to 192.168.10.62, which is 30 hosts.
How it works
Every IPv4 address and subnet mask can be written as a 32-bit binary number. The subnet mask shows which bits belong to the network (1s) and which belong to the host (0s). For example, a /24 mask is 24 ones followed by 8 zeros.
The network address comes from applying that mask to your IP address with a bitwise AND. This zeroes out the host bits. The broadcast address uses the same calculation, but sets the host bits to 1 instead. Everything in between is a usable host address, except for the /31 and /32 special cases covered in the FAQ below.
Learn the theory
FAQ
- How is the network address calculated?
- The IP address and subnet mask are each converted to 32-bit binary. Then you apply a bitwise AND between them. The result is the network address, where every host bit is set to 0.
- How is the broadcast address calculated?
- The broadcast address is the network address with every host bit set to 1. To get it, take the bitwise OR of the network address and the wildcard mask. The wildcard mask is just the inverse of the subnet mask.
- Why does a /31 show 2 usable hosts instead of 0?
- Normally, the first address in a subnet (the network address) and the last (the broadcast address) can't be assigned to a host. RFC 3021 makes an exception for /31 networks. These are used almost only for point-to-point links, like a link between two routers. With only 2 addresses total, and no meaningful broadcast on a 2-host link, both addresses become usable.
- Why does a /32 show only 1 usable host?
- A /32 is a single address. There are no other hosts in the block at all. It's commonly used as a "host route" to point to one specific device, such as a loopback interface on a router.
- What's the difference between the subnet mask and the wildcard mask?
- They're bitwise inverses of each other. The subnet mask (e.g. 255.255.255.0) has 1s for the network portion and 0s for the host portion. The wildcard mask (e.g. 0.0.0.255) is the opposite. Tools like Cisco access control lists use a wildcard mask instead of a subnet mask.
- What does "all networks in this block" mean?
- This lists the other subnets the same size as yours inside the same classful (Class A/B/C) network, up to 256 of them. For example, it shows all sixteen /28 subnets inside a /24. Your subnet is highlighted so you can see where it falls among its neighbours.
- What is VLSM and why would I use it?
- VLSM (Variable Length Subnet Mask) means splitting one network into subnets of different sizes, instead of equal ones. For example, you'd give a 50-host department a /26 and a 10-host guest network a /28, instead of wasting addresses by giving both the same size. The VLSM planner below does this automatically. It gives each named group its own right-sized, non-overlapping block.