IPv4 subnet calculator
IPv4 only. Write 192.168.1.10/24, 10.0.0.5 255.255.0.0, or just the address and pick the mask from the list.
Colored bits belong to the network part; the rest are host bits.
How subnet calculation works
An IPv4 address is a 32-bit number. The prefix length (the /24 part) says how many of those bits, counted from the left, identify the network; the remaining bits number the hosts inside it. Everything else, from the broadcast address to the host count, follows from that one split.
How to use it
- 1 Type an address with its prefix, such as 10.20.30.40/22, or an address followed by a dotted mask.
- 2 Read the network, broadcast and usable host range. The mask list next to the field updates with what you type, and changing it rewrites the prefix.
- 3 To plan smaller networks, pick a longer prefix under "Split into": the list shows every resulting subnet with its host range.
Why a /24 has 254 hosts, not 256
Eight host bits give 256 addresses, but two are taken: the first (all host bits 0) names the network itself and the last (all 1) is the broadcast address. So the usable count is 2 to the power of the host bits, minus 2. The two exceptions are /31, where RFC 3021 lets both addresses be hosts on a point-to-point link, and /32, which is one single host.
Network address with AND, broadcast with OR
The network address is the IP AND the mask: host bits are cleared. The broadcast address is the network OR the wildcard (the inverted mask): host bits are all set. Example: 172.20.77.9/20 has a mask of 255.255.240.0, so the third octet 77 becomes 64 and the network is 172.20.64.0; the broadcast is 172.20.79.255. The block size in the octet where the prefix ends is 256 minus the mask value there, here 16.
Private, CGNAT and other special ranges
Three blocks are private and never routed on the internet: 10.0.0.0/8, 172.16.0.0/12 (172.16 to 172.31, not all of 172.x) and 192.168.0.0/16. 100.64.0.0/10 is shared address space used by carrier-grade NAT; if your router shows a WAN address there, you are behind your provider’s NAT. 127.0.0.0/8 is loopback, 169.254.0.0/16 is link-local (often a sign that DHCP failed), and 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are reserved for examples in documentation.
Address classes are history
Class A, B and C (first octet 0-127, 128-191, 192-223) fixed the prefix at /8, /16 and /24 until CIDR replaced them in 1993. The class is shown because exams and older equipment still ask for it, but it tells you nothing about the real mask: 10.1.2.3/24 is "class A" and still has 254 hosts. Class D (224-239) is multicast and class E (240-255) is reserved. This tool handles IPv4 only; IPv6 uses 128-bit addresses and has no broadcast at all.