How to Calculate a Subnet
Working out a subnet takes only a few seconds, whether you are configuring a router, planning a VLAN, writing a firewall rule or studying for a networking exam.
- Choose IPv4 or IPv6.
- Type an IP address with its prefix length, such as 192.168.1.10/24 or 2001:db8::1/64. For IPv4 you can also type a subnet mask or pick one from the list.
- Press Calculate (or Enter). The network address, broadcast address, usable host range, number of hosts and masks appear instantly.
- Check the binary view to see which bits belong to the network and which belong to hosts.
- Optionally choose a smaller subnet size under Divide Into Subnets to list every subnet, then press Copy results or Copy link to save or share the calculation.
How Subnetting Works
An IPv4 address is 32 bits long, written as four decimal numbers (octets) from 0 to 255. The prefix length or subnet mask splits those bits into two parts: the leading network bits, which are the same for every device on the subnet, and the trailing host bits, which identify each device.
- The network address is the address with all host bits set to 0 (a bitwise AND of the address and the mask).
- The broadcast address is the address with all host bits set to 1.
- The usable hosts are every address in between: 2host bits − 2.
For example, here is how 192.168.10.77/26 is calculated. A /26 has 26 network bits and 6 host bits, so the subnet holds 26 = 64 addresses and 62 usable hosts:
Address 192.168.10.77 11000000.10101000.00001010.01001101
Mask /26 255.255.255.192 11111111.11111111.11111111.11000000
Network 192.168.10.64 11000000.10101000.00001010.01000000
Broadcast 192.168.10.127 11000000.10101000.00001010.01111111
Hosts 192.168.10.65 - 192.168.10.126 (62 usable)
A quick way to check this in your head is the block size: 256 minus the last non-255 octet of the mask (256 − 192 = 64). Subnets start at multiples of the block size (0, 64, 128, 192), so 77 falls in the subnet that starts at 64.
IPv6 works the same way with 128-bit addresses written in hexadecimal. The difference is in the numbers: a single IPv6 /64 subnet holds 18,446,744,073,709,551,616 addresses, and IPv6 has no broadcast address, so the first and last addresses of the range are usable too.
IPv4 CIDR Cheat Sheet
Every IPv4 prefix length with its subnet mask, wildcard mask, number of addresses and number of usable hosts. The most common sizes are highlighted.
| CIDR | Subnet mask | Wildcard mask | Addresses | Usable hosts |
|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 |
| /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 |
A /31 has two usable addresses for point-to-point links between routers (RFC 3021), and a /32 is a single host, such as a loopback address or a host route.
IPv6 Prefix Sizes
IPv6 networks are planned in /64 subnets. These are the prefix lengths you will see most often:
| Prefix | Number of /64 subnets | Typical use |
|---|---|---|
| /32 | 4,294,967,296 | Allocation to an internet service provider (ISP) or large organization |
| /40 | 16,777,216 | Large enterprise or regional network |
| /48 | 65,536 | A single site, such as a business or campus |
| /56 | 256 | A home or small office internet connection |
| /60 | 16 | Some home internet connections |
| /64 | 1 | A single subnet (LAN or VLAN); required for SLAAC |
| /127 | – | Point-to-point link between routers (RFC 6164) |
| /128 | – | A single address, such as a loopback or host route |
Private and Special-Purpose Address Ranges
These ranges are reserved by the IETF and IANA. The calculator identifies them automatically in the Address type result.
| Range | Type | Defined in |
|---|---|---|
| 10.0.0.0/8 | Private network | RFC 1918 |
| 172.16.0.0/12 | Private network | RFC 1918 |
| 192.168.0.0/16 | Private network | RFC 1918 |
| 100.64.0.0/10 | Shared address space (carrier-grade NAT) | RFC 6598 |
| 127.0.0.0/8 | Loopback | RFC 1122 |
| 169.254.0.0/16 | Link-local (automatic private IP addressing) | RFC 3927 |
| 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | Documentation and examples | RFC 5737 |
| 198.18.0.0/15 | Network benchmarking | RFC 2544 |
| 224.0.0.0/4 | Multicast | RFC 5771 |
| 240.0.0.0/4 | Reserved for future use | RFC 1112 |
| fc00::/7 | IPv6 unique local addresses (private) | RFC 4193 |
| fe80::/10 | IPv6 link-local | RFC 4291 |
| ::1/128 | IPv6 loopback | RFC 4291 |
| 2001:db8::/32 | IPv6 documentation and examples | RFC 3849 |
| ff00::/8 | IPv6 multicast | RFC 4291 |
| 2000::/3 | IPv6 global unicast (public) | RFC 4291 |
Popular Uses
- Network design: size subnets and VLANs for offices, data centers and cloud virtual networks (Azure VNets, AWS VPCs and Google Cloud VPCs).
- Router and firewall configuration: get the network address, subnet mask and wildcard mask for interfaces, routes, ACLs and OSPF.
- Troubleshooting: check whether two devices are on the same subnet, or why an address is not reachable.
- IPv6 planning: break a /48 or /56 into /64 subnets and find the reverse DNS zone to delegate.
- Certification study: practice and check subnetting answers for CompTIA Network+, Cisco CCNA and similar exams.
Frequently Asked Questions
What is a subnet calculator?
A subnet calculator works out the details of an IP network from an IP address and a prefix length or subnet mask. It shows the network address, the broadcast address, the first and last usable host addresses, how many addresses and hosts the subnet holds, and the subnet and wildcard masks, so you can plan and configure networks without doing binary math by hand.
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation writes an IP network as an address followed by a slash and the number of network bits, such as 192.168.1.0/24. The number after the slash is the prefix length: /24 means the first 24 of the 32 bits identify the network and the remaining 8 bits identify hosts, which is the same as the subnet mask 255.255.255.0.
How many usable hosts are in a /24 subnet?
A /24 IPv4 subnet has 256 addresses and 254 usable hosts. The first address is the network address and the last is the broadcast address, so neither can be assigned to a device. In general, an IPv4 subnet with prefix length n has 2 to the power of (32 - n) addresses and 2 to the power of (32 - n) minus 2 usable hosts, except /31, which has 2 usable addresses for point-to-point links (RFC 3021), and /32, which is a single host.
How do I find the network address and broadcast address?
Write the IP address and the subnet mask in binary and combine them with a bitwise AND to get the network address. Set all of the host bits (the bits that are 0 in the mask) to 1 to get the broadcast address. For example, 192.168.1.10/24 has the network address 192.168.1.0 and the broadcast address 192.168.1.255. The calculator does this for you and shows the bits in color.
What is a wildcard mask?
A wildcard mask is the inverse of a subnet mask: every 1 in the subnet mask becomes a 0 and every 0 becomes a 1. The wildcard mask for 255.255.255.0 is 0.0.0.255. Wildcard masks are used in Cisco access control lists (ACLs) and in OSPF network statements to match a range of addresses.
How do I divide a network into smaller subnets?
Choose a longer prefix length. Each extra bit doubles the number of subnets and halves their size, so a /24 can be divided into two /25s, four /26s, eight /27s and so on. In the calculator, calculate the network, then choose the new subnet size under Divide Into Subnets to list every subnet with its network address, host range and broadcast address.
How does IPv6 subnetting work?
IPv6 addresses are 128 bits long and are written as eight groups of four hexadecimal digits. Networks are still written in CIDR notation, such as 2001:db8:abcd::/48. A /64 is the standard size of a single IPv6 subnet (LAN), a site is usually assigned a /48 or /56, which holds 65,536 or 256 /64 subnets, and IPv6 has no broadcast address, so every address in the range can be used.
What are the private IPv4 address ranges?
The private IPv4 ranges defined in RFC 1918 are 10.0.0.0/8 (10.0.0.0 to 10.255.255.255), 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16 (192.168.0.0 to 192.168.255.255). They are used on home and business networks and are not routed on the public internet. 100.64.0.0/10 is reserved for carrier-grade NAT, and the IPv6 equivalent of private addresses is fc00::/7 (unique local addresses).
Can I enter a subnet mask instead of a prefix length?
Yes. For IPv4 you can type the address followed by a subnet mask, such as 192.168.1.10 255.255.255.0 or 192.168.1.10/255.255.255.0, or choose the mask from the list. The calculator converts it to the matching prefix length and rejects masks that are not contiguous.
Does it work on iPhone, iPad and Safari, and is my data sent anywhere?
The subnet calculator works in Safari on Mac, iPhone and iPad, as well as Chrome, Edge, Firefox and Samsung Internet on desktop and mobile. All of the calculations run in your browser with JavaScript, so the addresses you enter are never sent to a server or stored.