IP Subnet Calculator
Find hosts and addresses from a CIDR prefix.
The prefix length after the slash, 0 to 32.
Results update as you type.
How it works
An IP subnet calculator turns a CIDR prefix, the number after the slash in an address like 192.168.1.0/24, into the practical figures a network engineer needs: how many total addresses the block contains, how many are usable for actual devices, and how many host bits remain. Because IPv4 addresses are 32 bits long, the prefix length directly determines the size of the subnet, and this tool does the powers-of-two arithmetic instantly. This matters whenever you design or troubleshoot a network. Choosing the right prefix decides whether a subnet has enough addresses for every device with a little room to grow, without wastefully carving out a block far larger than needed. A /24, for example, gives 254 usable hosts, a familiar size for a small office, while a /30 gives just two, ideal for a point-to-point link. The formula works because each host bit doubles the address count, so two raised to the host-bit power counts every address, and subtracting the reserved network and broadcast addresses leaves the usable hosts. The special cases /31 and /32 follow modern conventions for point-to-point links and single hosts. Network administrators, students studying for certifications, and anyone planning IP allocations rely on a subnet calculator to size blocks correctly.
total = 2^(32 − n) · usable = total − 2
An IPv4 address is 32 bits, and a CIDR prefix of n fixes the first n bits for the network, leaving 32 − n host bits. Each host bit doubles the count, so two raised to the power of the host bits gives every address in the block. Two are then reserved — the network and broadcast addresses — so usable hosts equal the total minus two, except for the special /31 and /32 cases.
Source:Standard IPv4 addressing (CIDR)
We review all our tools from time to time to ensure accuracy.
Worked example
How to use this calculator
- 1
Enter your values
Enter cidr prefix.
- 2
Adjust the options
Fine-tune any options to match your situation.
- 3
Read your result
Usable hosts updates instantly as you type — no button to press.
Frequently asked questions
Why are two addresses subtracted for usable hosts?
In a normal subnet, the first address is the network identifier and the last is the broadcast address, and neither can be assigned to a device. That is why a block of 256 addresses, such as a /24, offers 254 usable hosts. The two reserved addresses let routers identify the subnet and send traffic to every host at once, so they are unavailable for individual machines.
What is special about /31 and /32?
A /32 represents a single host, with exactly one usable address, and is common for loopbacks or host routes. A /31 has only two addresses, and modern practice allows both to be used on point-to-point links, so it reports two usable hosts rather than zero. These conventions avoid wasting addresses on links between just two routers, where a full subnet with reserved addresses would be inefficient.
What does the CIDR prefix number mean?
The CIDR prefix is the number after the slash and states how many of the 32 bits in an IPv4 address are fixed as the network portion. A larger number means more network bits and fewer host bits, so a smaller subnet. A /24 fixes 24 bits and leaves 8 for hosts, while a /16 leaves 16 host bits and covers far more addresses.
How do I pick the right subnet size?
Count the devices you need to address, then choose the smallest prefix that leaves enough usable hosts plus room to grow. For 50 devices, a /26 with 62 usable hosts fits comfortably. Avoid oversizing, which wastes address space, and undersizing, which forces renumbering later. The calculator lets you test prefixes quickly so you can match the block to your real host count.
Does this work for IPv6 as well?
No, this calculator is built for IPv4, which uses 32-bit addresses and prefixes from 0 to 32. IPv6 uses 128-bit addresses and much larger prefixes, and it does not reserve network and broadcast addresses the same way, so subnet math differs. For IPv6 planning you would work with the vastly larger address counts and different conventions that its 128-bit structure allows.