IP Subnet Calculator

Enter an IP address and a CIDR prefix to get the network address, broadcast address, subnet mask and the range of usable host addresses.

Formula

Addresses in a subnet = 2^(32 − prefix) · Usable hosts = that − 2

  • The two reserved are the network address and the broadcast address
  • A /31 point-to-point link is the exception to the minus two

A /26 holds 2⁶ = 64 addresses, of which 62 are usable

What the CIDR Number Means

The number after the slash is how many bits are fixed as the network portion. The rest identify hosts.

Total addresses = 2(32 − prefix), of which two are unusable: the network address itself and the broadcast address.

  • /24: 256 addresses, 254 usable
  • /26: 64 addresses, 62 usable
  • /30: 4 addresses, 2 usable — the classic point-to-point link

Reading a Subnet Mask

A mask is the same information in dotted-decimal form. A /24 is 255.255.255.0: three octets of ones followed by eight zeros.

Because prefixes are binary, subnet sizes only ever double. There is no way to make a subnet holding exactly 100 hosts — you take a /25 with 126 usable addresses and accept the spare.

Private Ranges and Common Mistakes

Three ranges are reserved for private use: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Home routers almost always use the last.

The most common planning error is forgetting the two reserved addresses and sizing a subnet exactly to the host count. The second is overlapping ranges, which is why two networks both using 192.168.1.0/24 cannot be joined by a VPN without renumbering one of them.

Quick Reference

IPv4 subnet sizes for the common prefixes.
PrefixSubnet maskAddressesUsable hosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/30255.255.255.25242

Frequently Asked Questions

How many usable hosts are in a /24?
254. A /24 has 256 addresses, but the network and broadcast addresses cannot be assigned to devices.
What does the /24 actually mean?
That the first 24 bits are the network portion, leaving 8 bits for hosts. It is equivalent to the mask 255.255.255.0.
Why can I not create a subnet for exactly 100 hosts?
Subnets are sized in powers of two. The smallest that fits 100 devices is a /25 with 126 usable addresses.
Which IP ranges are private?
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are not routable on the public internet and are reused on every private network.

Related Calculators