Subnet Calculator

IPv4 β€” the mask, the borrow, the block, and where the boundaries fall.

Address

Prefix /26

The block

The working

Cut it up

Divide this block into

Work backwards

I need room for hosts

Reference

The formulas
mask = 2Β³Β² βˆ’ 2³²⁻ᡖ network = address AND mask wildcard = NOT mask broadcast = network OR wildcard hosts = 2³²⁻ᡖ βˆ’ 2 (see /31 and /32 below) host range = network+1 … broadcastβˆ’1

The borrow. The bits the prefix takes past the octet boundary are worth 128, 64, 32 … in that octet, which is where every mask value comes from β€” and the block size is 256 minus that.

/26 β†’ 255.255.255.192 11111111.11111111.11111111.11000000 ^^ 2 bits borrowed, 6 host bits 192 = 128 + 64, block size 64 boundaries at .0 .64 .128 .192
The two prefixes the formula gets wrong

/31 has 2 usable addresses, not 0. RFC 3021: on a point-to-point link there is nobody to broadcast to, so both addresses go to the two ends. This is what router-to-router links are numbered with, so it is the common case, not an edge case.

/32 has 1, not βˆ’1. It is a single host route β€” a loopback, a /32 in a routing table β€” not a network at all.

2³²⁻ᡖ βˆ’ 2 gives 0 and βˆ’1 for those two. A calculator that prints them has not been used on real equipment.

Ranges worth recognising
10.0.0.0/8 private RFC 1918 172.16.0.0/12 private RFC 1918 ← stops at 172.31.255.255 192.168.0.0/16 private RFC 1918 100.64.0.0/10 carrier NAT RFC 6598 169.254.0.0/16 link-local APIPA, "no DHCP answered" 127.0.0.0/8 loopback never leaves the host

The 172.16.0.0/12 one catches people: it runs to 172.31.255.255, not to 172.16.255.255 and not to 172.255.255.255. The dotted notation hides where a /12 ends.

Every prefix and its mask