
How to Use the IP Subnet Calculator

- Type an IPv4 or IPv6 address. You can include the prefix, like 10.0.0.1/16.
- Set the CIDR prefix length if you did not type it with the address.
- Pick a longer prefix to split the network into smaller subnets.
- Read the network address, then the host range, broadcast, masks and binary view.
Type an IPv4 address with its prefix length in CIDR notation, such as 192.168.1.10/24, or enter the prefix separately in its own field. The calculator reads either format and updates every result as you type.
It shows the network address, the broadcast address, the usable host range, the subnet mask and the wildcard mask. It also labels the address type, such as private, public, loopback, link-local, shared or documentation space.
Pick a larger prefix in the split menu to divide the network into subnets, listed in a table. The example buttons load common cases, including a point-to-point /30, a carrier block and an IPv6 /48.
CIDR Notation and Subnet Masks
An IPv4 address is 32 bits, written as four octets in dotted decimal. The prefix length says how many bits, from the left, identify the network. The remaining host bits identify devices on that network.
network = address AND mask
broadcast = network OR (NOT mask)
usable hosts = 2(32 − prefix) − 2
A /24 keeps 24 network bits and leaves 8 host bits, which equals the subnet mask 255.255.255.0. Classless Inter-Domain Routing replaced fixed address classes, so any prefix length from /0 to /32 is valid today.
The network address comes from a bitwise AND of the address and mask. The wildcard mask inverts the subnet mask for Cisco access control lists and OSPF, where a 1 bit can match any value.
Worked Example: 10.20.30.40/13
A /13 mask has 13 one bits, which gives 255.248.0.0. The second octet of the address, 20, is 00010100 in binary. Keeping only its top 5 bits, because 13 minus 8 equals 5, gives 00010000.
That binary value is 16, so the network address is 10.16.0.0/13 and the broadcast address is 10.23.255.255. The block size in the second octet is 8, which is exactly why the range ends at 23.
There are 219 = 524,288 total addresses, of which 524,286 are usable hosts. The first usable address is 10.16.0.1 and the last usable address is 10.23.255.254. Python's ipaddress module confirms exactly the same result independently.
Splitting a Network Into Smaller Subnets
Subnetting divides one network into smaller pieces. Each subnet is its own broadcast domain, so traffic stays local, and each network segment can get its own firewall rules, for example isolating guests from office servers.
Choose a longer prefix to cut the network into equal subnets. Every extra bit doubles the number of subnets and halves their size, so a /26 split into /28 blocks gives exactly four smaller subnets.
For 203.0.113.77/26, the parent network is 203.0.113.64/26, and the four /28 subnets start at .64, .80, .96 and .112. VLSM, variable length subnet masking, instead mixes subnet sizes to match each segment's real host needs.
Subnet Cheat Sheet
| Prefix | Subnet mask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /24 | 255.255.255.0 | 256 | 254 |
| /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 |
| /31 | 255.255.255.254 | 2 | 2 (point-to-point) |
| /32 | 255.255.255.255 | 1 | 1 (host route) |
This cheat sheet lists the most common IPv4 prefixes. Each step down the table halves the addresses, and usable hosts are always two fewer than the total, because the network and broadcast addresses are reserved.
Two prefixes break that rule. RFC 3021 lets a /31 use both addresses on a point-to-point link, where no broadcast is needed, and a /32 identifies a host route or loopback interface on a router.
A /24 remains the usual office or home LAN size, with 254 usable hosts. A /30 was the traditional choice for links between two routers, though many networks now use a /31 to save addresses.
Private and Special Address Ranges
- Private (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, used behind a home or office router.
- Shared address space: 100.64.0.0/10, used by internet providers for carrier-grade NAT.
- Loopback: 127.0.0.0/8, where 127.0.0.1 always means this computer.
- Link-local: 169.254.0.0/16, self-assigned when no DHCP server answers.
- Documentation: 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24, reserved for examples.
A private IP address cannot be routed on the public internet, so your router translates it to a public address with NAT. The three ranges come from RFC 1918, and the calculator flags them automatically.
The full list of reserved blocks, including the documentation range used in examples, lives in the IANA special-purpose address registry. Always check it before assigning unusual or unfamiliar ranges to real devices on a network.
The old address classes A, B and C appear for reference only. Modern networks use classless routing, so the prefix length, not the first octet, decides how large a network is and where it ends.
IPv6 Prefixes
IPv6 addresses are 128 bits long and have no broadcast address, so no addresses are lost to network and broadcast reservations. Almost every local network uses a /64, which lets devices configure their own addresses.
A typical allocation of /48, often given to one site, contains 65,536 of those /64 networks. Enter 2001:db8:abcd:12::1/48 and the calculator shows the network 2001:db8:abcd::/48 along with the first and last addresses of the range.
It also prints the expanded form, with all eight groups of four hex digits, and the compressed form that follows RFC 5952 rules: lowercase letters, no leading zeros and only the longest zero run shortened.
Frequently asked questions
How many hosts are in a /24 subnet?
A /24 has 256 addresses. Two are reserved for the network address and the broadcast address, which leaves 254 usable hosts, for example 192.168.1.1 to 192.168.1.254.
What subnet mask is /27?
A /27 is 255.255.255.224. It contains 32 addresses and 30 usable hosts, and a /24 network can be split into eight /27 subnets of equal size.
What is a wildcard mask?
It is the subnet mask with every bit flipped, for example 0.0.0.255 for a /24. Cisco routers use it in access control lists and OSPF to mark which bits can vary.
Why does a /31 have two usable hosts?
RFC 3021 allows /31 networks on point-to-point links, where no broadcast address is needed. Both addresses can then be assigned to the two ends of the link, saving address space.
Is 172.20.0.1 a private IP address?
Yes. The private block 172.16.0.0/12 covers 172.16.0.0 to 172.31.255.255, so 172.20.0.1 is private and cannot be routed directly on the public internet without address translation.
How do I calculate the number of hosts in a subnet?
Subtract the prefix from 32 to get the host bits, raise 2 to that power, then subtract 2 for the network and broadcast addresses. A /26 gives 2 to the 6th minus 2, or 62.