Subnet Calculator
Enter an IPv4 address in CIDR notation and get the network and broadcast addresses, the subnet and wildcard masks, the usable host range and the host count. Correct for the awkward cases too — /31 point-to-point links and /32 host routes.
How it works
How the prefix length works
An IPv4 address is 32 bits. The prefix length after the slash says how many leading bits identify the network; the rest identify the host. A /24 fixes the first 24 bits, leaving 8 host bits, so 28 = 256 addresses.
The network address is the address with all host bits set to 0; the broadcast address has them all set to 1. Both are reserved, which is why a /24 offers 254 usable hosts rather than 256.
Why the host count is two fewer than the total
In an ordinary subnet the all-zeros address names the network itself and the all-ones address is the broadcast address, so neither can be assigned to a machine. Usable hosts = 2(32 − prefix) − 2.
There are two exceptions, and most calculators get them wrong:
- /31 — RFC 3021 allows both addresses to be used on a point-to-point link, so a /31 gives 2 usable addresses, not zero.
- /32 — a single host route. One address, no network or broadcast.
Subnet mask and wildcard mask
The subnet mask writes the prefix as dotted decimal: a /26 is 255.255.255.192. The wildcard mask is its bitwise inverse (0.0.0.63), which is the form Cisco access lists and some firewall rules expect. Both describe the same boundary.
What people use it for
- Splitting an allocation — checking how many hosts a /26 or /27 actually gives you before committing to it.
- Writing a firewall or security-group rule and needing the exact network address rather than the host address someone sent you.
- Checking whether two addresses are on the same subnet — enter both with the same prefix and compare the network addresses.
- Translating a mask between dotted-decimal, prefix length and wildcard form for a device that only accepts one of them.
- Configuring a point-to-point link where a /30 or /31 is the right choice.
Nothing is uploaded. This tool runs entirely in JavaScript in your browser. Your input is never sent to a server, never logged and never stored, and no account is required. Once the page has loaded you can go offline and it still works — open your browser's network tab and watch if you'd like to confirm it.
Frequently asked questions
Why does a /24 give 254 usable hosts and not 256?
The all-zeros address identifies the network and the all-ones address is the broadcast address. Neither can be assigned to a machine, so 256 total addresses leave 254 usable.
Does a /31 really have usable addresses?
Yes. RFC 3021 permits both addresses of a /31 to be assigned on a point-to-point link, where no broadcast is needed. This calculator reports 2 usable addresses for a /31, which many tools incorrectly report as 0.
What is a wildcard mask for?
It is the bitwise inverse of the subnet mask, used by Cisco access control lists and some other devices. A /26 has subnet mask 255.255.255.192 and wildcard mask 0.0.0.63.
Does this handle IPv6?
No, this tool is IPv4 only. IPv6 subnetting works on the same prefix principle but with 128-bit addresses and no broadcast address.
Can I enter a host address rather than a network address?
Yes. Enter any address in the subnet with its prefix and the calculator derives the network address for you, which is usually what you actually needed.
Tools that run where your code is
This page does its work in your browser because sending your data to a server to process it is a bad default. Catalase applies the same idea to AI coding: a free, open-source code editor that runs language models on your own machine through Ollama, with no account and no telemetry. Cloud models are there when you choose one, not by default.
Related tools
- Epoch converter — Unix timestamps to readable dates and back.
- Hex to RGB — Colour conversion with contrast ratios.
- Regex tester — Test a pattern with live match highlighting.