CalcHub

IP Subnet Calculator

Give this an IPv4 address with a CIDR prefix — 192.168.1.10/24, for instance — and it returns the network address, broadcast address, subnet mask, wildcard mask, the usable host range and the total host count. Subnetting is one of those topics that is genuinely simple in binary and genuinely confusing in decimal, which is why so much of it is memorised from tables rather than understood. The prefix length is just a count of leading bits that identify the network; everything left over identifies the host. Once that clicks, the mask, the address ranges and the host counts all follow from it mechanically. The sections below work through that logic and cover the two addresses in every subnet that cannot be assigned to a machine, along with the /31 exception that breaks the rule.

How this is calculated

The prefix length is the number of leading bits belonging to the network. A /24 means the first 24 bits are network and the remaining 8 are host, which gives a mask of 255.255.255.0 — 24 ones followed by 8 zeros.

The network address is the IP with all host bits set to zero; the broadcast address is the same with all host bits set to one. Usable hosts are everything in between, which is 2^(32 − prefix) − 2.

Worked example on 192.168.1.10/24: the mask is 255.255.255.0, the network address is 192.168.1.0, the broadcast is 192.168.1.255, and the usable range is 192.168.1.1 to 192.168.1.254 — 254 hosts from 256 addresses.

Why two addresses are always unusable

The all-zeros host address identifies the network itself and is what appears in routing tables. The all-ones host address is the broadcast address, which reaches every host on the segment at once. Neither can be assigned to an interface, which is where the minus two comes from.

The cost of this is proportionally brutal on small subnets. A /30 has 4 addresses and 2 usable hosts — half the space lost to overhead. A /24 loses 2 out of 256, which is negligible. This is why point-to-point links, which need exactly two addresses, were so wasteful before /31 support existed.

RFC 3021 permits /31 on point-to-point links precisely to fix that, giving 2 usable addresses from 2 by dispensing with network and broadcast addresses entirely. A /32 describes a single host and is used for loopbacks and host routes.

Reading a mask without a table

Each octet of a mask can only take nine values: 0, 128, 192, 224, 240, 248, 252, 254, 255 — corresponding to 0 through 8 bits set. A mask octet of 192 means two bits, so a /18 is 255.255.192.0.

The block size in the last significant octet is 256 minus that octet's value. A /26 has a mask of 255.255.255.192, so the block size is 64 and the subnets start at .0, .64, .128 and .192. This is the fastest way to work out which subnet an address falls in without converting anything to binary.

The wildcard mask, which appears in access control lists and OSPF configuration, is the mask inverted — 0.0.0.255 for a /24. It is the same information expressed the other way round, matching bits that are allowed to vary rather than bits that must match.

How to use the ip subnet calculator

  1. Enter an address with its prefix. Standard CIDR notation, such as 10.0.5.37/22. Any address within the subnet works — you do not need the network address.
  2. Read the network and broadcast addresses. These bound the subnet. Neither can be assigned to a host.
  3. Use the host range for assignment. Everything between the two bounds is assignable. The count is 2^(32 − prefix) − 2, except on /31 and /32.

Last updated: 2026-08-01

Frequently asked questions

Why are two addresses unusable in each subnet?

The all-zeros host is the network address and the all-ones host is broadcast. A /24 has 256 addresses but 254 usable hosts. Exceptions: /31 point-to-point links and /32 single hosts.

How many hosts are in a /24?

254. A /24 leaves 8 host bits, giving 256 addresses, minus the network and broadcast addresses. The general formula is 2^(32 − prefix) − 2, so a /26 gives 62 and a /30 gives 2.

What is a wildcard mask?

The subnet mask inverted — 0.0.0.255 for a /24. Access control lists and OSPF use it because they match on bits allowed to vary rather than bits required to match. It carries the same information the other way round.

How do I tell which subnet an address belongs to?

Take 256 minus the significant mask octet to get the block size. For a /26, the mask octet is 192, so the block size is 64 and subnets begin at .0, .64, .128 and .192. An address of .100 falls in the .64 subnet.

Related calculators

Advertisement