IP Subnet Calculator

An IPv4 CIDR prefix specifies how many bits identify the network. The resulting address block includes network and broadcast addresses in traditional subnet calculations.

What the CIDR prefix does

A /30 prefix means the first 30 bits of the 32-bit IPv4 address identify the network, leaving 2 bits (4 addresses) for hosts. The subnet mask marks those network bits as 1s. Applying the mask to your IP address with a bitwise AND gives the network address; flipping the mask and ORing it in gives the broadcast address.

Why usable hosts is 2 less than total

The first address in a subnet is reserved as the network address and the last is reserved as the broadcast address, so neither can be assigned to a device. /31 and /32 are special cases used for point-to-point links and single-host routes, where this reservation doesn't apply the same way.

"Private" IP ranges (like 192.168.x.x, 10.x.x.x, and 172.16–31.x.x) are reserved for use within local networks and aren't routable on the public internet.

Worked example: verify the calculation

The subnet 192.168.1.0/24 has 256 total IPv4 addresses, from 192.168.1.0 through 192.168.1.255. In a conventional subnet, 254 are available as host addresses.

Related calculators

For further calculations, see Bandwidth Calculator.

A worked example

Take the address 154.57.196.39 with a /30 prefix (mask 255.255.255.252). The network address is 154.57.196.36 and the broadcast address is 154.57.196.39. The usable host range is 154.57.196.37 to 154.57.196.38, so there are 4 addresses in total and 2 usable hosts. A /30 is the classic size for a point-to-point link between two routers.

Tips for subnetting

Each step up in the prefix halves the number of addresses: a /24 has 256, a /25 has 128 and a /26 has 64. Two addresses are always reserved, the network address and the broadcast address. When you plan a network, count the devices you need, leave room to grow and pick the smallest block that fits. Private ranges such as 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are not routed on the internet.

You might also need: Bandwidth Calculator, Binary Calculator, URL Encode / Decode, Hex Calculator.

Common questions

What's the difference between a subnet mask and CIDR notation?

They're two ways of expressing the same thing — 255.255.255.0 and /24 both mean the first 24 bits are the network portion. CIDR notation is just more compact.

Does this support IPv6?

Not currently — this calculator covers IPv4 addressing and subnetting only.

More Everyday Calculators

Pick another tool to jump straight to it.