How CIDR subnets work
An IPv4 address is 32 bits, written as four numbers from 0 to 255. A prefix such as /24 says how many leading bits identify the network; the rest identify hosts. A /24 leaves 8 host bits, so 256 addresses: the first is the network address, the last the broadcast address, and the 254 in between are usable hosts. Each extra prefix bit halves the block: /25 has 128 addresses, /26 64, /27 32.
The netmask writes the prefix as an address (/26 = 255.255.255.192), and the wildcard mask is its inverse (0.0.0.63), used by firewall ACLs.
Worked example
192.168.1.130/26: blocks of 64 start at .0, .64, .128 and .192, so .130 is in the block starting at 192.168.1.128. Its broadcast is .191, usable hosts run from .129 to .190, and there are 62 of them. Because 192.168/16 is an RFC 1918 range, the address is private and not routed on the internet.
Special prefixes
/31 networks have no network or broadcast address and give both addresses to hosts (RFC 3021), which routers use on point-to-point links. /32 is a single host.
How this works
The page parses the address into a 32-bit number, takes the prefix from /n or derives it from a dotted mask (which must be contiguous), and computes the block size 2^(32 − prefix). The network address is the address rounded down to a multiple of the block size; the broadcast is the network plus the block size minus one. Usable hosts exclude those two, except in /31 and /32 networks. It also shows the netmask and wildcard, the address and mask in binary, the old class letter and the address scope from the RFC 1918, RFC 6598 and special-use ranges.
Frequently asked
How many hosts are in a /24?
256 addresses, 254 usable hosts. A /25 has 126 usable hosts and a /26 has 62.
What is a wildcard mask?
The inverse of the netmask (255 minus each octet). Cisco ACLs and OSPF use it to match address ranges.
Why does /31 show two usable hosts?
RFC 3021 lets point-to-point links use both addresses of a /31, since no broadcast is needed.
Does it support IPv6?
Not yet; this calculator handles IPv4 only.
Sources
- RFC 4632 — Classless Inter-domain Routing (CIDR)
- RFC 1918 — Address Allocation for Private Internets
- RFC 3021 — Using 31-Bit Prefixes on IPv4 Point-to-Point Links
- Wikipedia — Classless Inter-Domain Routing
Reviewed Oct 17, 2026 · test vectors fixtures/dev/subnet-calculator/