What is a subnet?

A subnet is a block of IP addresses that share the same first bits, called the network part. CIDR notation writes the block as an address and a prefix length: in 192.168.1.0/24, the first 24 bits are the network and the last 8 bits are for the devices, so the block holds 256 addresses. The subnet mask, here 255.255.255.0, says the same thing in dotted form.

Tool description

Type an IPv4 address with its prefix into the IP Address/CIDR field, like 192.168.1.0/24, and the subnet calculator shows the details as you type, each with a copy button. The address can be any address in the block: 192.168.10.77/26 gives the network 192.168.10.64.

  • Network Address and Broadcast Address are the first and last address of the block.
  • Subnet Mask shows the prefix as a mask, and Subnet Mask Length as a slash and a number, like /24.
  • First Host and Last Host are the range you can give to devices, and Total Hosts counts them.
  • Length is the number of all addresses in the block.

The prefix is required. An address without one, a prefix above 32 or an IPv6 address shows Invalid CIDR notation.

Features

  • Network, broadcast and host range from any address in the block
  • The subnet mask for every prefix from /0 to /32
  • The number of usable hosts, with /31 and /32 handled too

Examples

Input Network Address Subnet Mask Host range Total Hosts
192.168.1.0/24 192.168.1.0 255.255.255.0 192.168.1.1 to 192.168.1.254 254
192.168.10.77/26 192.168.10.64 255.255.255.192 192.168.10.65 to 192.168.10.126 62
10.20.30.40/20 10.20.16.0 255.255.240.0 10.20.16.1 to 10.20.31.254 4,094
10.0.0.0/8 10.0.0.0 255.0.0.0 10.0.0.1 to 10.255.255.254 16,777,214
192.0.2.4/30 192.0.2.4 255.255.255.252 192.0.2.5 to 192.0.2.6 2

Good to know

  • Total Hosts is Length minus 2, because the network and broadcast addresses can't go to devices. A /31, used for point to point links, counts both of its addresses as hosts, and a /32 is a single host.
  • The calculation runs in your browser and nothing is sent anywhere.