Skip to content
devkit.notes

Networking

IPv4 CIDR calculator

Enter an address with a prefix, or an address plus a dotted-netmask, and read the derived network. The arithmetic is fixed-width unsigned 32-bit, done with bitwise operators in the page.

Input

Examples: 10.42.0.0/16  ·  192.168.1.130/26  ·  172.16.5.9 255.255.255.0

Ready.

Network address
—
Broadcast address
—
Subnet mask
—
Wildcard mask
—
First usable host
—
Last usable host
—
Total addresses
—
Usable hosts
—
Prefix length
—
Address class
—
Scope
—
Binary mask
—

Prefix reference

Usable hosts exclude the network and broadcast address, except on /31 and /32.

PrefixMaskAddressesUsableTypical use
/24255.255.255.0256254One flat LAN segment
/25255.255.255.128128126Splitting a /24 in half
/26255.255.255.1926462Four segments per /24
/27255.255.255.2243230Small server group
/28255.255.255.2401614Point-to-point, appliances
/30255.255.255.25242Classic router-to-router link
/31255.255.255.25422RFC 3021 link, no broadcast
/32255.255.255.25511Single host route
/16255.255.0.065,53665,534Large private allocation
/8255.0.0.016,777,21616,777,214Reserved for very large ranges

How the arithmetic works

An IPv4 address is a 32-bit integer. The prefix length n means the high n bits identify the network and the remaining 32 − n bits identify the host. The subnet mask is 2^32 − 2^(32−n), and the network address is the address ANDed with that mask.

The broadcast address is the network ORed with the complement of the mask. For 192.168.1.130/26: mask 255.255.255.192, network 192.168.1.128, broadcast 192.168.1.191, first usable 192.168.1.129, last usable 192.168.1.190.

A /31 carries two addresses and, per RFC 3021, both are usable — there is no broadcast address on a two-address link. /32 is a single address and is normally written as a host route.