Why use this calculator
Subnetting is binary arithmetic performed on numbers written in decimal, which is precisely why people get it wrong. Working out that 10.0.5.130/26 sits in the 10.0.5.128 network with a usable range ending at 10.0.5.190 requires converting to binary, masking, and converting back. Doable by hand and easy to fumble under pressure.
This calculator does it instantly and shows the working pieces you actually need: the mask to type into an interface config, the wildcard mask for an access control list, and the host range for a DHCP scope. It also flags whether the address is private, public or loopback, which catches a common planning mistake early.
How to use it
- Enter the four octets of the IP address and the CIDR prefix length. The number after the slash.
- Any address inside the subnet works: entering 192.168.1.10/24 or 192.168.1.200/24 both return the same network of 192.168.1.0, which is exactly the point, since the calculator derives the network from the address and mask rather than assuming you already know it.
- Prefixes from 0 to 32 are accepted, including the special cases of /31 for point-to-point links and /32 for a single host, both of which are handled correctly rather than reporting a negative host count.
What each result means
- Network address
- The first address in the block, identifying the subnet itself. It is not assignable to a host.
- Subnet mask
- The dotted-decimal form of the prefix, which is what most interface configurations and operating systems ask for.
- Usable host range
- The first and last addresses you can actually assign to devices. The range a DHCP scope sits inside.
- Broadcast address
- The last address in the block, reserved for broadcasting to every host on the subnet.
- Usable hosts
- How many devices the subnet can address. Remember the gateway takes one, so plan for hosts plus infrastructure.
- Total addresses in block
- Every address in the range including network and broadcast. The figure used when aggregating or splitting blocks.
- Wildcard mask
- The bitwise inverse of the subnet mask, used in Cisco access control lists and some routing configurations.
- Address scope
- Whether the address is private under RFC 1918, public, loopback or link-local. Worth checking before a network is built.
The formula
The address and mask are treated as 32-bit integers. The subnet mask is the top `prefix` bits set to one, which is 0xFFFFFFFF shifted left by (32 − prefix). The network address is the IP bitwise AND the mask; the broadcast address is the network bitwise OR the inverse of the mask. Total addresses in the block are 2 to the power of (32 − prefix), and usable hosts are that total minus two. One for the network address and one for broadcast. A /31 carries two usable addresses under RFC 3021 and a /32 is a single host, so neither subtracts two.
How this number is used in practice
The most common planning error is sizing a subnet exactly to today's device count. A /24 gives 254 usable addresses and feels generous until printers, access points, cameras, phones and guest devices arrive; a /26 gives 62 and fills faster than anyone expects. Renumbering a live network is disruptive enough that it is almost always cheaper to allocate generously from private space, which is effectively free.
Two reserved addresses catch people repeatedly. The network address and the broadcast address cannot be assigned to a host, which is why a /30 point-to-point link yields only two usable addresses out of four. RFC 3021 added the /31 specifically for point-to-point links, where both addresses are usable and the broadcast concept does not apply. A useful saving when you have many router-to-router links.
Private address space under RFC 1918 gives you 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 to work with. Almost every internal network uses it, which is also why 192.168.1.0/24 collides so often when two networks are joined by a VPN. Choosing a less common block from the 10.0.0.0/8 range at design time avoids a painful renumbering later.
Worked examples
192.168.1.10/24
Network 192.168.1.0, mask 255.255.255.0, usable range 192.168.1.1 to 192.168.1.254, 254 hosts.
10.0.5.130/26
Network 10.0.5.128, mask 255.255.255.192, usable range 10.0.5.129 to 10.0.5.190, 62 hosts.
172.16.40.1/30
Network 172.16.40.0, mask 255.255.255.252 and just 2 usable addresses. The classic point-to-point link.
When people use it
- Planning IP address allocation for a new network or VLAN
- Working out a DHCP scope range without overlapping infrastructure
- Checking which subnet an address belongs to during troubleshooting
- Converting between CIDR notation and a dotted-decimal subnet mask
- Producing the wildcard mask needed for an access control list
Tips
- The network and broadcast addresses are never assignable, which is why usable hosts is always two fewer than the block.
- Size subnets generously. A /24 gives 254 hosts and renumbering a live network later is far more painful than over-allocating now.
- Use a /31 for point-to-point links under RFC 3021. Both addresses are usable, unlike a /30.
- Avoid 192.168.1.0/24 for anything that might join a VPN; it collides with almost every home network.
- Each step up in prefix halves the block: /24 is 256 addresses, /25 is 128, /26 is 64.
- Reserve a predictable slice of every subnet for gateways, switches and printers before handing the rest to DHCP.
What it assumes, and where it stops being accurate
- IPv4 only. IPv6 uses a different address structure and is not handled here.
- Classless addressing (CIDR) is assumed throughout; the old class A, B and C boundaries are not applied.
- A /31 is treated as two usable addresses per RFC 3021, and a /32 as a single host.
- Variable length subnet masking and route aggregation across multiple blocks are outside scope.
- No check is made for whether an address is already in use on a live network.
Terms used on this page
- CIDR
- Classless inter-domain routing, where a prefix length replaces the old address classes.
- Network address
- The first address in a subnet, identifying the subnet itself and never assigned to a host.
- Broadcast address
- The last address in a subnet, used to reach every host on it at once.
- Wildcard mask
- The bitwise inverse of a subnet mask, used in access control lists.
- RFC 1918
- The standard reserving 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private use.
Questions people ask
- How many usable hosts are in a /24?
- 254. A /24 contains 256 total addresses, but the first is the network address and the last is the broadcast address, neither of which can be assigned to a device. The same rule applies at every prefix: a /26 has 64 addresses and 62 usable, a /30 has 4 and 2 usable.
- What does the slash number in an IP address mean?
- It is the CIDR prefix length. How many bits from the left identify the network rather than the host. A /24 means the first 24 bits are the network, leaving 8 bits for hosts, which gives 256 addresses. A higher number means a smaller network with fewer hosts.
- What is the difference between a subnet mask and a wildcard mask?
- They are bitwise inverses. A subnet mask of 255.255.255.0 has a wildcard mask of 0.0.0.255. Subnet masks are used in interface configuration to define the network; wildcard masks appear in Cisco access control lists and some routing protocol statements, where the bits to ignore are the ones set.
- Which IP ranges are private?
- Under RFC 1918: 10.0.0.0/8, 172.16.0.0/12 (that is 172.16 through 172.31) and 192.168.0.0/16. These are not routable on the public internet and can be used freely inside any organisation, which is why they appear on almost every internal network and why collisions happen when two networks are joined.
- Why can a /30 only have two usable addresses?
- A /30 contains four addresses, and the first and last are reserved as the network and broadcast addresses, leaving two for hosts. That is exactly enough for a router-to-router link, which is what it is normally used for. RFC 3021 introduced the /31 for the same purpose, using both addresses and wasting none.
- How do I choose a subnet size?
- Count current devices, then allow generously for growth. Phones, access points, cameras, printers and guest devices multiply faster than expected. Private address space costs nothing, so a /24 for a small office and a /22 or larger for a growing site is usually sensible. Renumbering a live network later is the expensive alternative.
Use this with
IPv4 Subnet Calculator answers one part of the question. These pick up where it stops: Number Base Converter, Data Storage Converter, Cloud Cost Comparison Calculator and IT Downtime Cost Calculator.
Where these figures come from
This calculation is jurisdiction-neutral arithmetic. No country-specific rules are applied.
- RFC 1918: address allocation for private internets. The private IPv4 ranges reserved for internal networks
- RFC 4632: classless inter-domain routing (CIDR). The CIDR addressing and aggregation standard
IPv4 Subnet Calculator produces an estimate for general information. It is not financial, tax, medical, legal or engineering advice. read the full disclaimer. Spotted a wrong number? Report it and it gets fixed. The form picks up this calculator and the inputs you used.