CalcPro

IP Subnet Calculator

Network, broadcast, mask and host range for an IPv4 address and CIDR.

What it does

This calculator takes an IPv4 address and CIDR prefix (the /n notation) and breaks down the entire subnet into its component parts: the network address, broadcast address, subnet mask, and the range of usable host addresses. It's essential for network planning, device configuration, and understanding IP allocation.

The mechanics

Every IPv4 address is 32 bits. The CIDR prefix tells you how many of those bits identify the network, and the rest identify individual hosts within that network.

For example, /24 means the first 24 bits are the network portion, leaving 8 bits for hosts. /16 means 16 bits for the network and 16 for hosts.

The calculator:

  1. Converts the IP address to binary
  2. Applies the CIDR mask to isolate the network portion
  3. Calculates the network address (host bits set to 0)
  4. Calculates the broadcast address (host bits set to 1)
  5. Derives the subnet mask in dotted-decimal notation
  6. Determines the first and last usable host addresses
  7. Counts total hosts and usable hosts (excluding network and broadcast)

The formula

Network Address = IP AND (Subnet Mask) | Broadcast Address = Network Address OR (Inverted Subnet Mask) | Usable Hosts = 2^(32 - CIDR) - 2

Worked example

Let's subnet 192.168.1.100 with a /24 prefix.

Step 1: Convert to binary and apply mask

  • 192.168.1.100 in binary: 11000000.10101000.00000001.01100100
  • /24 mask: first 24 bits are network, last 8 are hosts

Step 2: Network address

  • Set all host bits (the last 8) to 0
  • Result: 11000000.10101000.00000001.00000000 = 192.168.1.0

Step 3: Subnet mask

  • 24 network bits = 11111111.11111111.11111111.00000000
  • In dotted decimal: 255.255.255.0

Step 4: Broadcast address

  • Set all host bits to 1
  • Result: 11000000.10101000.00000001.11111111 = 192.168.1.255

Step 5: Usable host range

  • First usable: 192.168.1.1 (network + 1)
  • Last usable: 192.168.1.254 (broadcast − 1)
  • Total addresses: 2^8 = 256
  • Usable hosts: 256 − 2 = 254 hosts

Summary:

  • Network: 192.168.1.0
  • Subnet Mask: 255.255.255.0
  • Broadcast: 192.168.1.255
  • Usable Range: 192.168.1.1 – 192.168.1.254
  • Host Count: 254

Common mistakes

Forgetting to exclude network and broadcast addresses. The network address (all host bits = 0) and broadcast address (all host bits = 1) cannot be assigned to devices. Always subtract 2 from the total number of addresses to get usable hosts.

Confusing CIDR with subnet mask. /24 and 255.255.255.0 describe the same thing, but CIDR is the shorthand. A /30 subnet (used for point-to-point links) has a mask of 255.255.255.252 and only 2 usable hosts.

Misreading the host bits. With a /16 network, you have 16 host bits, meaning 2^16 = 65,536 total addresses and 65,534 usable hosts. Larger prefixes (like /28) mean fewer hosts; smaller prefixes mean more.

Not validating the IP format. Ensure each octet is 0–255 and the CIDR prefix is 0–32. Invalid input will produce incorrect results.

When planning your network, always account for growth. A /24 with 254 usable hosts might seem plenty, but it fills quickly in production environments. Document your subnetting scheme so future administrators understand your allocation strategy.

Frequently asked questions

What's the difference between CIDR and subnet mask?

CIDR notation (e.g., /24) and subnet mask (e.g., 255.255.255.0) represent the same thing: how many bits identify the network. CIDR is more compact; subnet mask is the traditional dotted-decimal format. They're interchangeable.

Why are network and broadcast addresses not usable?

The network address (all host bits = 0) identifies the subnet itself; the broadcast address (all host bits = 1) sends packets to all hosts on that subnet. Assigning either to a device would cause routing and communication conflicts.

How many usable hosts in a /30 subnet?

A /30 has 4 total addresses (2^2) and 2 usable hosts. It's commonly used for point-to-point links like router-to-router connections.

Can I use a /32 address?

Yes. A /32 means the entire 32-bit address is the network, leaving 0 host bits. It represents a single IP address with no other hosts. Used for loopback addresses and host routes.

What if I enter 10.0.0.5 with /8?

The network address becomes 10.0.0.0, the broadcast is 10.255.255.255, and you have 16,777,214 usable hosts. The /8 prefix means only the first octet identifies the network; the remaining 24 bits are for hosts.

Is this suitable for IPv6?

No, this calculator handles only IPv4 addresses. IPv6 uses a different format (128 bits, hexadecimal notation) and requires a separate calculator.