🌐 Subnet Calculator
Calculate the subnet mask, network address, broadcast address, and usable host range for any IPv4 address and CIDR prefix.
Network Details
Result
How the Subnet Calculator Works
This calculator converts an IPv4 address and CIDR prefix length into a full subnet breakdown using bitwise arithmetic, the same math routers and networking equipment use to determine network boundaries.
Method
networkAddress = ipAddress AND subnetMask
broadcastAddress = networkAddress OR (NOT subnetMask)
usableHosts = 2^(32−N) − 2 (for N ≤ 30; /31 and /32 are special cases)
Special Cases
- /31 — point-to-point link, both addresses usable (no network/broadcast reserved), 2 usable hosts.
- /32 — a single host address, 1 usable host (the address itself).
Worked Example
For 192.168.1.0/24 (the calculator's default), the subnet mask is 255.255.255.0 and the wildcard mask is 0.0.0.255. This gives a network address of 192.168.1.0 and a broadcast address of 192.168.1.255, leaving a usable host range from 192.168.1.1 to 192.168.1.254 — 254 usable hosts in total (2²⁴⁻²⁴, i.e. 2⁸ − 2).
Frequently Asked Questions
Why are 2 addresses subtracted from the usable host count?
For prefixes /30 and shorter, the first address in the range is reserved as the network address and the last is reserved as the broadcast address, so they aren't assignable to hosts.
What is a wildcard mask?
The wildcard mask is the bitwise inverse of the subnet mask. It's commonly used in access control lists (ACLs) on routers and firewalls to specify address ranges.
What does the CIDR prefix length mean?
The CIDR prefix (e.g. /24) indicates how many leading bits of the 32-bit IPv4 address are fixed as the network portion — the remaining bits identify hosts within that network.