CIDR Calculator
Enter any CIDR block — instantly get network, broadcast, mask, and host range
Format: IP/prefix-length — e.g. 10.0.0.0/8, 192.168.1.5/24 (host address within subnet also accepted)
Enter a CIDR block to calculate the network address, broadcast address, subnet mask, usable host range, and total address count. Accepts host addresses within a subnet (e.g. 10.0.1.5/24).
Common CIDR Blocks
| CIDR | Addresses | Usable | Subnet Mask |
|---|---|---|---|
| /8 | 16,777,216 | 16,777,214 | 255.0.0.0 |
| /16 | 65,536 | 65,534 | 255.255.0.0 |
| /24 | 256 | 254 | 255.255.255.0 |
| /25 | 128 | 126 | 255.255.255.128 |
| /26 | 64 | 62 | 255.255.255.192 |
| /27 | 32 | 30 | 255.255.255.224 |
| /28 | 16 | 14 | 255.255.255.240 |
| /30 | 4 | 2 | 255.255.255.252 |
| /32 | 1 | 1 | 255.255.255.255 |
You’re configuring a VPC subnet, writing a firewall rule, or reading a network diagram and need to know exactly which IP addresses a CIDR block covers. Enter a CIDR like 10.0.0.0/24 and instantly see the network address, broadcast, usable range, subnet mask, and wildcard mask.
What Is CIDR Notation?
CIDR (Classless Inter-Domain Routing) notation compresses an IP address and a prefix length into a compact form: address/prefix. The prefix length specifies how many leading bits identify the network. The remaining bits identify individual hosts.
For example, 192.168.1.0/24 means:
- The first 24 bits (
192.168.1) identify the network - The last 8 bits (
.0through.255) identify hosts - Total: 256 addresses, 254 usable hosts (excluding network and broadcast)
Key Calculations
Network Address
The IP address with all host bits set to 0. This identifies the network itself and is not assignable to a host.
Formula: IP AND subnet_mask
Broadcast Address
The IP address with all host bits set to 1. Packets sent to this address reach all hosts on the subnet. Also not assignable to a host.
Formula: network_address OR wildcard_mask
Subnet Mask
A 32-bit value with the network bits set to 1 and host bits set to 0. A /24 prefix becomes 255.255.255.0.
Wildcard Mask
The inverse of the subnet mask. Used in ACLs (Cisco IOS) and OSPF configuration. A /24 wildcard mask is 0.0.0.255.
Usable Hosts
Total addresses in the block minus 2 (network and broadcast): 2^(32-prefix) - 2.
Exception: /31 subnets have 0 usable hosts by the traditional formula but RFC 3021 allows both addresses to be used for point-to-point links. /32 identifies a single host.
Common CIDR Blocks Reference
| CIDR | Addresses | Usable Hosts | Use case |
|---|---|---|---|
| /8 | 16,777,216 | 16,777,214 | Large ISP, Class A equivalent |
| /16 | 65,536 | 65,534 | Large organization |
| /24 | 256 | 254 | Small office, VPC subnet |
| /25 | 128 | 126 | Half a /24 |
| /26 | 64 | 62 | Quarter of a /24 |
| /27 | 32 | 30 | Small team subnet |
| /28 | 16 | 14 | Small group |
| /30 | 4 | 2 | Point-to-point links |
| /32 | 1 | 1 (host route) | Single host, loopback |
CIDR Calculations in Code
Python (ipaddress module)
import ipaddress
net = ipaddress.IPv4Network('192.168.1.0/24', strict=False)
print(net.network_address) # 192.168.1.0
print(net.broadcast_address) # 192.168.1.255
print(net.netmask) # 255.255.255.0
print(net.hostmask) # 0.0.0.255
print(net.num_addresses) # 256
print(list(net.hosts())[0]) # 192.168.1.1 (first usable)
JavaScript
function cidrInfo(cidr) {
const [ip, prefix] = cidr.split('/');
const prefixLen = parseInt(prefix, 10);
const octets = ip.split('.').map(Number);
const ipInt = octets.reduce((acc, o) => (acc << 8) | o, 0) >>> 0;
const mask = prefixLen === 0 ? 0 : (0xFFFFFFFF << (32 - prefixLen)) >>> 0;
const network = (ipInt & mask) >>> 0;
const broadcast = (network | ~mask) >>> 0;
const toIp = n => [(n>>>24)&255,(n>>>16)&255,(n>>>8)&255,n&255].join('.');
return { network: toIp(network), broadcast: toIp(broadcast), usable: Math.max(0, (broadcast - network) - 1) };
}
Frequently Asked Questions
What is the difference between subnet mask and wildcard mask? The subnet mask has 1s in the network bits and 0s in the host bits. The wildcard mask is its bitwise inverse — 0s in the network bits and 1s in the host bits. Cisco ACLs use wildcard masks; subnet masks are used in routing table entries.
What does “strict” mean in Python’s ipaddress module?
When strict=True, 192.168.1.5/24 raises an error because the host bits are not all zero. With strict=False, it silently uses 192.168.1.0/24. This tool uses the non-strict mode to accept any host address within a CIDR.
Can I use a host address instead of a network address?
Yes. Enter 192.168.1.5/24 and the tool calculates the containing network (192.168.1.0/24). It shows both the entered address and the calculated network address.
What is a /32 used for?
A /32 prefix identifies exactly one host. It’s used for static host routes, loopback addresses, and in firewall rules when you want to match a single specific IP.