Skip to main content
SolvriaSolvria

IP Subnet Calculator

Calculate the network address, broadcast address, subnet mask, and usable host range for an IPv4 address.

Enter your values to calculate your result.

Report an error

About this calculator

The IP Subnet Calculator takes an IPv4 address and a CIDR prefix and works out the subnet mask, network and broadcast addresses, the usable host range and the address counts.

Use it to plan network sizes, check which subnet an address belongs to, or confirm how many hosts a prefix allows.

What each field means

IP Address — Octet 1

The first number of the IPv4 address.

Together the four octets form the address.

0 to 255.

Octet 2

The second number of the address.

Part of the address.

0 to 255.

Octet 3

The third number of the address.

Part of the address.

0 to 255.

Octet 4

The fourth number of the address.

Part of the address.

0 to 255.

CIDR Prefix Length (/)

The CIDR prefix: how many leading bits identify the network.

It sets the mask and so the subnet's size.

0 to 32.

How it is calculated

  1. Pack the four octets into one 32-bit number.
  2. Subnet mask = the first prefix bits set to 1, the rest 0.
  3. Network address = address AND mask; broadcast = network OR (NOT mask).
  4. Total addresses = 2^(32 − prefix); usable hosts = total − 2 (special cases for /31 and /32).

Subnet Mask = 32 contiguous 1-bits (per the prefix length) Network Address = IP AND Mask Broadcast Address = Network OR (NOT Mask)

The CIDR prefix length determines how many leading bits of the subnet mask are 1s. ANDing the IP address with this mask gives the network address (the subnet's identity), while setting all the non-masked bits to 1 gives the broadcast address (the subnet's last address). The addresses in between, excluding both, are usable for hosts — except for the special /31 (point-to-point, both addresses usable, RFC 3021) and /32 (a single host) cases.

Symbols used

prefix
number of network bits in the mask

Assumptions

  • IPv4 only.
  • Classless (CIDR) addressing, not the old class A/B/C rules.
  • Network and broadcast addresses are not usable by hosts, except in /31 and /32.

Example

192.168.1.0/24 has the mask 255.255.255.0, network address 192.168.1.0 and broadcast address 192.168.1.255. It holds 256 addresses, of which 254 are usable hosts (192.168.1.1 to 192.168.1.254).

Step by step

  1. Inputs: 192.168.1.0 with prefix /24.
  2. Mask: 24 one-bits = 255.255.255.0.
  3. Network 192.168.1.0, broadcast 192.168.1.255.
  4. Total addresses: 2^8 = 256; usable hosts: 256 − 2 = 254.

Reading your result

Network Address
The first address of the subnet, which identifies it.
Subnet Mask
The mask in dotted form.
Broadcast Address
The last address of the subnet.
First Usable Host
The lowest address a host can use.
Last Usable Host
The highest address a host can use.
Total Addresses
Every address in the subnet.
Usable Host Addresses
Addresses available for devices.

What you can conclude

  • The exact range and size of a subnet.
  • Which network an address falls in.

What you cannot conclude

  • Whether an address is routable or reserved.
  • How the network should be designed.

Limitations

  • A calculation aid for IPv4 only.
  • Check reserved ranges and your own addressing plan before deploying.

Frequently Asked Questions

What's special about /31 and /32?

A /32 identifies a single exact address (no network/broadcast distinction). A /31 (RFC 3021) is reserved for point-to-point links and treats both of its 2 addresses as usable hosts, with no broadcast address at all — an exception to the usual 'subtract 2' rule.

Why do I enter the IP address as 4 separate fields?

Each field is one octet (0-255) of the dotted-decimal address — entering 192, 168, 1, 0 represents the address 192.168.1.0.

Why are two addresses unusable in a normal subnet?

The first address names the network and the last one is the broadcast address used to reach every host, so neither is assigned to a device. That is why a /24 has 254 usable hosts, not 256.