IP Subnet Calculator

Network Address192.168.1.0
Broadcast192.168.1.255
First Host192.168.1.1
Last Host192.168.1.254
Total Hosts254
CIDR/24

This IP subnet calculator takes an IPv4 address and a CIDR prefix or dotted-decimal subnet mask and works out the full addressing detail of the network. By applying the mask to the address with bitwise operations, it derives the network address, the broadcast address, the usable host range, and the total number of assignable hosts. It is a quick way to plan address space, check whether two addresses share a subnet, or document a network.

Formula

Network = IP AND Mask; Broadcast = Network OR (NOT Mask); Usable hosts = 2^(32 − CIDR) − 2

IP
The 32-bit IPv4 address being analysed
Mask
Subnet mask derived from the CIDR prefix (CIDR ones followed by zeros)
CIDR
Prefix length: number of leading 1-bits in the mask (0 to 32)
Usable hosts
Assignable addresses, excluding the network and broadcast addresses

How it works

  1. Enter an IPv4 address (such as 192.168.1.50) and a subnet, given either as CIDR notation (/24) or a dotted-decimal mask (255.255.255.0).
  2. The calculator builds a 32-bit mask from the prefix length, ANDs it with the address to find the network address, and ORs the inverted mask to find the broadcast address.
  3. It reports the first and last usable host addresses and the total host count, which is 2^(32 − prefix) − 2 for prefixes of /30 or shorter.

Worked example

Analysing 192.168.1.50 with a /24 prefix (mask 255.255.255.0).

  1. The /24 mask keeps the first three octets, so the network address is 192.168.1.0.
  2. Inverting the mask sets the host bits, giving a broadcast address of 192.168.1.255.
  3. Usable hosts: 2^(32 − 24) − 2 = 256 − 2 = 254, ranging from 192.168.1.1 to 192.168.1.254.

Network 192.168.1.0, broadcast 192.168.1.255, 254 usable hosts (.1 through .254).

Frequently asked questions

Why are two addresses subtracted from the host count?
Every subnet reserves its first address as the network identifier and its last as the broadcast address, neither of which can be assigned to a device. That is why usable hosts equal 2^(32 − prefix) minus 2.
Can I enter a subnet mask instead of CIDR?
Yes. You can supply either CIDR notation like /24 or a dotted-decimal mask like 255.255.255.0. The calculator validates that the mask is contiguous (all 1-bits before any 0-bits) and converts it to the equivalent prefix length.
How do /31 and /32 networks behave?
A /32 describes a single host and a /31 describes a two-address point-to-point link, so the usual network and broadcast reservations do not leave room for ordinary hosts. The calculator reports zero usable hosts for these prefixes.
Does this support IPv6?
No. This tool works with 32-bit IPv4 addresses and prefixes from /0 to /32 only. IPv6, with its 128-bit addresses and different notation, is not covered here.