Enter an IPv4 address and a prefix length (CIDR) to get the full subnet details — network address, broadcast address, usable host range, subnet mask, wildcard mask, and a binary view. Everything is worked out right in your browser.
The prefix length is turned into a 32-bit subnet mask. For example, /24 becomes 255.255.255.0.
The IP address and the mask are compared bit by bit to find the network address.
All the host bits are set to 1 to find the broadcast address.
The usable host range sits between the network address and the broadcast address.
A /31 is treated as a special 2-address link (as per RFC 3021), and a /32 is a single address — so the usual 'minus 2' rule does not apply to these two.
Network address: IP AND Subnet Mask
Broadcast address: Network OR (NOT Subnet Mask)
Total addresses: 2 ^ (32 − prefix)
Usable hosts: 2 ^ (32 − prefix) − 2
Every IPv4 address has two parts: a network part that says which subnet it belongs to, and a host part that identifies one device within that subnet. The subnet calculator separates the two. Given an address and a prefix length, it works out the subnet mask, wildcard mask, network address, broadcast address, usable host range, host counts and a bit-by-bit binary view, plus the neighbouring subnets and a VLSM planner for splitting a block into pieces of different sizes.
Network engineers use it while designing office LANs, configuring routers and firewalls, and troubleshooting why two devices cannot talk to each other. Students preparing for CCNA, university networking exams and interviews use it to check hand calculations. The binary view is the main teaching aid: it shows exactly which bits the mask keeps, so the logic behind each result is visible instead of memorised.
1. Write the prefix as a mask: /n means n ones followed by 32 − n zeros. Convert each group of 8 bits to decimal to get the dotted mask, for example /26 = 255.255.255.192.
2. Find the block size in the interesting octet (the one where the mask is not 255 or 0): Block = 256 − mask octet value.
3. Network address = IP AND Mask. In practice, round the interesting octet of the IP down to the nearest multiple of the block size and set later octets to 0.
4. Broadcast address = Network OR Wildcard, where Wildcard = 255.255.255.255 − Mask. In practice, network + block size − 1 in the interesting octet, with later octets 255.
5. Usable hosts = 2^(32 − n) − 2. First host = network + 1; last host = broadcast − 1.
6. For /31 treat both addresses as usable on a point-to-point link, and for /32 the single address is the host.
A mask has 1s where the network part is and 0s where the host part is. ANDing a bit with 1 keeps it, and ANDing with 0 clears it. So IP AND Mask keeps the network bits and wipes the host bits to zero, which is the network address by definition. ORing the network address with the wildcard, the mask's inverse, sets every host bit to 1, which is the broadcast address. A router does exactly this AND on every packet to decide whether a destination is local or must be forwarded.
In the octet where the mask changes, the mask value is 256 minus a power of two, such as 192 = 256 − 64. The host bits in that octet can count from 0 to 63, so subnets there come in blocks of 64: .0, .64, .128, .192. Rounding the IP's octet down to a multiple of the block size gives the same answer as the bitwise AND, without writing binary. This magic-number method is how engineers subnet quickly in their heads.
The subnet mask and wildcard mask are bitwise opposites and are used in different places. Interfaces, DHCP servers and host settings use the subnet mask. Cisco access control lists and OSPF network statements use the wildcard, where 0 means the bit must match and 1 means ignore it. A /26 has mask 255.255.255.192 and wildcard 0.0.0.63. Each wildcard octet is 255 minus the mask octet. Entering a mask where a wildcard is expected is a classic configuration error.
Fixed-size subnetting gives every segment the same block, which wastes addresses when one segment needs 100 hosts and another needs 2. Variable Length Subnet Masking lets each segment take the smallest block that fits: 2^k − 2 must be at least the hosts required. The planner sorts requirements from largest to smallest and allocates them one after another, which keeps every block aligned on its own boundary and avoids overlaps.
Divya is configuring the accounts department VLAN in a Gurugram office. The firewall shows a laptop at 172.16.45.130 with a /26 prefix, and she needs the subnet details to set up the gateway and DHCP scope.
IP address: 172.16.45.130
Prefix length: /26
Mask: 26 ones = 11111111.11111111.11111111.11000000 = 255.255.255.192. Wildcard = 0.0.0.63.
Interesting octet is the 4th. Block size = 256 − 192 = 64, so subnets start at .0, .64, .128 and .192.
130 lies between 128 and 191, so the network address is 172.16.45.128 (binary of .130 is 10000010; AND 11000000 gives 10000000 = 128).
Broadcast = 128 + 64 − 1 = 191, so 172.16.45.191.
Total addresses = 2^(32 − 26) = 64. Usable = 64 − 2 = 62, from 172.16.45.129 to 172.16.45.190.
The next subnet is 172.16.45.192/26. The address is in 172.16.0.0/12, so it is private, and its first octet 172 puts it in old Class B.
Answer: Network 172.16.45.128/26, broadcast 172.16.45.191, usable hosts 172.16.45.129 to 172.16.45.190 (62 hosts), mask 255.255.255.192, wildcard 0.0.0.63.
Using the IP you were given as the network address without ANDing it with the mask.
Writing the subnet mask where an ACL or OSPF statement needs a wildcard.
Allocating VLSM blocks smallest first, which leaves misaligned gaps and overlaps.
Forgetting the minus two for network and broadcast on normal subnets, or applying it to /31 links.
Mixing up the interesting octet and computing the block size in the wrong position.
Designing VLANs and subnets for an office or campus network.
Setting gateway, DHCP scope and static addresses on a new segment.
Troubleshooting devices that cannot reach each other because of a wrong mask.
Writing access lists and OSPF network statements with correct wildcards.
Practising subnetting for CCNA and networking exams.
Why are 2 addresses subtracted from the host count?
The first address in a subnet is the network address itself, and the last one is the broadcast address. Neither can be given to a device. So a /24 has 256 total addresses, but only 254 can actually be used.
What is a wildcard mask?
It is the exact opposite of the subnet mask, bit by bit. It is used in Cisco access lists and OSPF settings, where a 0 means 'this bit must match' and a 1 means 'ignore this bit'.
What is the difference between /24 and 255.255.255.0?
They mean the same thing, written in two different ways. /24 is CIDR notation, meaning the first 24 bits are fixed. 255.255.255.0 is the same value written as a normal subnet mask.