🌐 IP Subnet Calculator

Calculate IPv4 subnet masks, network ranges, usable host IPs, and broadcast addresses.

IPv4 subnetting: CIDR, masks and usable host ranges

An IPv4 address is 32 bits, written as four decimal numbers from 0 to 255. Subnetting splits those 32 bits into a network portion, which identifies the subnet, and a host portion, which identifies a device inside it. The prefix length says how many bits belong to the network.

CIDR notation

In 192.168.1.0/24 the /24 means the first 24 bits are the network, leaving 8 bits for hosts. Those 8 bits give 2⁸ = 256 addresses, of which the first is the network address and the last is the broadcast address, leaving 254 usable.

total addresses = 2(32 − prefix)      usable hosts = 2(32 − prefix) − 2

The reference table

Common IPv4 prefixes
CIDRSubnet maskTotal addressesUsable hosts
/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)
/32255.255.255.25511 (single host)

The /31 is a special case defined in RFC 3021 for point-to-point links, where no broadcast address is needed, so both addresses are usable. A /32 identifies exactly one host and is common in routing tables and firewall rules.

Network, broadcast and the range in between

For 192.168.10.0/26: the block size is 64, so subnets start at .0, .64, .128 and .192. Taking the second block, the network address is 192.168.10.64, the broadcast is 192.168.10.127, and the usable range is 192.168.10.65 to 192.168.10.126, which is 62 hosts.

The fast method is to find the block size as 256 minus the last non-255 octet of the mask. For /26 the mask ends in 192, so the block size is 64, and every subnet boundary is a multiple of 64.

The wildcard mask

A wildcard mask is the bitwise inverse of the subnet mask, used in access control lists and some routing protocols. For 255.255.255.192 the wildcard is 0.0.0.63: subtract each octet from 255. Where a subnet mask marks the bits that must match, a wildcard marks the bits that may vary.

Private address ranges

RFC 1918 private ranges and other reserved blocks
RangeCIDRUse
10.0.0.0 – 10.255.255.25510.0.0.0/8Large private networks, 16.7m addresses
172.16.0.0 – 172.31.255.255172.16.0.0/12Medium private networks, 1m addresses
192.168.0.0 – 192.168.255.255192.168.0.0/16Home and small office, 65k addresses
127.0.0.0 – 127.255.255.255127.0.0.0/8Loopback
169.254.0.0 – 169.254.255.255169.254.0.0/16Link-local, self-assigned when DHCP fails

A device showing a 169.254.x.x address has failed to reach a DHCP server and assigned itself a link-local address. It is one of the most useful diagnostic signals in home networking: the network card works, the network does not.

Sizing a subnet

Work backwards from the host count. Twenty devices need at least 22 addresses once the network and broadcast are counted, so a /27 with 30 usable is the smallest that fits; a /28 with 14 is too small. Leave room for growth: moving a live subnet is far more disruptive than allocating a larger block at the start.

A worked example

You need four subnets from 192.168.50.0/24, each supporting at least 25 hosts. A /27 gives 30 usable, which fits, and 256/32 = 8 subnets are available. The first four are 192.168.50.0/27 (usable .1–.30), .32/27 (.33–.62), .64/27 (.65–.94) and .96/27 (.97–.126), leaving four spare blocks for later.

Frequently Asked Questions (FAQs)

Why does a /24 have 254 usable hosts instead of 256?

The first address in any subnet is the network identifier and the last is the broadcast address, and neither can be assigned to a device. That costs two addresses in every subnet except a /31, which is defined for point-to-point links where no broadcast is needed.

What is the difference between a subnet mask and a CIDR prefix?

They express the same thing. The mask 255.255.255.0 and the prefix /24 both say the first 24 bits are the network portion. CIDR notation is more compact and is what routing tables use; dotted-decimal masks persist in device configuration screens.

How do I choose a subnet size?

Count the devices, add the two reserved addresses, then pick the smallest prefix that covers it with room to grow. Twenty devices need a /27. Oversizing wastes address space, which matters on public ranges and rarely matters on private ones.

What is a wildcard mask used for?

Access control lists and OSPF configuration. It is the bitwise inverse of the subnet mask: subtract each octet from 255. A subnet mask says which bits must match; a wildcard says which bits are free to vary.

Can I use any private IP range at home?

Yes, all three RFC 1918 ranges work. Most home routers default to 192.168.0.0/24 or 192.168.1.0/24. Choosing an unusual range such as 10.73.4.0/24 reduces address conflicts when connecting to a VPN whose remote network uses the common defaults.

What is VLSM?

Variable length subnet masking: using different prefix lengths within the same network so each subnet is sized to its actual need. A point-to-point router link takes a /30 while a user network takes a /24, which avoids wasting hundreds of addresses on a two-device link.