Skip to main content
Calnex LogoCalnex
Developer Tools

IP Subnet Calculator

Calculate IPv4 subnet details from an IP address and CIDR prefix, including network and broadcast addresses, subnet and wildcard masks, usable host range, and host counts.

Parameters

Results

Network Address192.168.1.0
Other results (6)
Broadcast Address192.168.1.255
Subnet Mask255.255.255.0
Wildcard Mask0.0.0.255
Usable Host Range192.168.1.1 - 192.168.1.254
Total Hosts256
Usable Hosts254

This IP subnet calculator takes an IPv4 address and a CIDR prefix from 0 to 32 and returns the network address, broadcast address, subnet mask, wildcard mask, usable host range, total hosts, and usable hosts. It is useful for network administrators, developers, and students who need to plan or troubleshoot IPv4 subnets. The tool validates the IP address format and CIDR range, and handles special cases for /31 and /32 prefixes. Results are based on standard IPv4 subnetting rules and are provided as text values for easy copying.

How does the calculator handle /31 and /32 prefixes?

For a /31 prefix, the calculator treats both addresses as usable hosts, so the total hosts and usable hosts are both 2. The host range includes the network and broadcast addresses, which are the two addresses in the subnet.

For a /32 prefix, the subnet consists of a single host address. The total hosts and usable hosts are both 1, and the host range shows the same address for first and last host.

What is the difference between total hosts and usable hosts?

Total hosts is the number of addresses in the subnet, calculated as 2^(32 - CIDR). Usable hosts is the number of addresses that can be assigned to devices, which is total hosts minus 2 for the network and broadcast addresses.

For example, a /24 subnet has 256 total hosts and 254 usable hosts. The network address (e.g., 192.168.1.0) and broadcast address (e.g., 192.168.1.255) are reserved and cannot be assigned to hosts.

What input validation does the calculator perform?

The calculator checks that the IP address is a valid IPv4 address in dotted-decimal notation with four octets, each between 0 and 255, and no leading zeros or extra characters.

The CIDR prefix must be an integer between 0 and 32. If either input is invalid, the calculator returns an error message instead of results.

Examples and interpretation (5)

How do I find the network and broadcast addresses for 192.168.1.10/24?

IP Address
192.168.1.10
CIDR Prefix
24
  1. Enter IP address 192.168.1.10 and CIDR prefix 24.
  2. The subnet mask is 255.255.255.0, so the network address is 192.168.1.0 and the broadcast address is 192.168.1.255.
Network Address
192.168.1.0
Broadcast Address
192.168.1.255

The network address is the first address in the subnet, and the broadcast address is the last. This subnet has 254 usable host addresses.

How do I get the subnet mask and wildcard mask for 10.0.0.1/8?

IP Address
10.0.0.1
CIDR Prefix
8
  1. Enter IP address 10.0.0.1 and CIDR prefix 8.
  2. The subnet mask is 255.0.0.0 and the wildcard mask is 0.255.255.255.
Subnet Mask
255.0.0.0
Wildcard Mask
0.255.255.255

The wildcard mask is the bitwise complement of the subnet mask and is often used in access control lists.

How do I calculate the usable host range for 172.16.5.68/20?

IP Address
172.16.5.68
CIDR Prefix
20
  1. Enter IP address 172.16.5.68 and CIDR prefix 20.
  2. The network address is 172.16.0.0 and broadcast is 172.16.15.255, so the usable host range is 172.16.0.1 to 172.16.15.254, with 4094 usable hosts.
Usable Host Range
172.16.0.1 - 172.16.15.254
Usable Hosts
4,094

The /20 prefix creates a subnet with 4096 total addresses, but two are reserved for network and broadcast.

What happens with a /31 prefix for 192.168.1.10?

IP Address
192.168.1.10
CIDR Prefix
31
  1. Enter IP address 192.168.1.10 and CIDR prefix 31.
  2. The calculator returns a host range of 192.168.1.10 to 192.168.1.11 and total hosts of 2.
Usable Host Range
192.168.1.10 - 192.168.1.11
Total Hosts
2

For /31, both addresses are usable, so there is no separate network or broadcast address in the host range.

How do I handle a /32 prefix for a single host?

IP Address
10.0.0.1
CIDR Prefix
32
  1. Enter IP address 10.0.0.1 and CIDR prefix 32.
  2. The calculator returns a host range of 10.0.0.1 to 10.0.0.1 and usable hosts of 1.
Usable Host Range
10.0.0.1 - 10.0.0.1
Usable Hosts
1

A /32 prefix identifies a single host, so the network, broadcast, and host address are all the same.

How to use

  1. Enter a valid IPv4 address in the IP Address field, using dotted-decimal notation like 192.168.1.10.
  2. Enter a CIDR prefix between 0 and 32 in the CIDR Prefix field.
  3. The tool validates the IP address format and CIDR range; if invalid, an error message is shown.
  4. The tool converts the IP address and subnet mask to 32-bit integers and performs bitwise operations to compute network and broadcast addresses.
  5. The tool calculates the subnet mask, wildcard mask, usable host range, total hosts, and usable hosts based on the CIDR prefix.
  6. Review the results, which include the network address, broadcast address, subnet mask, wildcard mask, usable host range, total hosts, and usable hosts.

Frequently asked questions

What is a CIDR prefix?

A CIDR prefix is a number from 0 to 32 that indicates how many bits of the IP address are used for the network portion. For example, /24 means the first 24 bits are the network, leaving 8 bits for hosts.

Why are there two fewer usable hosts than total hosts?

In a standard subnet, the network address (all host bits zero) and the broadcast address (all host bits one) are reserved and cannot be assigned to devices, so usable hosts = total hosts - 2.

Can I use this calculator for IPv6 addresses?

No, this calculator only supports IPv4 addresses in dotted-decimal notation. IPv6 subnetting requires a different calculation method.

What is a wildcard mask used for?

A wildcard mask is the bitwise complement of the subnet mask. It is often used in Cisco access control lists to specify which bits of an address should be matched.

What happens if I enter an invalid IP address?

The calculator returns an error message: 'Invalid IPv4 address format. Please use format X.X.X.X (e.g., 192.168.1.10)'. The IP address must have four octets, each between 0 and 255, with no leading zeros.

What is the range of valid CIDR prefixes?

The CIDR prefix must be an integer between 0 and 32. Values outside this range or non-numeric input will produce an error message.

Complementary Calculators