Connect via MCP →

Enter Calculation

Formula

Show calculation steps (1)
  1. CIDR & Usable Hosts

    CIDR & Usable Hosts: IPv4 Subnet Calculator

    CIDR = number of 1-bits in the Mask; Usable Hosts = 2^(32 - CIDR) - 2.

Advertisement

Results

Number of Hosts
254
Network Class C
IP Address 192.168.1.20
Subnet Mask 255.255.255.0
Wildcard Mask 0.0.0.255
Network Address 192.168.1.0
Broadcast Address 192.168.1.255
First Host 192.168.1.1
Last Host 192.168.1.254
Number of Hosts 254
CIDR Notation /24

What the IPv4 Subnet Calculator Does

This IPv4 Subnet Calculator takes two values you enter — an IP Address and a Subnet Mask — and instantly works out the key facts of the network that address belongs to. Instead of doing binary AND/OR maths by hand, you get the network address, broadcast address, usable host range, total available hosts, the network class and the wildcard mask in one step. It applies to standard 32-bit IPv4 addressing used worldwide.

The Inputs Explained

  • IP Address — any dotted-decimal IPv4 address, e.g. 192.168.1.10.
  • Subnet Mask — the mask in dotted-decimal form, e.g. 255.255.255.0, which defines how many bits identify the network versus the host.
Diagram showing a 32-bit IPv4 address split into four 8-bit octets
An IPv4 address is 32 bits divided into four octets.

How the Calculations Work

The calculator processes each octet independently:

$$\text{Network} = \text{IP} \mathbin{\&} \text{Mask}$$
  • Network address = IP AND mask (bitwise). Each IP octet is masked: ipOctet & maskOctet.
  • Broadcast address = IP OR the inverted mask: ipOctet | (maskOctet ^ 255).
  • Total usable hosts = \(2^{32 - \text{CIDR}} - 2\), where CIDR is the count of 1-bits in the mask. The −2 removes the network and broadcast addresses.
  • First host = network address + 1; Last host = broadcast address − 1.
  • Network class is read from the first octet: 1–126 = A, 128–191 = B, 192–223 = C, 224–239 = D (Multicast), 240–255 = E (Reserved).
  • Wildcard mask = the inverse of the subnet mask.
$$\left\{ \begin{aligned} \text{Network} &= \text{IP} \mathbin{\&} \text{Mask} \\ \text{Broadcast} &= \text{IP} \mathbin{|} (\text{Mask} \oplus 255) \\ \text{Wildcard} &= 255 - \text{Mask} \end{aligned} \right.$$ $$\text{CIDR} = \sum_{\text{octets}} \operatorname{bitCount}\!\left(\text{Mask}\right) \qquad \text{Hosts} = 2^{\,32 - \text{CIDR}} - 2$$
Advertisement
Diagram of a subnet mask separating network bits from host bits with a bitwise AND operation
The subnet mask splits the address into network and host portions.

Worked Example

Enter IP 192.168.1.10 and mask 255.255.255.0:

  • Network address: 192.168.1.10 AND 255.255.255.0 = 192.168.1.0
  • Broadcast address: 192.168.1.10 OR 0.0.0.255 = 192.168.1.255
  • CIDR = 24 bits, so total hosts = \(2^{32-24} - 2 = 254\)
  • First host: 192.168.1.1; Last host: 192.168.1.254
  • Class: C; Wildcard mask: 0.0.0.255

Frequently Asked Questions

Why subtract 2 from the host count? The first address in a subnet is reserved as the network identifier and the last as the broadcast address, so neither can be assigned to a device.

What is the wildcard mask used for? It is the bitwise inverse of the subnet mask (e.g. 255.255.255.0 → 0.0.0.255) and is commonly used in router access control lists and OSPF configuration.

Does it support CIDR notation directly? You enter the mask in dotted-decimal form, but the tool internally derives the CIDR prefix by counting the 1-bits in your mask to calculate host totals.

Last updated: