Subnet Calculator
A /24 subnet contains 256 total addresses and 254 usable hosts, because the network and broadcast addresses are reserved. This subnet calculator takes any IPv4 address and CIDR prefix and returns the subnet mask, network address, broadcast address, first usable host, last usable host, and total usable host count. Enter an address like 192.168.1.34 with a prefix like /24, and the tool works out exactly which block of addresses that network covers and where the assignable range starts and ends. It is built for network engineers, sysadmins, students studying for certification exams, and anyone configuring routers, firewalls, or DHCP scopes who needs a fast, accurate answer instead of working through binary math by hand.
Quick answer
The network address is the first address in a subnet and identifies the subnet as a whole. It cannot be assigned to a device.
What this tells you
- •The network address is the first address in a subnet and identifies the subnet as a whole. It cannot be assigned to a device.
- •The broadcast address is the last address in a subnet and is reserved for sending a message to every host on that subnet at once.
- •Usable hosts are every address between the network and broadcast addresses, so a standard subnet's usable count is always the total address count minus 2.
- •The subnet mask (or its CIDR equivalent, like /26) sets the boundary between the network portion of the address and the host portion.
- •Smaller CIDR numbers describe bigger networks with more hosts, while larger CIDR numbers describe smaller networks with fewer hosts.
- •The two edge cases, /31 and /32, do not follow the normal network/broadcast/host pattern because there is no room to reserve those addresses.
How to Use
- 1Enter a valid IPv4 address in dotted-decimal form, such as 192.168.1.34 or 10.0.5.130.
- 2Enter the CIDR prefix length, a number from 0 to 32, that describes how many leading bits belong to the network. 24 is a common default for small local networks.
- 3Click Calculate to run the subnet math against the address and prefix you entered.
- 4Read the network address, broadcast address, subnet mask, first host, last host, and usable host count from the results.
- 5If you are planning an actual network, double-check the CIDR prefix against your ISP documentation, router configuration, or IP allocation plan before applying the result to live equipment.
How It Works
Formula
Mask = 32 leading 1-bits set by CIDR, Network = IP AND Mask, Broadcast = Network OR (NOT Mask)Every IPv4 address is really a 32-bit number split into a network portion and a host portion. The CIDR prefix says how many of those 32 bits belong to the network. A /24 prefix sets the first 24 bits to 1 and the remaining 8 bits to 0, which produces the subnet mask 255.255.255.0. To find the network address, the calculator applies a bitwise AND between the IP address and the mask, which clears every host bit to 0 and leaves the network's starting address. To find the broadcast address, it flips the mask (turning every network bit to 0 and every host bit to 1) and applies a bitwise OR against the network address, which sets every host bit to 1 and produces the subnet's last address. The number of host bits is 32 minus the CIDR prefix, so the subnet holds 2 raised to that power total addresses. Because the network and broadcast addresses are both reserved in a standard subnet, the usable host count is that total minus 2. The two exceptions are /31, a point-to-point link where RFC 3021 allows both addresses to be used as hosts with 0 addresses set aside, and /32, a single host route with exactly one address and 0 usable hosts in the range sense.
Calculation note: values are processed in the order shown above, using the current input units.
Worked Examples
Typical /24 home or office subnet
A /24 prefix leaves 8 host bits, giving 256 total addresses from 192.168.1.0 through 192.168.1.255. The network address is 192.168.1.0 and the broadcast address is 192.168.1.255, so the usable range runs from 192.168.1.1 to 192.168.1.254, which is 254 assignable addresses. This is the default subnet size for most home routers and small office networks.
Split network with a /26 prefix
A /26 prefix leaves 6 host bits, so each block covers 64 addresses. The address 10.0.5.130 falls inside the block that starts at 10.0.5.128, and that block's broadcast address is 10.0.5.191. Subtracting the network and broadcast addresses from the 64 total leaves 62 usable hosts, first host 10.0.5.129 and last host 10.0.5.190. Administrators use /26 blocks like this to split a /24 into four smaller subnets, often one per floor, VLAN, or department.
Wider /20 subnet for a growing network
A /20 prefix leaves 12 host bits, producing 4096 total addresses per block. The address 172.16.10.5 belongs to the block starting at 172.16.0.0 and ending at 172.16.15.255, giving 4094 usable addresses after removing the network and broadcast addresses. This size is common in larger office or campus networks where hundreds of devices need addresses inside a single subnet.
Small /28 subnet for a device cluster
A /28 prefix leaves only 4 host bits, so the block covers 16 total addresses. The address 203.0.113.77 sits in the block from 203.0.113.64 to 203.0.113.79, leaving usable hosts from 203.0.113.65 to 203.0.113.78, which is 14 addresses. Small blocks like this are typical for a rack of servers, a wireless access point cluster, or a small branch office.
Point-to-point /30 link between two routers
A /30 prefix leaves 2 host bits, giving exactly 4 total addresses, the smallest block that still follows the normal network and broadcast pattern. The network address is 192.168.5.8 and the broadcast address is 192.168.5.11, leaving exactly 2 usable addresses, 192.168.5.9 and 192.168.5.10. This size is the classic choice for a serial or WAN link that only ever connects two routers.
Edge case: /31 point-to-point link
A /31 prefix leaves just 1 host bit, so the block has only 2 addresses total. Under the classic network/broadcast rule there would be 0 usable hosts, but RFC 3021 defines /31 specifically for point-to-point links and allows both 10.10.10.10 and 10.10.10.11 to be assigned to the two endpoints. This is why the calculator's usable host count shows 0 even though both addresses work in practice on modern equipment that supports RFC 3021.
Common mistakes
- Typing an octet above 255 or a malformed address (like missing a dot) and expecting the calculator to guess the intent. IPv4 octets must be whole numbers from 0 to 255.
- Confusing CIDR notation with the subnet mask itself. A /24 prefix and a 255.255.255.0 mask describe the same boundary, but they are written differently and mixing them up in a router configuration causes real outages.
- Assuming every subnet loses exactly 2 addresses to network and broadcast. That rule only holds for /0 through /30. A /31 has 0 reserved addresses under RFC 3021 and a /32 is a single host with no separate network or broadcast address at all.
- Entering the network address instead of a host address and assuming the tool made an error. Any address inside a block returns the same network and broadcast results, because those boundaries depend only on the prefix, not on which host address you typed.
- Forgetting that a smaller CIDR number means a larger network. A /16 has far more hosts than a /28, and it is easy to reverse this when scanning configuration files quickly.
- Using a subnet size that does not match the actual number of devices, which either wastes address space with an oversized block or leaves no room to grow with an undersized one.
Embed this calculator on your site
Drop this single line where you want the calculator to appear. It is responsive, mobile-friendly, resizes automatically, and is free to use with attribution.
<script src="https://calctide.com/embed.js" data-tool="subnet-calculator" async></script>Preview the embed at /embed/subnet-calculator/.