Skip to content

IPv4 Subnet Calculator — CIDR, Mask, Host Range

Calculate network address, broadcast, usable host range, wildcard mask and host count from any IPv4 address and CIDR prefix.

Inputs

Any address inside the subnet — the network address is derived from it.

Results

Network address
192.168.1.0

/24 — 255.255.255.0

Usable host range
192.168.1.1 – 192.168.1.254
Broadcast address
192.168.1.255
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
Total addresses
256
Usable hosts
254

Network and broadcast addresses are excluded.

IPv4 only. Private ranges are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918).

How CIDR notation works

An IPv4 address is 32 bits. The prefix length after the slash says how many of those bits identify the network; the rest identify the host. In 192.168.1.10/24, the first 24 bits are the network (192.168.1) and the last 8 are the host (10).

Everything else follows from that split:

  • Subnet mask — the prefix bits set to 1. A /24 is 255.255.255.0.
  • Network address — the address with all host bits set to 0. This identifies the subnet itself and is not assignable.
  • Broadcast address — all host bits set to 1. Traffic sent here reaches every host on the segment, so it is not assignable either.
  • Wildcard mask — the inverse of the subnet mask. Cisco ACLs and OSPF network statements use this form rather than the mask.

Why usable hosts is total minus two

A /24 contains 28 = 256 addresses, but only 254 can be assigned to hosts, because the network and broadcast addresses are reserved. The general formula is:

Usable hosts = 2^(32 − prefix) − 2

This is the single most common source of off-by-two errors in address planning. A /30, often used for point-to-point links, has four addresses and exactly two usable — which is why it was the traditional choice for a router-to-router link.

The /31 and /32 exceptions

Two prefixes break the rule, and this calculator handles them explicitly:

  • /31 — RFC 3021 allows both addresses to be used on a point-to-point link, because a broadcast address is meaningless when there are exactly two endpoints. This halves the address waste compared with a /30, and modern practice prefers it.
  • /32 — a single host address, used for loopback interfaces and host routes. There is no network or broadcast to reserve.

Reference table

PrefixMaskAddressesUsable
/30255.255.255.25242
/29255.255.255.24886
/28255.255.255.2401614
/27255.255.255.2243230
/26255.255.255.1926462
/24255.255.255.0256254
/16255.255.0.065,53665,534
/8255.0.0.016,777,21616,777,214

Private address ranges

RFC 1918 reserves three blocks that are never routed on the public internet:

  • 10.0.0.0/8 — 16.7 million addresses, the usual choice for large internal networks
  • 172.16.0.0/12 — 1 million addresses; note the range ends at 172.31.255.255, not 172.255.x.x
  • 192.168.0.0/16 — 65,536 addresses, ubiquitous in small networks and consumer equipment

Also worth recognising: 169.254.0.0/16 is link-local (APIPA), and an interface holding one of those addresses has usually failed to reach DHCP — a useful diagnostic in itself.

A note on subnetting practice

Sizing a subnet exactly to today's host count is a false economy. Renumbering a live segment is disruptive, and address space inside RFC 1918 is effectively free. Leave room, and keep boundaries on easily-readable bit positions — /24 rather than /23 or /25 — unless you have a concrete reason. Whoever debugs the network at 3 a.m. will thank you.