PureDevTools

CIDR Calculator

Enter any CIDR block — instantly get network, broadcast, mask, and host range

All processing happens in your browser. No data is sent to any server.

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

CIDRAddressesUsableSubnet Mask
/816,777,21616,777,214255.0.0.0
/1665,53665,534255.255.0.0
/24256254255.255.255.0
/25128126255.255.255.128
/266462255.255.255.192
/273230255.255.255.224
/281614255.255.255.240
/3042255.255.255.252
/3211255.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:

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

CIDRAddressesUsable HostsUse case
/816,777,21616,777,214Large ISP, Class A equivalent
/1665,53665,534Large organization
/24256254Small office, VPC subnet
/25128126Half a /24
/266462Quarter of a /24
/273230Small team subnet
/281614Small group
/3042Point-to-point links
/3211 (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.

Related Tools

More Network Tools