Resell services with the EthicalSMM API

Subnet Calculator

Enter an IPv4 address with a CIDR prefix or subnet mask to get the network and broadcast address, usable host range, wildcard mask and host count.

Was this tool helpful?

Thanks for the feedback!

This calculator takes an IPv4 address with a CIDR prefix or a subnet mask and works out the network it belongs to. You get the network and broadcast addresses, the usable host range, the wildcard mask, the host count, the address type and the binary form of both the mask and the IP. It is meant for network engineers, students preparing for CCNA-style exams and anyone setting up a router, VPC or firewall rule.

What to type

The single field is IP address with /prefix or mask. It accepts three forms:

  • CIDR notation: 192.168.1.10/24
  • An address and a dotted mask separated by a space: 10.0.0.5 255.255.255.252
  • An address on its own: the tool assumes /24 and says so in the result heading

The address does not need to be the network address. Enter any host IP and the tool finds the network it sits in.

How the results are worked out

The prefix length says how many of the 32 bits belong to the network. The tool builds the mask from that many 1 bits, then:

  • Network address = IP AND mask (host bits set to 0)
  • Broadcast address = network OR wildcard (host bits set to 1)
  • Wildcard (inverse) mask = the mask with every bit flipped, as used in Cisco ACLs and OSPF
  • Total addresses = 2 to the power (32 − prefix)
  • Usable hosts = total minus 2, because the network and broadcast addresses cannot be given to a device

Worked examples

InputNetworkBroadcastUsable rangeUsable hosts
192.168.1.10/24192.168.1.0192.168.1.255192.168.1.1 – 192.168.1.254254
192.168.10.77/26192.168.10.64192.168.10.127192.168.10.65 – 192.168.10.12662
172.20.5.9/20172.20.0.0172.20.15.255172.20.0.1 – 172.20.15.2544,094
10.0.0.5 255.255.255.25210.0.0.410.0.0.710.0.0.5 – 10.0.0.62

For 192.168.10.77/26 the mask is 255.255.255.192 and the wildcard is 0.0.0.63. Each /26 block holds 64 addresses, and 77 falls in the block that starts at 64. For the /20 example, the mask is 255.255.240.0, shown in binary as 11111111.11111111.11110000.00000000. Large counts use Indian digit grouping, so a /10 shows 41,94,304 total addresses.

To size a subnet, work backwards from the number of devices. An office with 25 devices needs at least 27 addresses once you add the network and broadcast, so a /27 is the smallest fit. Entering 192.168.5.0/27 shows a mask of 255.255.255.224 and 30 usable hosts, leaving a little room to grow.

/31 and /32: the special cases

The "minus 2" rule does not apply to the two smallest prefixes, and the tool handles them separately.

  • /31 has two addresses and both are usable. RFC 3021 allows /31 on point-to-point links between two routers, which saves addresses. For 10.0.0.0/31 the tool shows 2 usable hosts, a range of 10.0.0.0 – 10.0.0.1 and a broadcast of "None (point-to-point /31)".
  • /32 is a single address, used for loopbacks, host routes and allow-list entries for one server. For 8.8.8.8/32 you get 1 usable host and "None (single host)" as the broadcast.

Address type and class

The Address type row tells you which special range the IP is in:

  • Private (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 (172.16 to 172.31) and 192.168.0.0/16. These are for internal networks and are not routed on the public internet.
  • Shared / CGNAT (RFC 6598): 100.64.0.0/10, which runs from 100.64.0.0 to 100.127.255.255. Many mobile and broadband providers use this range between the customer and their carrier-grade NAT. If your router's WAN address starts with 100.64 to 100.127, you are behind CGNAT and incoming port forwarding will not work from outside.
  • Loopback (127.x.x.x), Link-local (169.254.x.x, which a device gives itself when DHCP fails), Multicast or reserved (224 and above) and Public for everything else.

The Historical class (A to E) is shown for reference only. Classful addressing was replaced by CIDR in 1993, but exam papers still ask about it.

Errors

  • An octet over 255, such as 192.168.1.300, gives: "192.168.1.300" is not a valid IPv4 address.
  • A prefix above 32 gives "The prefix length must be between 0 and 32."
  • A mask like 255.255.0.255 gives "That mask is not contiguous (all ones followed by all zeros)."

To find the public IP and location your connection is using, try the IP address lookup. To practise converting octets to binary by hand, the binary to decimal converter helps.

Frequently asked questions

How many usable hosts are in a /24 subnet?
A /24 has 256 addresses and 254 usable hosts. The first address is the network address and the last is the broadcast address.
Why does a /31 show 2 usable hosts?
RFC 3021 allows /31 subnets on point-to-point links, where neither address is reserved for network or broadcast. The tool therefore counts both addresses as usable and shows no broadcast.
What is the 100.64.0.0/10 range?
It is shared address space set aside by RFC 6598 for carrier-grade NAT. Internet providers use it between their customers and their NAT devices, so an address in it means you do not have a public IP of your own.
Which IP ranges are private?
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. The tool labels any address in these ranges as Private (RFC 1918).
What is a wildcard mask?
It is the subnet mask with every bit flipped, so 255.255.255.0 becomes 0.0.0.255. Cisco access lists and OSPF configuration use wildcard masks to say which bits must match.
What is the subnet mask for /26?
A /26 mask is 255.255.255.192. It gives 64 addresses per subnet, of which 62 are usable.

Related guides

Related tools

People also used

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.