🛠️Dev Toolbox

🧮 Subnet Calculator

Calculate subnet mask network address broadcast address host range and CIDR notation from any IPv4 address and prefix length.

Subnet Calculator

What Problem Does This Solve?

You need to carve a /16 into /24s for your VPC subnets. You need to know whether one range overlaps with another. You need to know how many usable hosts a /29 gives you (spoiler: 6) before requesting it. This tool does the math so you don't work it out by hand at 2 AM.

Every subnet calculation is a single AND between an IP address and a mask. The mask's 1-bits select the network portion; the 0-bits leave the host portion. Once you have the network address, everything else follows mechanically.

The Mental Model

Think of an IPv4 address as 32 bits in a row. A prefix length -- say /24 -- says "the first 24 bits are the network; the remaining 8 are hosts." The subnet mask is just that prefix length written out: 255.255.255.0.

When you AND a host address (binary written in dotted-decimal) with a mask, the result is the network address. That's the only math in subnetting. Everything else is bookkeeping.

The bitwise visualization in the tool shows this AND operation explicitly: network portion in blue, host portion in grey. Once you can read that column, you can sanity-check any subnet calculation by eye.

CIDR vs Classful

CIDR notation replaced classful networking in 1993 (RFC 1519). The old class boundaries (A=/8, B=/16, C=/24) are still shown for reference, but modern allocation is entirely prefix-length based.

How to Use It

Enter any IPv4 address with a prefix length (10.0.0.0/24) or separately via the prefix slider. The tool returns network address, broadcast, first/last usable host, subnet mask (dotted-decimal and binary), and total/usable host count (subtracts 2 for network+broadcast by default -- toggle-able for /31 links per RFC 3021).

The subnet-splitting panel earns its keep: enter a parent CIDR and the tool enumerates all child subnets. Use this when designing a VPC or writing Terraform aws_subnet blocks.

VLSM in Practice

Variable-Length Subnet Masking uses different prefix lengths for different subnets based on host-count needs:

  • Point-to-point WAN links: /30 -> 2 usable hosts.
  • Small office VLANs: /25 -> 126 usable.
  • Data center AZ: /22 -> 1022 usable.
  • DMZ public services: /26 -> 62 usable.

The overlap validator catches the most common VLSM mistake: accidentally allocating intersecting ranges. Fix before hitting production -- overlapping subnets cause asymmetric routing.

The /31 Exception

RFC 3021 allows /31 prefixes for point-to-point links. Both addresses are usable (no network/broadcast reservation). Toggle RFC 3021 mode or host count reads as 0.

Common Mistakes

  1. Off-by-one: /24 has 256 addresses, 254 usable. Humans get this wrong constantly.
  2. Network overlap: intersecting CIDRs range containment.
  3. Byte boundaries: /20 splits align neatly. /21 splits produce boundaries that confuse people used to /24 increments.
  4. In production: validate against terraform plan or a ping sweep before relying on a partition.

FAQ

Q: IPv6 support? A: Current tool is IPv4-only. Use ipcalc on the CLI for IPv6. Q: Wildcard masks for OSPF/ACLs? A: Wildcard mask = bitwise inverse of subnet mask. The calculator shows both.

More Developer Tools

Explore our complete collection of 60+ free developer tools at dev.aisoosoo.com. All tools run 100% in your browser — no signup, no data sent to servers.