🌐 Subnet

Subnet Calculator

Turn any IPv4 address and prefix into a full subnet report: network and broadcast addresses, dotted netmask and wildcard, usable host range, host totals and a binary breakdown. Press Calculate.

Written and reviewed by SM Arijul Islam · Last reviewed · Editorial standards · Report an error

Leave blank to skip. Both addresses are compared against the same network.

How a subnet is calculated

Every IPv4 address is 32 bits. A CIDR prefix such as /24 says how many of those bits are the network part; the remaining bits identify hosts inside that network. This calculator converts the address to a 32-bit integer and applies bitwise operations, which is exactly what routers do.

The masks

  • Netmask β€” 1s for network bits, 0s for host bits, e.g. /24 = 255.255.255.0.
  • Wildcard β€” the inverse of the netmask, used in Cisco ACLs, e.g. /24 = 0.0.0.255.
  • Network address β€” address AND netmask, the first address in the block.
  • Broadcast address β€” address OR wildcard, the last address in the block.

Usable hosts

For normal subnets (/1 to /30) the network and broadcast addresses are reserved, so usable hosts are 2(32βˆ’prefix) βˆ’ 2. Two special cases follow modern practice: /31 is a point-to-point link with 2 usable addresses (RFC 3021), and /32 is a single-host route with 1.

Address classes and scopes

  • Classes: A (1–126), B (128–191), C (192–223), D multicast (224–239), E reserved (240–255).
  • Private ranges: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
  • Also flagged: loopback 127/8, link-local 169.254/16, carrier-grade NAT 100.64/10, multicast 224/4 and reserved 240/4.
This tool works on IPv4 only. For address sizes and file limits, see the Data Storage Converter.

Worked example

192.168.1.0/24 contains 256 addresses, of which 254 are usable hosts. The subnet mask is 255.255.255.0, the network address is 192.168.1.0 and the broadcast address is 192.168.1.255.

Everyday uses

  • Planning an office or home network
  • Writing firewall and routing rules
  • Splitting a range into VLANs
  • Troubleshooting an addressing mistake
  • Checking overlap before merging networks

Frequently asked questions

254. The block holds 256 addresses, but the network address and the broadcast address cannot be assigned to hosts.
A /31 gives two addresses for point-to-point links with no broadcast, and a /32 identifies a single host.
The network address names the subnet; the broadcast address reaches every host inside it.
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are reserved for private use and are not routable on the public internet.

More worked examples

  • A /24 subnet holds 256 addresses, of which 254 are usable for hosts.
  • A /27 holds 32 addresses and 30 usable hosts.
  • A /30 is the classic point-to-point link size, with four addresses and two usable.
  • A /26 has the mask 255.255.255.192 and allows 62 usable hosts.

CIDR cheat sheet

Common CIDR prefixes with their subnet masks and usable host counts
PrefixMask and usable hosts
/24255.255.255.0, 254 hosts
/25255.255.255.128, 126 hosts
/26255.255.255.192, 62 hosts
/27255.255.255.224, 30 hosts
/28255.255.255.240, 14 hosts
/29255.255.255.248, 6 hosts
/30255.255.255.252, 2 hosts

Common mistakes to avoid

  • Subtracting two from the address count out of habit. On a modern point-to-point link a /31 can use both addresses, under the rule in RFC 3021.
  • Assuming a /24 always begins at .0. The subnet boundary depends on the address, so a /24 can start at .64 or .192.
  • Confusing the subnet mask with the default gateway, which is a host address inside the subnet.
  • Forgetting that the network address and the broadcast address are reserved in ordinary subnets, which is where the minus two comes from.

Further questions

Classless Inter-Domain Routing. The slash and number, such as /24, give the prefix length, which is how many leading bits identify the network.
254 usable. The block holds 256 addresses, but the first is the network address and the last is the broadcast address.
A bitmask that separates the network portion of an address from the host portion, written either as 255.255.255.0 or as /24.
Variable Length Subnet Masking, which means using different prefix sizes inside one network so that small links do not waste a large block.

Sources and standards

The private IPv4 ranges are defined in RFC 1918, and an IPv4 subnet mask is simply a count of leading one bits in a 32-bit address. The page applies those definitions directly and shows the network and broadcast addresses a mask produces.

Related calculators