Subnet Calculator: Network, Broadcast, Host Range and Mask, With the Working Shown
Type an address with a prefix or a mask. The answer updates as you type, and the working shows why.
The working
192.168.10.37 in binaryHow do you calculate a subnet?
Take the prefix length, for example /27, and work out the block size: 2 to the power of (32 minus 27) equals 32 addresses. Networks start at multiples of 32 in the last octet, so 192.168.10.37/27 sits in 192.168.10.32 to .63. The first address is the network, the last is broadcast, and 30 hosts remain.
Every calculator answer comes from those three moves: find the block size, find the multiple at or below your address, and count to the next one. The binary strip above shows the same thing bit by bit. Everything to the left of the line is fixed by the prefix; everything to the right is free for hosts.
Worked example: 203.0.113.77/26
A /26 leaves 6 host bits, so the block size is 26 = 64. The networks in the last octet are .0, .64, .128 and .192. 77 sits between 64 and 127, so the network is 203.0.113.64, the broadcast is 203.0.113.127, and the 62 usable hosts run from .65 to .126.
203.0.113.0/24 is TEST-NET-3, reserved for documentation by RFC 5737, so it never collides with a real network.
which I often do to find the top and bottom of a given /27
How many usable hosts are in a subnet?
Usable hosts equal 2 to the power of the host bits, minus 2 for the network and broadcast addresses. A /24 has 254, a /26 has 62, a /29 has 6. Exceptions: a /31 point-to-point link uses both addresses, and AWS and Azure reserve 5 addresses per subnet, GCP reserves 4.
The cloud rule is the one that catches people. Plan a /28 for 14 instances on AWS and you will run out at 11. Switch the calculator to Cloud mode before you size a VPC subnet.
The first four IP addresses and the last IP address in each subnet CIDR block are not available for your use
How do you split a network into equal subnets?
Borrow host bits. Every bit you add to the prefix doubles the number of subnets and halves their size. Splitting a /24 into 4 equal subnets needs 2 extra bits, so you get four /26 networks of 64 addresses each: .0, .64, .128 and .192.
| # | Network | Usable range | Broadcast | Hosts |
|---|---|---|---|---|
| 1 | 192.168.40.0/26 | 192.168.40.1 to .62 | 192.168.40.63 | 62 |
| 2 | 192.168.40.64/26 | 192.168.40.65 to .126 | 192.168.40.127 | 62 |
| 3 | 192.168.40.128/26 | 192.168.40.129 to .190 | 192.168.40.191 | 62 |
| 4 | 192.168.40.192/26 | 192.168.40.193 to .254 | 192.168.40.255 | 62 |
How do you plan subnets by host count (VLSM)?
List each group with the hosts it needs plus growth, round each up to the next power of two (counting the network and broadcast), then allocate from the largest down. Largest first keeps every block on a clean boundary, so nothing overlaps and the leftover space stays in one piece.
Start with the largest network
| Group | Need | Subnet | Usable range | Spare |
|---|---|---|---|---|
| Clients | 97 | 192.168.40.0/25 | 192.168.40.1 to .126 | 29 |
| Servers | 18 (12 +50%) | 192.168.40.128/27 | 192.168.40.129 to .158 | 12 |
| Switches | 9 | 192.168.40.160/28 | 192.168.40.161 to .174 | 5 |
Is this IP in that subnet? Do these blocks overlap?
An address belongs to a subnet when it falls between the network and broadcast addresses, which is the same as having identical network bits. Two blocks overlap when one block's range touches the other's. Overlaps break VPNs and site-to-site links, so check every plan before a merger or a new tunnel.
lots and lots of overlapping 10./8 allocations
How does IPv6 subnetting work?
In IPv6 you count /64 networks, not hosts. Every LAN gets a /64 because SLAAC needs it, so a site with a /48 has 65,536 LANs to hand out and a home with a /56 has 256. Point-to-point links use a /127, though some older gear still wants a /126.
Normally I'd use the subnet calculator on MXToolbox's website for convenience but it doesn't support IPv6.
you need to assign a /126 on PtP links for some gear, instead of a /127
What about /31, /32 and addresses ending in .255?
A /31 has no network or broadcast address: RFC 3021 lets both addresses work on point-to-point links. A /32 is one address, used for loopbacks and host routes. An address ending in .255 is only a broadcast when it is the last address of its subnet; inside a /16 it is an ordinary host.
Point-to-point link
Two usable addresses, .0 and .1, one per router. Saves half the space of a /30.
Loopback or host route
A single address. Routers use it for stable router IDs that never go down with an interface.
A valid .255 host
The broadcast of 10.0.0.0/16 is 10.0.255.255. Here .255 is just another host.
/32 means that the network has only a single IPv4 address
CIDR to subnet mask table
The rows most exam questions and most office networks use. For the printable /8 to /32 sheet and a way to redraw it from memory, see the subnetting cheat sheet.
| CIDR | Subnet mask | Wildcard | Addresses | Usable |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
Private and special IPv4 ranges
The calculator flags these automatically. Private means "not routed on the public internet", not "on this LAN": two companies can both use 10.0.0.0/8, which is exactly why mergers end in renumbering.
| Block | What it is for | RFC |
|---|---|---|
| 10.0.0.0/8 | Private network | 1918 |
| 172.16.0.0/12 | Private network (172.16.0.0 to 172.31.255.255) | 1918 |
| 192.168.0.0/16 | Private network | 1918 |
| 100.64.0.0/10 | Shared space for carrier-grade NAT | 6598 |
| 169.254.0.0/16 | Link-local: a host that got no DHCP answer | 3927 |
| 127.0.0.0/8 | Loopback | 1122 |
| 192.0.2.0/24 | Documentation (TEST-NET-1) | 5737 |
| 198.51.100.0/24 | Documentation (TEST-NET-2) | 5737 |
| 203.0.113.0/24 | Documentation (TEST-NET-3) | 5737 |
| 224.0.0.0/4 | Multicast | 5771 |
RFC1918 addresses mean "local" network is wrong. It means "private".
The same answer from the command line
Useful on a jump host with no browser. All three print the network, broadcast and host count for the address in the calculator.
$ ipcalc 192.168.10.37/27 Network: 192.168.10.32/27 Broadcast: 192.168.10.63 Hosts/Net: 30
$ python3 -c "import ipaddress as i; n=i.ip_interface('192.168.10.37/27').network; print(n, n.broadcast_address, n.num_addresses-2)" 192.168.10.32/27 192.168.10.63 30
PS> ([ipaddress](([ipaddress]'192.168.10.37').Address -band ([ipaddress]'255.255.255.224').Address)).IPAddressToString 192.168.10.32
Questions people ask
What is a /24 subnet?
A /24 has 24 network bits and 8 host bits: 256 addresses, mask 255.255.255.0, and 254 usable hosts. It is the classic office LAN size.
What subnet mask is /17?
255.255.128.0. It holds 32,768 addresses and 32,766 usable hosts. A chatbot once answered this one wrong in a widely shared thread, which is why a deterministic calculator still matters.
How many IPs are in a /16?
65,536 addresses, of which 65,534 are usable hosts. On AWS, 65,531.
Why does AWS show fewer usable IPs?
AWS keeps five addresses in every subnet: the network, the VPC router, DNS, one reserved for future use, and the last address. Azure also keeps five (the network, the gateway, two for DNS and the last address). Google Cloud keeps four.
What is the difference between CIDR and a subnet mask?
They carry the same information. /27 counts the network bits; 255.255.255.224 writes the same 27 ones as four decimal octets.
Can a host address end in .255?
Yes, whenever it is not the last address of its subnet. 10.0.0.255 is a normal host in 10.0.0.0/16.
Is 172.16.0.0/12 private?
Yes. RFC 1918 reserves 172.16.0.0 to 172.31.255.255 for private networks. 172.32.0.0 is public.
Can you do it without the calculator?
Exams give you a whiteboard, not a browser. The subnetting practice generator gives unlimited questions with the same binary working, and when you are ready for the full exam format, try these Network+ practice questions.
Subnetting cheat sheet and practice
The full /8 to /32 chart on one printable page, how to redraw it from memory in 90 seconds, and unlimited practice.