IP Subnet Calculator

Work out the network and broadcast addresses, host range, subnet mask and usable host count for any IPv4 address and CIDR prefix. Calculates in your browser.

24

Usable hosts

-

Network address-
Broadcast address-
Host range-
Subnet mask-
Wildcard mask-
Total addresses-
Class · scope-

Show the math

The prefix splits the 32-bit address into a network part and a host part. The mask is the prefix number of 1-bits; AND it with the address for the network, OR the wildcard for the broadcast:

hosts = 2^(32 − prefix) − 2

The network and broadcast addresses are reserved, so a block of N addresses holds N − 2 usable hosts. A /31 carries two point-to-point addresses (RFC 3021) and a /32 is a single host. Calculated entirely in your browser.

What this does

An IP subnet calculator finds the network and broadcast addresses, host range, subnet mask and usable host count for any IPv4 address and CIDR prefix.

How to use it

  1. Enter an IPv4 address.
  2. Enter the CIDR prefix.
  3. Read the network, broadcast and host range.
  4. Note the usable host count.

How it works

CIDR writes the prefix length after a slash, like /24 (255.255.255.0). A /32 is one host; a /31 has two usable endpoints under RFC 3021.

usable hosts = 2^(32 - prefix) - 2

Understanding your result

The usable host count is two fewer than the total, because the network and broadcast addresses are reserved, which is the detail that trips people up when a /24 gives 254, not 256, usable hosts. Use the range to plan address assignments without overlap, and note the special cases: a /31 gives two usable endpoints for point-to-point links and a /32 is a single host.

Example

A /24 has 256 addresses and 254 usable hosts.

Sources & methodology

Last updated .

Frequently asked questions

How many hosts are in a subnet?

A prefix of /n leaves 32 − n bits for hosts, so the block holds 2^(32 − n) addresses. The network and broadcast addresses are reserved, giving 2^(32 − n) − 2 usable hosts, for example a /24 has 256 addresses and 254 usable hosts.

What is CIDR notation?

CIDR writes the address with a slash and the prefix length, like 192.168.1.0/24. The prefix is the number of leading 1-bits in the subnet mask, so /24 is 255.255.255.0.

What are /31 and /32 used for?

A /32 identifies a single host. A /31 has just two addresses and, under RFC 3021, both are usable as the endpoints of a point-to-point link, so no addresses are wasted on network and broadcast.