Subnet Calculator
Enter an IPv4 address with a CIDR prefix or subnet mask to get the network and broadcast address, usable host range, wildcard mask and host count.
Was this tool helpful?
Thanks for the feedback!
This calculator takes an IPv4 address with a CIDR prefix or a subnet mask and works out the network it belongs to. You get the network and broadcast addresses, the usable host range, the wildcard mask, the host count, the address type and the binary form of both the mask and the IP. It is meant for network engineers, students preparing for CCNA-style exams and anyone setting up a router, VPC or firewall rule.
What to type
The single field is IP address with /prefix or mask. It accepts three forms:
- CIDR notation:
192.168.1.10/24 - An address and a dotted mask separated by a space:
10.0.0.5 255.255.255.252 - An address on its own: the tool assumes /24 and says so in the result heading
The address does not need to be the network address. Enter any host IP and the tool finds the network it sits in.
How the results are worked out
The prefix length says how many of the 32 bits belong to the network. The tool builds the mask from that many 1 bits, then:
- Network address = IP AND mask (host bits set to 0)
- Broadcast address = network OR wildcard (host bits set to 1)
- Wildcard (inverse) mask = the mask with every bit flipped, as used in Cisco ACLs and OSPF
- Total addresses = 2 to the power (32 − prefix)
- Usable hosts = total minus 2, because the network and broadcast addresses cannot be given to a device
Worked examples
| Input | Network | Broadcast | Usable range | Usable hosts |
|---|---|---|---|---|
| 192.168.1.10/24 | 192.168.1.0 | 192.168.1.255 | 192.168.1.1 – 192.168.1.254 | 254 |
| 192.168.10.77/26 | 192.168.10.64 | 192.168.10.127 | 192.168.10.65 – 192.168.10.126 | 62 |
| 172.20.5.9/20 | 172.20.0.0 | 172.20.15.255 | 172.20.0.1 – 172.20.15.254 | 4,094 |
| 10.0.0.5 255.255.255.252 | 10.0.0.4 | 10.0.0.7 | 10.0.0.5 – 10.0.0.6 | 2 |
For 192.168.10.77/26 the mask is 255.255.255.192 and the wildcard is 0.0.0.63. Each /26 block holds 64 addresses, and 77 falls in the block that starts at 64. For the /20 example, the mask is 255.255.240.0, shown in binary as 11111111.11111111.11110000.00000000. Large counts use Indian digit grouping, so a /10 shows 41,94,304 total addresses.
To size a subnet, work backwards from the number of devices. An office with 25 devices needs at least 27 addresses once you add the network and broadcast, so a /27 is the smallest fit. Entering 192.168.5.0/27 shows a mask of 255.255.255.224 and 30 usable hosts, leaving a little room to grow.
/31 and /32: the special cases
The "minus 2" rule does not apply to the two smallest prefixes, and the tool handles them separately.
- /31 has two addresses and both are usable. RFC 3021 allows /31 on point-to-point links between two routers, which saves addresses. For
10.0.0.0/31the tool shows 2 usable hosts, a range of 10.0.0.0 – 10.0.0.1 and a broadcast of "None (point-to-point /31)". - /32 is a single address, used for loopbacks, host routes and allow-list entries for one server. For
8.8.8.8/32you get 1 usable host and "None (single host)" as the broadcast.
Address type and class
The Address type row tells you which special range the IP is in:
- Private (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 (172.16 to 172.31) and 192.168.0.0/16. These are for internal networks and are not routed on the public internet.
- Shared / CGNAT (RFC 6598): 100.64.0.0/10, which runs from 100.64.0.0 to 100.127.255.255. Many mobile and broadband providers use this range between the customer and their carrier-grade NAT. If your router's WAN address starts with 100.64 to 100.127, you are behind CGNAT and incoming port forwarding will not work from outside.
- Loopback (127.x.x.x), Link-local (169.254.x.x, which a device gives itself when DHCP fails), Multicast or reserved (224 and above) and Public for everything else.
The Historical class (A to E) is shown for reference only. Classful addressing was replaced by CIDR in 1993, but exam papers still ask about it.
Errors
- An octet over 255, such as 192.168.1.300, gives: "192.168.1.300" is not a valid IPv4 address.
- A prefix above 32 gives "The prefix length must be between 0 and 32."
- A mask like 255.255.0.255 gives "That mask is not contiguous (all ones followed by all zeros)."
To find the public IP and location your connection is using, try the IP address lookup. To practise converting octets to binary by hand, the binary to decimal converter helps.
Frequently asked questions
How many usable hosts are in a /24 subnet?
Why does a /31 show 2 usable hosts?
What is the 100.64.0.0/10 range?
Which IP ranges are private?
What is a wildcard mask?
What is the subnet mask for /26?
Related guides
- Subnet Mask Cheat Sheet: CIDR /8 to /32 Table, Usable Hosts and How to Calculate a Subnet A /24 is 255.255.255.0 with 254 usable hosts; a /26 has 62. Full CIDR /8 to /32 table with masks and wildcards, plus how to work out any subnet by han...
- Free Developer Tools That Replace a Dozen Browser Tabs Free developer tools grouped by job: format, convert, encode, generate and test. What each one does, which run on the server, and the limits to know f...
- How to Beautify CSS, HTML and XML (Online, VS Code, Prettier) Beautifying adds line breaks and indentation so minified CSS, HTML or XML is readable again. How the free formatters work, their limits, and VS Code a...