Subnet Calculator

Netmask, usable hosts, and IP range from address and CIDR.

Technology and NetUpdated 2026-10-101 min read
Subnet Calculator
Four octets like 192.168.1.0.
Bits of network part. Home nets are usually /24.
Netmask
...
Usable hosts...
Usable range...

What it does

Classless addressing splits each IPv4 address into network and host parts at the CIDR boundary. The netmask marks the split with one bits, the first address names the network, the last broadcasts, and everything between serves hosts.

The tool above takes an address with its prefix length. It returns the netmask, usable host count, and the usable range with network and broadcast named in the note.

Each host bit doubles capacity minus the two reserved ends. A /24 holds 254 hosts, a /25 holds 126, and a /16 holds 65,534, which is why small offices live at /24 and campuses at /16.

The /31 and /32 edge cases follow point to point rules with no broadcast address, so this page covers /8 through /30 where classic subnetting applies.

How to use

  1. Enter the IPv4 address in four octets.
  2. Enter the CIDR prefix from 8 to 30.
  3. Read netmask, host count, and usable range.
  4. Assign router and servers from the usable ends.

Formula

Mask = 32 ones then zeros at the boundary. Network = IP AND mask. Broadcast = network OR inverted mask. Hosts = 2^(32 - CIDR) - 2.
AND / OR
Bitwise ops splitting network from host part.
2^(host bits)
Addresses in the block before reservations.
minus 2
Network and broadcast addresses stay unusable.

Binary math underlies it all: 192 is 11000000 and the mask 255.255.255.0 is twenty four ones. Hex dumps of routers show the same bits.

Worked example

Example: 192.168.1.0/24

Classic home network address and prefix.

  1. Mask: 24 ones is 255.255.255.0.
  2. Network: 192.168.1.0 AND mask = 192.168.1.0.
  3. Broadcast: network OR 0.0.0.255 = 192.168.1.255.
  4. Hosts: 2^8 - 2 = 254, from 192.168.1.1 to 192.168.1.254.

Reference table

Common prefixes compared
CIDRNetmaskUsable hosts
/30255.255.255.2522
(/31 point to point)(255.255.255.254)(2, special rules)
/24255.255.255.0254
/16255.255.0.065,534
/8255.0.0.016,777,214

Limits

  • IPv4 only. IPv6 subnets work differently.
  • /8 to /30 modeled. /31 and /32 need special rules.
  • Reserved and multicast ranges still compute blindly.
  • VLSM planning needs per subnet passes.

Common mistakes

  • Counting network and broadcast as usable.
  • Reading /24 as 24 hosts instead of 254.
  • Mixing netmask octet order.
  • Forgetting the gateway needs a usable address too.
  • Overlapping subnets across VLANs.

Try it yourself

Quick checks. Answers sit tucked under each question.

Hosts in a /26?

2^6 - 2 = 62 usable hosts.

Netmask of /16?

Sixteen ones: 255.255.0.0.

Questions

What does /24 mean?

Twenty four network bits: 254 usable hosts from .1 to .254.

Why minus two hosts?

Network address names the block and broadcast reaches all. Neither hosts a device.

What is a netmask?

Ones over network bits, zeros over host bits: /24 is 255.255.255.0.

Can subnets overlap?

Never on one router without NAT tricks. Plan non overlapping blocks.

What about /31?

Point to point links use both addresses with no broadcast. Special rules apply.

How do I split a /24 in two?

Two /25 blocks: .0 to .127 and .128 to .255, each with 126 hosts.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.