Subnet Calculator
Calculate an IPv4 subnet from an address and a CIDR prefix. The result shows network, subnet mask, wildcard, broadcast, first and last host, usable host count, and the historical class of the address.
Subnet Calculator tool
About the Subnet Calculator
This is integer bitwise math: network = address AND mask, broadcast = network OR wildcard. It does not configure a router, query DNS, or handle IPv6. The wildcard is the inverted mask, as used in some ACL syntax.
A /24 is the common LAN. /31 follows RFC 3021 (two addresses, no reserved broadcast). /32 is a single host. Prefix 0 is the entire IPv4 space. The historical class letter is only a label from the first octets — modern networks are planned with CIDR, not class A/B/C. Enter the address as four octets 0–255 and a prefix 0–32; the host you type does not have to be the network address.
How the Subnet Calculator works
The prefix is the number of leading 1-bits in the mask. Host bits are 32 − prefix. Usable hosts exclude network and broadcast except on /31 and /32.
mask = 2^32 − 2^(32 − prefix) (as a 32-bit value)
network = address AND mask; broadcast = network OR NOT mask
Example
192.168.1.50/24 → network 192.168.1.0, mask 255.255.255.0, broadcast 192.168.1.255, usable hosts 254 (192.168.1.1–254).
How to Use the Subnet Calculator
- Enter an IPv4 address as four octets 0–255.
- Enter a prefix from 0 to 32.
- Read the CIDR network and mask.
- Use first/last host when you assign addresses.
- Ignore historical class for modern CIDR planning — it is shown only as a label.
Subnet Calculator Examples
Home LAN /24
10.0.0.15/24 → 10.0.0.0/24, 254 usable hosts.
Point-to-point /31
Both addresses are usable; there is no classic broadcast reserved.
Host route /32
Network, first, last, and broadcast are the same address. Usable count is 1.
How to Calculate a Subnet
Write the prefix as a mask of 1-bits, AND it with the address for the network, OR the inverted mask for the broadcast. Hosts sit strictly between those two addresses on /0–/30.
Common prefixes
Host counts exclude network and broadcast except as noted.
| Prefix | Mask | Usable hosts |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /16 | 255.255.0.0 | 65,534 |
| /24 | 255.255.255.0 | 254 |
| /30 | 255.255.255.252 | 2 |
| /32 | 255.255.255.255 | 1 |
Private address ranges
10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 are RFC 1918 private space. The calculator still accepts public addresses; it does not check whether a prefix is allocated. Link-local 169.254.0.0/16 and multicast 224.0.0.0/4 also parse as ordinary integers — the class letter will say D for multicast — but this page will not warn you against using them as a LAN. A /31 follows RFC 3021 (two usable addresses, no reserved broadcast). A /32 is a single host. The address you type does not have to be the network address — 192.168.1.50/24 still yields network 192.168.1.0. IPv6 is not supported.
Frequently Asked Questions
IPv6?
Not supported.
Why is class shown?
Legacy A/B/C from the first octets. CIDR superseded classful routing.
What is a wildcard?
The inverse of the mask, used in some ACL syntax.
Can I enter 192.168.1.50/24 in one box?
Enter the address and prefix in the two fields.
Is this a scanning tool?
No. It only does address arithmetic on the values you type.