Domain IP Lookup

Subnet Calculator: CIDR, Netmask and Usable Hosts

Type an address with a prefix length (192.168.1.0/24) or a netmask (255.255.255.0) and get the network address, broadcast address, usable host range, wildcard mask and host count in one go. Split a network into smaller subnets, or switch tabs to turn a start and end address into the fewest CIDR blocks. IPv6 prefixes work too.

Try:

How CIDR notation works

CIDR (Classless Inter-Domain Routing) writes a network as an address, a slash and a number. The number is the prefix length: how many of the address's 32 bits identify the network. The rest identify hosts inside it.

A /24 fixes the first 24 bits and leaves 8 for hosts, which is 2^8 = 256 addresses, and its netmask is 255.255.255.0. A /16 leaves 16 bits for hosts: 65,536 addresses. Every bit you add to the prefix halves the block.

For ordinary IPv4 subnets, usable hosts = 2^(32 − prefix) − 2. Two addresses are lost: the first is the network address and the last is the broadcast address.

Subnetting in your head: the block-size trick

You don't need binary for most everyday subnets. Take the netmask octet that isn't 255 or 0 and subtract it from 256. The result is the block size, and networks start at multiples of it.

Take 192.168.1.130/26. The mask is 255.255.255.192, so the block size is 256 − 192 = 64. Networks start at .0, .64, .128 and .192, which puts .130 in the .128 network. Its broadcast address is the next network minus one, .191, and its usable hosts run from .129 to .190: 62 of them.

Common IPv4 subnet sizes

PrefixNetmaskTotal addressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/22255.255.252.01,0241,022
/23255.255.254.0512510
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422 (point-to-point link)
/32255.255.255.25511 (a single host)

Private and special IPv4 ranges

RangePurpose
10.0.0.0/8Private network (RFC 1918)
172.16.0.0/12Private network (RFC 1918)
192.168.0.0/16Private network (RFC 1918)
100.64.0.0/10Shared address space for carrier-grade NAT
127.0.0.0/8Loopback: this computer
169.254.0.0/16Link-local: self-assigned when DHCP fails
224.0.0.0/4Multicast

Addresses in the private ranges aren't routed across the public internet, which is why millions of homes and offices can reuse the same ones.

Edge cases worth knowing

  • /31: RFC 3021 lets both addresses of a /31 be used on a point-to-point link, so there's no network or broadcast address and two usable hosts.
  • /32: a single address, used for host routes and firewall rules.
  • /0: the whole address space, written 0.0.0.0/0 and used as the default route.
  • Wildcard mask: the netmask with every bit flipped (0.0.0.255 for a /24). Routing protocols and access lists often use it instead of a netmask.

IPv6 prefixes

IPv6 addresses are 128 bits, and the prefix-length idea is the same. A /64 is the standard size for one network segment, because address autoconfiguration expects 64 bits for the interface identifier. Providers commonly hand a site a /48 or a /56, which holds 65,536 or 256 /64 networks. IPv6 has no broadcast address, so every address in a prefix is usable.

A /64 holds 2^64 addresses, roughly 18 quintillion, so IPv6 subnetting is about organising networks, not saving addresses.

Planning a subnet

  • Count the devices you need today and add room for growth. Renumbering later is painful.
  • Use different prefix lengths for different needs (variable-length subnet masking) instead of a /24 for everything.
  • Keep subnets that talk to each other aligned so routes can be summarised.
  • Write down each allocation. An address plan on paper prevents overlapping ranges.

Frequently asked questions

Guides