🌐 Subnet Calculator

Calculate the subnet mask, network address, broadcast address, and usable host range for any IPv4 address and CIDR prefix.

Network Details

Result

Network Address
Subnet Mask
Wildcard Mask
Broadcast Address
Usable Hosts
First Usable Host
Last Usable Host
Advertisement

How the Subnet Calculator Works

This calculator converts an IPv4 address and CIDR prefix length into a full subnet breakdown using bitwise arithmetic, the same math routers and networking equipment use to determine network boundaries.

Method

subnetMask = 32 bits with the first N bits set to 1 (N = CIDR prefix)
networkAddress = ipAddress AND subnetMask
broadcastAddress = networkAddress OR (NOT subnetMask)
usableHosts = 2^(32−N) − 2 (for N ≤ 30; /31 and /32 are special cases)

Special Cases

  • /31 — point-to-point link, both addresses usable (no network/broadcast reserved), 2 usable hosts.
  • /32 — a single host address, 1 usable host (the address itself).

Frequently Asked Questions

Why are 2 addresses subtracted from the usable host count?

For prefixes /30 and shorter, the first address in the range is reserved as the network address and the last is reserved as the broadcast address, so they aren't assignable to hosts.

What is a wildcard mask?

The wildcard mask is the bitwise inverse of the subnet mask. It's commonly used in access control lists (ACLs) on routers and firewalls to specify address ranges.

What does the CIDR prefix length mean?

The CIDR prefix (e.g. /24) indicates how many leading bits of the 32-bit IPv4 address are fixed as the network portion — the remaining bits identify hosts within that network.

Related Calculators