Plan IPv4 networks fast. This free subnet calculator turns an IP and CIDR prefix into the network and broadcast addresses, subnet mask, wildcard, usable host range and host count.
Enter an IPv4 address and a CIDR prefix (0-32). The calculator works out the network and broadcast addresses, subnet mask, usable host range and host count.
For IPv4 networks. Usable hosts exclude the network and broadcast addresses (for /31 and /32, special rules apply). All figures are calculated locally in your browser.
How the Subnet Calculator Works
Subnetting splits an IPv4 network into smaller blocks by borrowing bits from the host portion of an address. This calculator takes an IP address and a CIDR prefix and works out every address boundary that block contains, purely with bitwise math done locally in your browser.
Formula: Subnet mask = 32 bits with the first n bits set to 1 (n = CIDR prefix). Network address = IP address AND subnet mask. Wildcard mask = NOT (subnet mask). Broadcast address = network address OR wildcard mask. Usable hosts = 2^(32 − n) − 2 for prefixes /0 through /30. Two special cases apply: /31 has exactly 2 usable addresses (a point-to-point link with no separate network/broadcast address), and /32 has exactly 1 usable address (a single host route).
- IP address — the IPv4 address entered in the “IP address” field, e.g. 192.168.1.10.
- n (CIDR prefix) — the “Subnet prefix (CIDR)” field, a number from 0 to 32 that sets how many leading bits of the mask are 1s.
- Network address — the first address in the block, shown as an output once the mask is applied.
- Broadcast address — the last address in the block, shown once the wildcard is applied to the network address.
Example Scenarios
| IP address | CIDR prefix | Usable hosts |
|---|---|---|
| 10.0.0.0 | /8 | 16,777,214 |
| 172.16.0.0 | /20 | 4,094 |
| 192.168.1.0 | /24 | 254 |
| 192.168.1.0 | /28 | 14 |
| 192.168.1.0 | /30 | 2 |
| 192.168.1.0 | /31 | 2 (special case) |
Subnet Calculator FAQ
What’s the difference between usable hosts and total addresses in a subnet?
Total addresses is 2^(32−n), every address the block contains. Usable hosts subtracts the network address (all host bits 0) and the broadcast address (all host bits 1), since neither can be assigned to a device — except in the /31 and /32 special cases.Why does a /31 subnet have 2 usable hosts instead of following the minus-2 rule?
A /31 has only 2 addresses total, and RFC 3021 allows both to be used as host addresses on a point-to-point link (like a router-to-router connection) rather than reserving one as a broadcast address, since there’s no meaningful broadcast on a two-host segment.How do I calculate the subnet mask from a CIDR prefix?
Set the first n bits of a 32-bit value to 1 and the rest to 0, then write it in dotted-decimal form. For example /24 sets the first 24 bits to 1, giving 255.255.255.0. This calculator does that conversion for you automatically.What is a wildcard mask used for?
A wildcard mask is the bitwise inverse of the subnet mask (1s and 0s swapped). It’s used in access control lists and some routing protocol configurations, where matching rules are expressed as “don’t care” bits instead of a standard mask.How many hosts does a /27 subnet support?
A /27 leaves 5 host bits (32 − 27 = 5), giving 2^5 = 32 total addresses and 32 − 2 = 30 usable host addresses after the network and broadcast addresses are removed.Can this calculator handle a /32 address, and what does it mean?
Yes — a /32 identifies a single, specific IPv4 address with no subnetting at all. It’s commonly used in firewall rules or static routes that need to match exactly one host, and the calculator reports it as 1 usable address.Related Calculators
If you’re working with network addressing, it helps to see IP octets in binary form with the binary to decimal converter, or check how strong a device’s admin password is with the password strength calculator. For any other quick math while planning your network layout, the scientific calculator covers the rest.