Subnet (CIDR) Calculator
Inputs
| IPv4 address | 192.168.1.0 |
|---|---|
| Prefix length | 24 |
Subnet (CIDR) Calculator
Enter an IPv4 address and a CIDR prefix length to find the network and broadcast addresses, subnet mask, wildcard mask, usable host range, and the number of available hosts.
Inputs
Address and Prefix
Results
Enter a value to see results.
Subnet
Address Range Details
Subnet (CIDR)
A subnet calculator turns an IPv4 address and a CIDR prefix length into the full description of the network it belongs to: the network and broadcast addresses, the subnet mask, the wildcard mask, the range of usable host addresses, and how many hosts the subnet can hold. Anyone planning an IP addressing scheme, configuring a router or firewall, or studying for a networking exam uses this breakdown constantly.
Prefix length and the subnet mask
CIDR notation writes a network as an address followed by a slash and a prefix length, such as 192.168.1.0/24. The prefix is the number of leading bits reserved for the network portion of the address; the remaining bits identify individual hosts. A 32-bit IPv4 address split at /n devotes n bits to the network and the remaining 32 − n bits to hosts. The subnet mask is the same split expressed as an address: the first n bits are ones and the rest are zeros, so /24 becomes 255.255.255.0.
Network, broadcast, and host range
The network address is found by keeping the network bits of the address and setting every host bit to zero — a bitwise AND of the address with the mask. The broadcast address sets every host bit to one instead. These two addresses bookend the block and are reserved: the network address names the subnet, and the broadcast address reaches every host at once. The usable host range therefore runs from one above the network address to one below the broadcast address.
The total number of addresses in the block is
and for any block of /30 or larger the count of assignable hosts subtracts the network and broadcast addresses:
Worked example
Take 192.168.1.130 with a /26 prefix. The mask devotes 26 bits to the network, leaving 6 host bits:
With a block size of 64, the address 192.168.1.130 falls in the block that starts at 192.168.1.128, so the network address is 192.168.1.128 and the broadcast address is 192.168.1.191. The usable hosts run from 192.168.1.129 to 192.168.1.190 — 62 of them, matching the formula.
Point-to-point and host routes
Two prefix lengths break the "subtract two" rule. A /31 block holds two addresses, and under RFC 3021 both are usable for the two ends of a point-to-point link, with no separate network or broadcast address. A /32 describes a single address — a host route used for loopbacks and firewall entries.
To count the addresses in an arbitrary span or summarize it into a block, see the IP Address Range Calculator. To see the binary structure behind the mask, the Number Base Converter renders each octet in base 2.
Frequently Asked Questions (FAQ)
What does the CIDR prefix mean?
Classless Inter-Domain Routing (CIDR) notation writes a network as an address followed by a slash and a prefix length, such as 192.168.1.0/24. The prefix is the number of leading bits that identify the network; the remaining bits identify hosts. A /24 reserves 24 bits for the network and 8 for hosts, giving 256 addresses. Each step down (for example /24 to /23) doubles the block size; each step up halves it.
Why are usable hosts two fewer than the total?
Every IPv4 subnet reserves its first address as the network address and its last as the broadcast address, so neither can be assigned to a device. A /24 block has 256 total addresses but 254 usable hosts. The exceptions are point-to-point links: a /31 provides two usable addresses with no separate network or broadcast (RFC 3021), and a /32 describes a single host.
What is the difference between the network and broadcast address?
The network address has all host bits set to zero and names the subnet as a whole — routers use it in routing tables. The broadcast address has all host bits set to one; a packet sent to it is delivered to every host on the subnet. Both sit at the edges of the block and are reserved, which is why the usable host range falls between them.
How do /31 and /32 subnets work?
A /32 represents one specific address — a single host route, often used for loopbacks or firewall rules. A /31 covers two addresses and, under RFC 3021, both are usable for the two ends of a point-to-point link, dispensing with the usual network and broadcast reservation to save address space.