A subnet calculator works out everything you need to know about an IPv4 network from a single address. Type an address in CIDR notation, such as 192.168.1.10/24, and this subnet calculator shows the network address, the broadcast address, the first and last usable hosts, the subnet mask, the wildcard mask and the number of hosts. Network engineers use it to plan address space, students use it to check their homework, and administrators use it to confirm a firewall rule or a router setting. It runs in your browser, so your internal addresses aren't sent anywhere.
How to use the subnet calculator
- Enter an IPv4 address, with or without a slash and a prefix.
- If there's no slash, enter a prefix or a subnet mask in the second box.
- Press Calculate.
- Read the network details and copy what you need.
What is CIDR notation?
CIDR stands for Classless Inter-Domain Routing. CIDR notation is a compact representation of an IP address and its associated subnet mask. It consists of an IP address, a slash and a decimal number, and that number is the count of leading 1 bits in the mask. So, 192.0.2.0/24 means that the first 24 bits identify the network and the remaining 8 bits identify a host within it. Under CIDR, networks can be split on any bit boundary, which gives far finer control than the old system of fixed class A, B and C networks.
A worked example
Take the address 192.168.1.130/26. A prefix of 26 leaves 6 host bits, and 2 to the power of 6 is 64 addresses. The subnet mask is 255.255.255.192. Blocks of 64 begin at 0, 64, 128 and 192, so this address falls in the block that starts at 128. The network address is 192.168.1.128, the broadcast address is 192.168.1.191, the first usable host is 192.168.1.129 and the last is 192.168.1.190. That leaves 62 usable hosts.
Common subnet sizes
| Prefix | 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 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
How subnet math works
- Host bits = 32 − prefix
- Total addresses = 2 to the power of the host bits
- Network address = the IP address AND the subnet mask
- Broadcast address = the network address with every host bit set to 1
- Usable hosts = total addresses − 2
Two addresses are subtracted because the first is the network itself and the last is the broadcast address. Applying the mask with a bitwise AND to any address in a network gives you the routing prefix, which is why the binary view can be so helpful when you're learning.
Special cases: /31 and /32
A /32 refers to one single address, so it's used for a specific host, such as a loopback address or a firewall rule. A /31 contains exactly two addresses, and it's commonly used on point-to-point links, where no separate network or broadcast address is needed. The calculator treats both addresses in a /31 as usable.
Subnet masks and wildcard masks
A subnet mask marks the network bits with 1s and the host bits with 0s. A wildcard mask is simply the inverse, so 255.255.255.0 becomes 0.0.0.255. Some router access lists use wildcard masks in place of subnet masks. A valid subnet mask always has its 1 bits together on the left, so a value such as 255.0.255.0 is rejected by the calculator.
Private address ranges
Three blocks are reserved for private networks, and they aren't routed on the public internet.
- 10.0.0.0/8 runs from 10.0.0.0 to 10.255.255.255.
- 172.16.0.0/12 runs from 172.16.0.0 to 172.31.255.255.
- 192.168.0.0/16 runs from 192.168.0.0 to 192.168.255.255.
The calculator tells you whether an address is in one of these ranges. Most home and office networks use one of them.
Why split a network into subnets?
Subnetting makes large networks more manageable. Separating departments or device types limits how far broadcast traffic spreads, and it lets you apply different security rules to each group. It also reduces wasted addresses, because each subnet can be sized to the number of hosts that it actually needs. When planning, allow room to grow, since moving devices to a new range later on is much more work than choosing a slightly larger block at the start.
Working a subnet out by hand
It's worth knowing how to check an answer without a tool, especially for exams. Start with the prefix and find out how many bits fall in the last changing group of the address. For a /26, that's 2 bits in the final group, leaving 6 bits for hosts. Subtract the mask value from 256 to find the size of each block, so 256 − 192 = 64. Then count up in steps of that size until you pass your address. The block just before that point is your network. Once you've done this a few times, you can work out common networks in your head, and the calculator becomes a quick way to confirm your result.
Reading the binary view
The binary rows show the address and the mask one above the other. Wherever the mask has a 1, that bit of the address belongs to the network. Wherever it has a 0, that bit belongs to the host. Seeing the two lined up makes it clear why some addresses fall in one subnet and their neighbors fall in another.
Common mistakes
- Assigning the network or broadcast address to a device.
- Forgetting to subtract two when counting usable hosts.
- Mixing up prefix and mask. /24 and 255.255.255.0 mean the same thing.
Related developer tools
Convert bits with the binary to decimal converter, compare configurations with the diff checker, and check patterns with the regex tester.
What next
Use this often? Add Subnet to your Home screen.
Frequently asked questions
How does the subnet calculator work?
It applies the subnet mask to your address to find the network, the broadcast address and the host range.
What is a /24 network?
A network with 24 network bits and 8 host bits, giving 256 addresses and 254 usable hosts.
Is this a CIDR calculator?
Yes. Enter any address in CIDR notation, such as 10.0.0.5/16.
Why are there two fewer usable hosts?
The first address identifies the network, and the last is the broadcast address.
Does it support IPv6?
No. This calculator is for IPv4 addresses.
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.