Subnet & CIDR calculator

Network, broadcast, host range and mask for any IPv4 CIDR block.

Network address
192.168.1.128

/26

Broadcast address
192.168.1.191
Usable host range
192.168.1.129 – 192.168.1.190
Usable hosts
62

64 addresses total

Subnet mask
255.255.255.192
Wildcard mask
0.0.0.63

Used in ACLs and OSPF

Class
C
Scope
Private / loopback
Address11000000.10101000.00000001.10000010
Mask11111111.11111111.11111111.11000000
Network11000000.10101000.00000001.10000000

Prefix reference

PrefixMaskAddressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/22255.255.252.01,0241,022
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242

How it works

An IPv4 address is 32 bits. CIDR notation splits it with a slash: the prefix says how many leading bits identify the network, and the rest identify the host within it.

192.168.1.130/26 mask = 26 ones then 6 zeros = 255.255.255.192 network = address AND mask = 192.168.1.128 broadcast = network OR ~mask = 192.168.1.191 hosts = 2^(32−26) − 2 = 62

Why two addresses are unusable

The all-zeros host address identifies the network itself, and the all-ones address is the broadcast. Neither can be assigned to a device, which is why a /24 gives 254 usable addresses rather than 256.

The /31 and /32 exceptions

RFC 3021 allows /31 on point-to-point links, where both addresses are usable because there is nobody to broadcast to. A /32 is a single host route, used for loopbacks and specific-host firewall rules.

Reading a prefix quickly

Each bit you take from the host portion halves the number of addresses. /24 is 256, /25 is 128, /26 is 64, /27 is 32. Going the other way, /23 is two /24s, /22 is four. Most subnetting questions are that doubling and halving.

Classes are historical

Class A, B and C were the pre-1993 allocation scheme, replaced by CIDR precisely because fixed class boundaries wasted enormous numbers of addresses. The class is shown above because it still appears in documentation and exams, not because it affects routing.