Interactive tool Free Certifications

IPv4 subnet calculator

Type an address and CIDR prefix — get the subnet mask, wildcard, network and broadcast address, usable host range and count, IP class and RFC 1918 status. Everything is computed in your browser; nothing is sent anywhere.

Advertisement · 728×90
subnet-calculator no data leaves your browser

How it works

A subnet mask splits an IPv4 address into a network part (the leftmost prefix bits) and a host part (the remaining bits). The CIDR prefix is simply how many bits are set to 1 in the mask.

Formula

Usable hosts per subnet = 2^(32 − prefix) − 2. The −2 removes the network address (all host bits 0) and the broadcast address (all host bits 1).

  • Network address — the address with every host bit set to 0; it names the subnet itself.
  • Broadcast address — every host bit set to 1; packets to it reach all hosts on the subnet.
  • Wildcard mask — the bitwise inverse of the subnet mask, used in Cisco ACLs and OSPF.
  • First / last usable — network + 1 through broadcast − 1, the addresses you can actually assign.

The /31 and /32 edge cases

The − 2 rule has two exceptions this calculator handles:

  • /31RFC 3021 allows both addresses to be used on point-to-point links, so a /31 has 2 usable hosts, not 0.
  • /32 — a single host route (one address), commonly used for loopbacks and host-specific rules.

Private (RFC 1918) ranges

RangeCIDR
10.0.0.0 – 10.255.255.25510.0.0.0/8
172.16.0.0 – 172.31.255.255172.16.0.0/12
192.168.0.0 – 192.168.255.255192.168.0.0/16

The calculator also flags 127.0.0.0/8 (loopback) and 169.254.0.0/16 (APIPA / link-local) when relevant.

Sources

  1. RFC 1918 — Address Allocation for Private Internets.
  2. RFC 3021 — Using 31-Bit Prefixes on IPv4 Point-to-Point Links.
  3. CompTIA Network+ / Security+ exam objectives.

Reference tool only. Calculations follow standard IPv4 addressing; for authoritative rules see the relevant RFCs.