Network Calculator

subnets, CIDR, and bits without the math

Printable reference sheets Subnet cheat sheet, port lists, and more — designed for letter paper.

How IPv4 subnetting and CIDR notation work

An IPv4 address is 32 bits, written as four decimal octets. A CIDR prefix like /24 says how many of those leading bits are fixed as the network portion; the rest identify hosts inside it. The subnet mask is just those fixed bits written out — /24 is 255.255.255.0, twenty-four 1-bits followed by eight 0-bits. AND the address with the mask and you get the network address, the bottom of the block; flip the mask's host bits to 1 and you get the broadcast address, the top.

From the prefix alone you know the block's size. A /24 leaves 8 host bits, so 2⁸ = 256 total addresses. Two of those are reserved — the network address itself and the broadcast — leaving 254 usable for hosts. Every prefix follows the same rule: usable hosts = 2^(32−prefix) − 2. A /25 has 126 usable, a /26 has 62, a /27 has 30. This calculator does the AND and the arithmetic for you and shows the network, broadcast, first and last host, mask, and wildcard all at once.

Two prefixes break the minus-two rule, and we handle them the way RFC 3021 specifies rather than the textbook formula. A /31 has only two addresses and no room to reserve a network and broadcast, so on a point-to-point link both addresses are usable — 2 hosts, not 0. A /32 is a single address, a host route, with one usable address. Naively applying 2^n − 2 would report zero usable hosts for both, which is wrong and would have you provisioning a /30 where a /31 is correct.

The tool also classifies the address. It reports the legacy class (A/B/C/D/E by first octet) for reference, and — more usefully — whether the address is private under RFC 1918 (10/8, 172.16/12, 192.168/16) or one of the special ranges: loopback (127/8), link-local (169.254/16), or CGNAT (100.64/10). Private addresses never route on the public internet, so knowing an address is RFC 1918 tells you it lives behind NAT.

Worked example

You're handed 192.168.1.0/24 and need the boundaries of the block.

  1. Mask for /24 = 255.255.255.0; host bits = 32 − 24 = 8
  2. Network = 192.168.1.0 (address AND mask), broadcast = 192.168.1.255
  3. Usable hosts = 2⁸ − 2 = 254, running 192.168.1.1 to 192.168.1.254

→ Network 192.168.1.0, broadcast 192.168.1.255, 254 usable hosts (.1–.254). The address is RFC 1918 private.