CIDR Calculator
192.168.1.10/24 breaks down to network 192.168.1.0, broadcast 192.168.1.255, and 254 usable hosts. A CIDR calculator takes an IPv4 address written in CIDR notation, meaning an address and a prefix length such as /24, and works out everything that notation implies: the subnet mask, the network address, the broadcast address, the first and last usable host, and the total number of addresses in that block. Enter an address and prefix like 10.0.0.5/16 or 172.16.5.200/20, and the tool applies standard IPv4 bitwise subnetting rules to return every value at once. It is built for network engineers, sysadmins, students studying for certification exams, and anyone who needs to read a CIDR block without working through binary math by hand.
Quick answer
CIDR notation combines an IPv4 address with a prefix length, written as address/prefix, such as 192.168.1.10/24.
What this tells you
- •CIDR notation combines an IPv4 address with a prefix length, written as address/prefix, such as 192.168.1.10/24.
- •The prefix length tells the tool how many leading bits of the address are the network portion, with the remaining bits available for host addresses.
- •Results include the subnet mask, network address, broadcast address, and the usable host range for that block.
- •Usable host counts follow standard IPv4 convention: the network address and broadcast address are excluded from the usable range for prefixes /0 through /30.
- •Prefixes /31 and /32 are special cases. A /31 has no separate network or broadcast address under the usual rule, and a /32 identifies a single host.
- •This calculator handles IPv4 CIDR only. It does not parse or validate IPv6 prefixes.
How to Use
- 1Enter a CIDR string in the single input field, combining an IPv4 address and a prefix length separated by a slash, such as 10.0.0.5/16.
- 2Make sure the address has four octets between 0 and 255 and the prefix is a whole number between 0 and 32. Anything outside those ranges will not calculate.
- 3Click calculate to generate the subnet mask, network address, broadcast address, first usable host, last usable host, and total usable host count.
- 4Compare the network address against the address you entered. If they differ, your input address sits somewhere inside the block rather than exactly on the network boundary, which is normal and expected.
- 5Review the usable host range and the /31 or /32 special-case behavior before applying the result to a real routing table, firewall rule, or subnet plan.
How It Works
Formula
Mask = prefix bits set to 1, remaining bits set to 0
Network address = IP address AND mask
Broadcast address = Network address OR (NOT mask)
Total addresses = 2^(32 - prefix)
Usable hosts = 2^(32 - prefix) - 2, except /31 and /32 where usable hosts = 0A 32-bit IPv4 address is treated as a string of 32 binary digits. The prefix length, the number after the slash, says how many of those leading bits belong to the network. The tool builds a subnet mask by setting that many leading bits to 1 and the rest to 0, so a /24 mask is 24 ones followed by 8 zeros, which is 255.255.255.0. It finds the network address by running a bitwise AND between your IP address and the mask, which clears every host bit to 0. It finds the broadcast address by taking the mask, flipping every bit with a bitwise NOT, and OR-ing that against the network address, which sets every host bit to 1. Total addresses in the block is 2 raised to the power of the remaining host bits, or 2^(32-prefix). Usable hosts is normally that total minus 2, because the lowest address in the block is reserved as the network address and the highest is reserved as the broadcast address. The two exceptions are /31, defined by RFC 3021 for point-to-point links where both addresses in the pair are usable endpoints, and /32, which represents exactly one host address with no network or broadcast concept at all. This calculator reports usable hosts as 0 for both /31 and /32 to reflect that the standard network/broadcast/usable-range model does not apply there, even though a /31 link genuinely uses both of its two addresses.
Calculation note: values are processed in the order shown above, using the current input units.
Worked Examples
Standard /24 home or office network
A /24 prefix sets a mask of 255.255.255.0, leaving 8 host bits and 256 total addresses. The network address zeroes out those 8 bits to get 192.168.1.0, and the broadcast address sets them all to 1 to get 192.168.1.255. That leaves 254 usable addresses, which is the most common block size for home routers and small office LANs.
Larger /16 block for a campus or site network
A /16 prefix leaves 16 host bits, so the block spans 65,536 total addresses across the third and fourth octets. The mask 255.255.0.0 zeroes out both of those octets for the network address and sets them both to 255 for the broadcast address. Private /16 blocks like this one are common for larger internal networks that get split into smaller subnets later.
Mid-size /20 subnet
A /20 prefix leaves 12 host bits, for 4,096 total addresses and 4,094 usable ones. The mask is 255.255.240.0, so only the last 4 bits of the third octet plus the whole fourth octet vary within the block. Notice the input address 172.16.5.200 is not the network address itself, it just falls inside the 172.16.0.0 to 172.16.15.255 range.
Small /27 subnet carved from a larger block
A /27 prefix leaves only 5 host bits, giving 32 total addresses per block in steps of 32, so this block runs from .128 through .159. The mask 255.255.255.224 clears the low 5 bits for the network address and sets them for the broadcast address. Blocks this size are typical when a /24 gets split into multiple smaller subnets for different departments or VLANs.
Point-to-point /30 link between two routers
A /30 prefix leaves 2 host bits, for exactly 4 total addresses: one network address, one broadcast address, and 2 usable addresses. This is the classic block size for a serial or WAN link connecting exactly two routers, since it wastes only 2 addresses instead of the 252 a /24 would waste on the same link. The input address 10.10.10.10 turns out to be the last usable host in its block, not the network address.
Edge case: /31 point-to-point link
A /31 prefix leaves only 1 host bit, so the block has just 2 total addresses. Under the classic network/broadcast model neither address is usable, which is why this tool reports 0 usable hosts here, but RFC 3021 defines /31 specifically for point-to-point links where both addresses act as real host endpoints. Router and firewall configuration guides often call this out explicitly, since it is one of the few places the 'usable hosts equals total minus 2' rule breaks down.
Scenario: Priya finds the block a stray printer lives in
Priya manages a campus network cut into /22 blocks and finds a printer answering at 172.20.77.19. She needs to know which block it sits in before she writes a firewall rule. A /22 leaves 10 host bits, so each block holds 1,024 addresses and the third octet moves in steps of 4. The mask 255.255.252.0 clears the low 2 bits of 77 (binary 01001101) down to 76, so the network address is 172.20.76.0 and the block runs through 172.20.79.255. The printer is an ordinary host inside it, not on a boundary, and the rule she writes should reference 172.20.76.0/22 rather than the printer's own address.
IPv4 prefix length to subnet mask, block size, and usable hosts
Every value below is what this calculator returns for the prefix in the first column, including the /31 and /32 rows where the standard subtract-2 rule stops applying.
| Prefix | Subnet mask | Total addresses | Usable hosts (as reported) |
|---|---|---|---|
| /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 |
| /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 |
| /31 | 255.255.255.254 | 2 | 0 (RFC 3021 links use both addresses) |
| /32 | 255.255.255.255 | 1 | 0 (single host route) |
Computed with the formula above: the mask is the prefix length in leading 1 bits, total addresses = 2^(32 - prefix), and usable hosts = total minus 2 for /0 through /30 and 0 for /31 and /32. The slash notation and the 2^(32 - n) block sizes follow RFC 4632 (BCP 122). The subtract-2 convention comes from RFC 950, which reserves the all-zeros and all-ones host values. For a /31 the tool shows the two addresses as first and last host while reporting 0, because RFC 3021 treats both as host addresses on a point-to-point link.
Reading CIDR notation correctly
CIDR stands for Classless Inter-Domain Routing, and it replaced the older class A, B, and C address system in the 1990s so network sizes could be defined by any prefix length instead of only a few fixed sizes. The prefix number after the slash is what makes a block classless. A /24 does not have to align with a traditional class C boundary, it just means the first 24 bits are fixed as the network portion, wherever that boundary happens to fall.
A smaller prefix number means a bigger block. This trips up a lot of people learning subnetting for the first time, because it feels backward. A /8 covers over 16 million addresses while a /30 covers only 4, so as the prefix number goes up, the network portion of the address grows and the space left for hosts shrinks.
The network address and broadcast address are not addresses you assign to a device. The network address, the lowest address in the block, identifies the subnet itself for routing purposes. The broadcast address, the highest address in the block, is used to send a packet to every host on that subnet at once. Assigning either one to a workstation or server is a common misconfiguration that causes connectivity problems.
VLSM, or variable length subnet masking, is the practice of splitting one larger CIDR block into several smaller ones with different prefix lengths to match the actual number of hosts on each segment. A /24 assigned to a point-to-point router link wastes 252 addresses, while a /30 fits that link with only 2 wasted. This calculator checks one block at a time rather than planning a full VLSM layout, but understanding a single block's network, broadcast, and usable range is the starting point for that kind of design work.
The math on this page comes from three documents. RFC 791 (1981) fixed the IPv4 address at four octets, 32 bits in total. RFC 950 (1985) introduced the address mask, a 32-bit pattern that a host ANDs against an address to find the subnet, and it reserved the all-zeros and all-ones values in the host field, which is where the subtract-2 rule for usable hosts comes from. RFC 4632 (BCP 122, 2006) defines the slash notation this calculator reads: four octets, a slash, then a decimal prefix length from 0 to 32, with a block of 2^(32 - n) addresses. The subnet mask, network address, and broadcast address you see here are those three rules applied in order, with no routing-table lookup involved.
The two short prefixes bend the rule. RFC 3021 (2000) allows a 31-bit prefix on point-to-point links and requires both the all-zeros and all-ones addresses to be treated as host addresses, so a /31 spends 2 addresses on a link that a /30 would spend 4 on. This tool keeps the classic model and reports 0 usable hosts for /31, while still listing both addresses as the first and last host so you can read the pair. A /32 is a single address with no host bits, which routers carry as a host route. Enter 192.0.2.9/32 and every field returns 192.0.2.9 with 0 usable hosts, which is the expected output rather than an error.
The calculator does not know what kind of address you typed. It applies the same bit math to 10.0.0.5/16 and to a public block, so it will not tell you that 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 are the private ranges set aside by RFC 1918 (BCP 5), or that 192.0.2.0/24 is a documentation block that should never appear in production. It also stops at the plain CIDR arithmetic. Cloud providers and DHCP servers reserve extra addresses inside a subnet for gateways and services, and those reservations come out of the usable count shown here, not in addition to it. Check the provider's own subnet rules when the exact number of assignable addresses matters.
Common mistakes
- Entering a prefix length outside the 0-32 range, or a non-numeric value after the slash, both of which the tool rejects as invalid CIDR notation.
- Assuming /31 and /32 follow the standard 'total minus 2' usable-host rule. A /31 is a documented point-to-point exception and a /32 is a single host with no network or broadcast concept.
- Confusing the network address with the first usable host. The network address, such as 192.168.1.0 in a /24, cannot be assigned to a device, the first usable host starts one address later.
- Typing an address that already has a broadcast or network-style value in it and assuming that address is what the calculator will show back. The tool always derives the block's actual network and broadcast addresses from the mask, which may differ from the address you typed if it was not exactly on a boundary.
- Mixing up the direction of the prefix. A smaller number like /8 means a larger block with more hosts, while a larger number like /30 means a smaller block. It is easy to read this backward when first learning subnetting.
- Treating this IPv4-only tool as if it handles IPv6 prefixes. IPv6 CIDR notation uses the same slash format but a completely different address length and subnetting convention, and this calculator does not parse it.
Embed this calculator on your site
Paste this code where you want the calculator to appear. It is responsive, mobile-friendly, resizes automatically, and is free to use as long as the credit line stays in place.
<script src="https://calctide.com/embed.js" data-tool="cidr-calculator" async></script>
<p style="font-size:12px;margin:4px 0 0">CIDR Calculator by <a href="https://calctide.com/tech/cidr-calculator/">CalcTide</a></p>Preview the embed at /embed/cidr-calculator/.