CZ
CalcyZone
Computer Science & Software CalcyZone Calculator

IPv4 Subnet & CIDR Calculator

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

Interactive Algorithm Visualizer

Algorithm Step-by-Step Simulator

Enter your custom input data → Run the real algorithm engine → Observe step transitions.

⚙️ Customize Algorithm Input Data

Mathematical Formula

Subnet Mask = (0xFFFFFFFF << (32 - CIDR)); Network = IP & Mask

Overview & Explanation

An IPv4 Subnet Calculator partitions IP networks into logical sub-networks, determining exact network boundaries, broadcast addresses, and host capacities.

How It Works

  • Convert IP address and CIDR prefix to 32-bit binary representations.
  • Apply Bitwise AND with subnet mask to calculate Network Address.
  • Apply Bitwise OR with wildcard mask to calculate Broadcast Address.

Practical Applications

  • Network engineering
  • VLSM design
  • Cloud VPC CIDR allocation

How a subnet is worked out

An IPv4 address has 32 bits. The prefix length, as in /26, says how many bits identify the network, and the remaining 32 - prefix bits identify hosts. A subnet holds 2^(32 - prefix) addresses, and normally 2 are reserved: the network address and the broadcast address. So usable hosts = 2^(32 - prefix) - 2.

A /24 has 256 addresses and 254 usable hosts. A /26 has a mask of 255.255.255.192 and 64 addresses per block, so 192.168.10.0/24 splits into the blocks .0, .64, .128 and .192.

Worked example

For 192.168.10.77/26, 77 falls in the block starting at 64. The network address is 192.168.10.64, the broadcast is 192.168.10.127 and the usable hosts run from .65 to .126, which is 62 addresses. A quick method is to find the block size, 256 minus the last non-255 mask octet, and see which multiple of it your address falls in.

Edge cases

A /30 gives 2 usable hosts, a classic choice for point-to-point links. A /31 can be used for point-to-point links with both addresses usable (RFC 3021), and a /32 identifies a single host.

Subnetting 192.168.1.100/24

Calculating network metrics for /24 prefix

1

Mask

32 - 24 = 8 host bits

= 255.255.255.0
2

Network

192.168.1.100 & Mask

= 192.168.1.0
3

Broadcast

Network | Wildcard

= 192.168.1.255

Frequently Asked Questions

How many usable hosts does a /24 subnet support?
A /24 subnet supports 254 usable hosts.
What is CIDR notation?
It writes the mask as a prefix length, so 255.255.255.0 is /24.
Why can't I use the network and broadcast addresses?
They identify the subnet itself and address all hosts on it, so they are not assigned to devices in normal subnets.