Guide
A subnet calculator takes one address and a prefix length, such as 192.168.1.10/24, and tells you which network that address sits in: where the block starts and ends, which addresses you can give to devices, and how the mask looks in every notation your router, firewall or cloud console might ask for. It handles IPv4 and IPv6.
How to use the subnet calculator
- Type an address with a CIDR prefix into the first box, for example
172.16.5.4/20or2001:db8:abcd:12::1/64. A dotted mask after the slash also works:10.0.0.0/255.0.0.0. - If you only have an address and a separate mask (common on Windows
ipconfigoutput), leave the slash out and put the mask in the second box, either dotted (255.255.0.0) or as a prefix (16or/16). The second box is ignored when the first already contains a slash. - Press Calculate. The result card appears above this guide, and the URL updates so you can bookmark or share the exact calculation.
- Click any prefix in the reference table below to see the full breakdown of a
10.0.0.0block of that size.
If you enter a bare address with no prefix and no mask, the calculator treats it as a single host (/32 for IPv4, /128 for IPv6). That is rarely what you want, so add the prefix your network actually uses.
Reading the results: a worked example
Here is what the card shows for 172.16.5.4/20, a typical size for a medium office or a cloud subnet:
| Field | Value | What it means |
|---|---|---|
| Network address | 172.16.0.0 | The first address of the block. It names the subnet and goes into route tables, not onto a device. |
| Prefix length | /20 | The first 20 bits are the network part; the remaining 12 bits number the hosts. |
| Subnet mask | 255.255.240.0 | The same /20 written in dotted form, as most operating systems and home routers expect it. |
| Wildcard mask | 0.0.15.255 | The mask inverted. Cisco ACLs and OSPF network statements use it. |
| Broadcast address | 172.16.15.255 | The last address, which reaches every host on the subnet at once. Shown for IPv4 only. |
| First / last usable host | 172.16.0.1 – 172.16.15.254 | The range you can hand out with DHCP or assign statically. |
| Total addresses / usable hosts | 4,096 / 4,094 | 2 to the power of 12 (4,096) addresses, minus the network and broadcast addresses. |
| Class | B | The historical classful label, based only on the first octet. Useful for exam questions, ignored by modern routing. |
| Reverse DNS zone | 0.0.16.172.in-addr.arpa | The reverse-DNS name of the network address, handy when you set up PTR records. |
| IP and mask in binary | 10101100.00010000.00000101.00000100 | Lets you see exactly where the 20 network bits stop. |
The badge next to the network shows the IP version and a scope such as Private, Public, Loopback or Carrier-grade NAT (shared). For IPv4 blocks of /30 or larger, the card also shows how the network splits into two and four smaller subnets (here 172.16.0.0/21 and 172.16.8.0/21, then four /22s), with up to four examples of each.
For IPv6 the card adds the fully expanded address and drops the broadcast and class rows, because IPv6 has neither. Every address in an IPv6 prefix counts as usable, so a /64 shows 18,446,744,073,709,551,616 for both totals.
IPv4 CIDR reference table
| CIDR | Subnet mask | Usable hosts |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /9 | 255.128.0.0 | 8,388,606 |
| /10 | 255.192.0.0 | 4,194,302 |
| /11 | 255.224.0.0 | 2,097,150 |
| /12 | 255.240.0.0 | 1,048,574 |
| /13 | 255.248.0.0 | 524,286 |
| /14 | 255.252.0.0 | 262,142 |
| /15 | 255.254.0.0 | 131,070 |
| /16 | 255.255.0.0 | 65,534 |
| /17 | 255.255.128.0 | 32,766 |
| /18 | 255.255.192.0 | 16,382 |
| /19 | 255.255.224.0 | 8,190 |
| /20 | 255.255.240.0 | 4,094 |
| /21 | 255.255.248.0 | 2,046 |
| /22 | 255.255.252.0 | 1,022 |
| /23 | 255.255.254.0 | 510 |
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
| /31 | 255.255.255.254 | 2 |
| /32 | 255.255.255.255 | 1 |
Practical scenarios
Planning a cloud VPC or office network
Work out how many devices each segment needs, add room to grow, then pick the smallest prefix that fits. A segment for 300 devices needs a /23 (510 usable hosts), because a /24 stops at 254. Check the split rows to see how a larger block divides cleanly. Cloud providers usually reserve a few extra addresses in every subnet on top of network and broadcast, so leave a margin. To check whether a list of blocks overlaps, paste them into the CIDR to IP range converter, which merges overlapping and adjacent ranges.
Two devices cannot reach each other
Enter each device's address with its own mask. If the network addresses differ, the devices are on different subnets and traffic must go through a router. A classic mistake is one machine set to /24 and another to /16 on the same switch: one of them thinks the other is local and the other does not. The default gateway guide explains what happens to traffic that leaves the subnet.
Writing firewall rules and ACLs
Firewalls usually want CIDR notation, while Cisco ACLs want the network address plus the wildcard mask, for example permit ip 172.16.0.0 0.0.15.255 any. Copy the network address with the copy button and the wildcard from the card so the rule matches the whole block and nothing more.
Is this address private or public?
The scope badge gives a quick answer. For the exact special-purpose range and the RFC that defines it, use the IP address type checker. Our guide to public vs private IP addresses covers why RFC 1918 ranges never appear on the internet.
Limits and edge cases
- Non-contiguous masks like
255.0.255.0are rejected. They are not valid in modern IP networking. - Host bits are kept. If you type
192.168.1.10/24, the card shows your address and its network192.168.1.0/24; it does not complain that host bits are set. - The split preview only appears for IPv4 and only goes two levels down. Use the reference table, or run the calculator again on a smaller prefix, for deeper plans.
- Reverse zone: the value is the reverse name of the network address. The zone you actually get delegated depends on your ISP or hosting provider and is usually on an octet boundary, for example
1.168.192.in-addr.arpafor a /24.
Privacy
The calculation is pure arithmetic done on our server. No lookups are sent to DNS, WHOIS or any outside service. To see how the tool is used, we keep the address you enter in a usage log for up to 90 days, together with your IP address. It also appears in the page URL, so it can show up in your browser history.
Want the full explanation with worked examples? Read Subnet masks and CIDR notation made simple.
Frequently asked questions
What subnet size should I use for my home or office?
A /24 (254 usable hosts) suits almost any home or small office. Larger networks are usually split into several /24s per floor, department or VLAN, which keeps broadcast traffic down and makes firewall rules easier to read.
What is the standard IPv6 subnet size?
A /64 for every LAN segment, because SLAAC address autoconfiguration needs 64 host bits (RFC 4291). ISPs typically delegate a /56 or /48 to each customer, giving 256 or 65,536 /64 subnets.
How do I convert a subnet mask to CIDR?
Count the 1 bits in the mask: 255.255.255.0 has 24, so it is /24. Each 255 is 8 bits, and the common partial octets are 128 (1 bit), 192 (2), 224 (3), 240 (4), 248 (5), 252 (6) and 254 (7). Enter the address and mask in the two boxes and the calculator shows the prefix for you.
Why are there two fewer usable hosts than addresses?
In IPv4 the first address identifies the network and the last is the broadcast address, so neither can be assigned to a device. The exceptions are /31 point-to-point links and /32 single hosts. IPv6 has no broadcast address, so the calculator counts every address in the prefix.
What is a wildcard mask used for?
A wildcard mask is the subnet mask with every bit flipped, so 255.255.240.0 becomes 0.0.15.255. Cisco IOS uses it in access lists and OSPF to say which bits must match (0) and which can be anything (1).
Updated
Comments
Share a tip, ask a question or tell others how the tool worked for you.