IP Subnet Calculator
Enter an IPv4 address and a CIDR prefix to see the network and broadcast addresses, subnet and wildcard masks, total and usable hosts, and the address class.
Subnet Details
How It Works
Every IPv4 address is 32 bits, split by the CIDR prefix into a network part and a host part. The subnet mask has 1-bits for the network part and 0-bits for the host part: a /24 mask is 255.255.255.0. The network address is the IP address with all host bits set to 0 (a bitwise AND with the mask); the broadcast address is the network address with all host bits set to 1. The wildcard mask is the bitwise inverse of the subnet mask, and is used in access-control lists. Total addresses are 2 raised to the number of host bits, and usable hosts are two fewer — the network and broadcast addresses cannot be assigned to hosts — except for the special cases of /31 and /32.
The IP class comes from the first octet: 0–127 is Class A, 128–191 Class B, 192–223 Class C, 224–239 Class D (multicast) and 240–255 Class E (experimental). Private addresses are the RFC 1918 ranges — 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 — which are not routable on the public internet. IP addresses identify the machine; to identify the browser on it, parse a user-agent string — the UA string names the browser, version, operating system and device.
Worked Example
192.168.1.0/24: the network address is 192.168.1.0 and the broadcast address is 192.168.1.255. The subnet mask is 255.255.255.0 and the wildcard mask is 0.0.0.255. There are 28 = 256 total addresses and 254 usable hosts, from 192.168.1.1 to 192.168.1.254. The first octet, 192, makes it Class C, and it falls in the 192.168.0.0/16 range, so it is private.
A second example: 10.0.0.0/26 has 26 = 64 total addresses and 62 usable hosts (10.0.0.1 to 10.0.0.62), with broadcast 10.0.0.63 and mask 255.255.255.192.
Assumptions
- IPv4 addresses only — IPv6 subnets use a different scheme and are not covered here.
- Usable hosts follow the classic rule: total addresses minus the network and broadcast addresses.
- A /31 has 2 total addresses and 0 usable hosts by the classic rule, but RFC 3021 allows both addresses to be used as host addresses on point-to-point links.
- A /32 is a single host address: the network and broadcast addresses are the address itself.
Common subnet sizes:
| CIDR | Subnet mask | Total addresses | Usable hosts |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /28 | 255.255.255.240 | 16 | 14 |
| /30 | 255.255.255.252 | 4 | 2 |
How to Use This Calculator
Enter an IPv4 address and a CIDR prefix from 0 to 32, or pick a netmask from the dropdown — the two stay in sync. Results update live, showing the network and broadcast addresses, both masks, the address count, the usable host range, the IP class and whether the address is private or public.
Tips and Practical Advice
When you size a subnet, count the hosts you need and pick the smallest prefix that fits them plus the two reserved addresses: 50 hosts need a /26 (62 usable), not a /25. For a home network, /24 is the usual choice — 254 usable hosts is plenty, and the boundaries are easy to read. And remember that private addresses only work inside your own network: to reach the internet they need address translation (NAT) at the router.
Sources: Private address ranges are defined in RFC 1918; the /31 point-to-point exception is RFC 3021. Last reviewed: 15 November 2026.
Built and tested by SumKitTool — see how we check our numbers.
Frequently Asked Questions
How many usable hosts are in a /24 subnet?
A /24 has 8 host bits, so 2⁸ = 256 total addresses. The network address and the broadcast address cannot be assigned to hosts, which leaves 254 usable hosts — for 192.168.1.0/24, that is 192.168.1.1 through 192.168.1.254.
What is the difference between a subnet mask and a wildcard mask?
The wildcard mask is the bitwise inverse of the subnet mask: where the subnet mask has a 1, the wildcard has a 0, and vice versa. For a /24, the subnet mask is 255.255.255.0 and the wildcard mask is 0.0.0.255. Wildcard masks are used in router access-control lists.
What makes an IP address private?
Private addresses fall in the ranges set aside by RFC 1918: 10.0.0.0/8, 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16. They are not routable on the public internet, so any network can reuse them internally behind NAT.
Can a /31 subnet have usable hosts?
By the classic rule, no — a /31 has only 2 addresses, and both would be reserved as the network and broadcast addresses. But RFC 3021 allows both addresses to be used as host addresses on point-to-point links, where no broadcast is needed, so /31s are common for router-to-router connections.
Last updated: