CruxDevCruxDev Tools Prompts
dev Utility • Zero-Server Privacy • 100% Client-Side

IP Subnet Calculator

Calculate network address, broadcast, host range, and CIDR notation for IPv4 subnets.

Overview

Calculates the full IPv4 subnet for an address in CIDR form such as 192.168.10.42/26: network address, broadcast, subnet mask, wildcard mask, first and last usable hosts, total and usable address counts, and a scope classification like private, loopback, or public. A binary representation of address and mask is shown below the numbers, and everything recomputes as you type.

How It Works

Type an IPv4 address with its /prefix. The input is validated with an explicit error if an octet exceeds 255 or the prefix is outside 0-32. The results grid shows nine values: network and broadcast addresses, mask, first and last usable hosts, the scope verdict, total and usable host counts, and the prefix. Below, the binary representation line shows the four octets in bits with the prefix length, so you can see exactly which bits are network and which are host.

Step-by-Step Usage Guide

  1. Enter an address with its prefix length, for example 10.0.5.77/22.
  2. Read the network, broadcast, and usable range from the results grid.
  3. Check the usable-host count and total-address count for capacity planning.
  4. Use the binary line to see the network and host bit split, or the wildcard mask for ACL work.

Technical Specifications & Standards

The math is the standard bit-manipulation approach done with unsigned 32-bit arithmetic: the mask is built by left-shifting a full mask by 32 minus the prefix, the network address is the address AND mask, and the broadcast is the network OR the inverted mask. Usable host counting follows the textbook rule with an explicit exception pair: for prefixes up to /30, two addresses are subtracted for network and broadcast; for /31, both addresses are usable, matching the point-to-point link convention of RFC 3021; and a /32 is a single host route where the first and last usable host are the address itself. The wildcard mask shown is the bitwise inverse of the netmask, which is the form Cisco ACLs and some firewall rule sets expect rather than the dotted mask. Scope classification covers RFC 1918 private space (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), the 127.0.0.0/8 loopback, and labels everything else public; it does not detect link-local 169.254.0.0/16, multicast, or reserved blocks, so those will be labeled public. IPv6 is not supported; the parser only accepts dotted-quad input, and shorthand like 10.1 or partial octets fails validation rather than being guessed.

Targeted Use Cases

  • Planning a VLAN allocation by checking network and broadcast bounds before assigning hosts.
  • Writing firewall or router ACLs that need the wildcard mask form of a subnet.
  • Answering certification-style subnetting questions with verifiable numbers.
  • Checking whether two addresses share a subnet by comparing their computed network addresses.

Notes & Gotchas

  • Enter the prefix explicitly; without a /, the input is rejected rather than defaulted, which avoids silent assumptions.
  • Remember /31 and /32 follow their special conventions here: two usable hosts on a point-to-point /31, one on a /32.
  • Use the wildcard mask output directly in Cisco-style ACLs instead of hand-inverting the netmask.
  • Do not treat the scope label as exhaustive; link-local and multicast ranges are not classified and will read as public.

Frequently Asked Questions

Why does a /31 subnet show two usable hosts?

Point-to-point links use the convention from RFC 3021: both addresses in a /31 are usable because there is no room for dedicated network and broadcast addresses. A /32 similarly shows itself as the single usable host.

What is the wildcard mask for?

It is the bitwise inverse of the subnet mask, used in Cisco IOS access lists and some firewall rules to define match ranges. For a /26 mask of 255.255.255.192, the wildcard is 0.0.0.63.

Why is 169.254.x.x reported as public?

The classifier recognizes RFC 1918 ranges (10/8, 172.16/12, 192.168/16) and loopback 127/8. Link-local 169.254.0.0/16, multicast, and reserved blocks are not classified, so they fall through to the public label.

Can I calculate IPv6 subnets?

No. The calculator accepts dotted-quad IPv4 with a 0-32 prefix only. IPv6 input fails validation with an error message.