ReadyCalcs · All calculators · Compare

CIDR Subnet Calculator

Use this CIDR subnet calculator to turn an IPv4 address and /prefix into a network address, subnet mask, broadcast address and usable host range.

CIDR Subnet Calculator

Network address192.168.1.0
Subnet mask255.255.255.0
Last address / directed broadcast192.168.1.255
First usable host address192.168.1.1
Last usable host address192.168.1.254

About this calculation

Use this CIDR subnet calculator when you know an IPv4 address and prefix length but need the exact block it belongs to. Enter the four decimal octets separately and a prefix from /0 to /32. The outputs show the network address, dotted-decimal mask, last address, conventional host range and block size. The example 192.168.1.42/24 belongs to 192.168.1.0/24, not a block starting with final octet 42. This tool treats prefixes as IPv4 only; IPv6 has a different address size and is not silently converted.

Formula

mask = high prefix bits set; network = IP AND mask; last = network OR NOT mask; total = 2^(32-prefix)

Worked example

With IPv4 octet 1: 192, IPv4 octet 2: 168, IPv4 octet 3: 1, IPv4 octet 4: 42, CIDR prefix length: 24, network address is 192.168.1.0 IPv4.

What the slash number means

In CIDR notation the number after the slash says how many leading bits identify the network. IPv4 has 32 bits in four octets. A /24 fixes the first 24 bits, leaving eight host bits and 2^8 = 256 addresses. The corresponding mask is 255.255.255.0. The calculator sets those leading bits in the mask, performs a bitwise AND with the entered address to obtain the network, then sets the remaining host bits to one to find the last address. RFC 4632 describes classless prefixes and shows their possible block sizes. The first and last addresses are not always assignable host addresses.

Walk through a /24 example

For 192.168.1.42/24, the network is 192.168.1.0, the last address is 192.168.1.255 and the usual usable range is 192.168.1.1 through 192.168.1.254. That gives 254 conventionally usable host addresses, while the block contains 256 total addresses. The last address is conventionally a directed broadcast for a typical /24 LAN. If the input is 10.1.7.200/23, the third octet boundary changes: the containing block starts at 10.1.6.0 and ends at 10.1.7.255. Do not assume the last octet alone determines the network.

Handle /31 and /32 correctly

A /31 contains two addresses, and RFC 3021 permits both as endpoint addresses on a point-to-point link; neither is reserved as a conventional directed broadcast there. The table therefore reports two usable endpoints for /31 and shows both ends of that two-address range. A /32 contains exactly one address and is commonly used as a host route, so its first and last are the same address. In those two cases the output label containing “broadcast” means the numeric last address of the block, not that a directed broadcast packet is valid. For ordinary /0 through /30 LAN-style host counts, the tool subtracts network and broadcast positions.

Use the result in a network plan

A subnet boundary may affect firewall rules, routes, DHCP pools and address allocation. Copy the network address together with its /prefix, because the dotted address alone does not describe the block. A usable range is arithmetic, not a promise that every address is free or should be assigned; infrastructure, reserved addresses and provider policy can reduce the practical pool. For a /0 the tool displays the formal entire IPv4 address space, but treating all public and private ranges as one assignable local LAN would be misleading. Check the actual interface configuration and routing domain.

Common input and interpretation errors

Each octet must be a whole number from 0 to 255, and the prefix must be a whole number from 0 to 32. A leading-zero textual address is avoided by entering octets numerically. The calculator does not validate that a chosen address is globally routable or inside a private range; it only performs prefix arithmetic. It also does not decide whether a /31 is supported on your particular link or device. Shared result links expose the network inputs in the URL, so avoid using private infrastructure details in a public post unless appropriate.

Common questions

Why does /24 have 254 usable hosts rather than 256?

There are 256 addresses in the block. On a conventional /24 subnet, the first is the network address and the last is the directed-broadcast address, leaving 254 host positions.

Why does /31 show two usable addresses?

RFC 3021 defines the two addresses as endpoints on supported point-to-point links. A /31 is not treated like an ordinary LAN with network and broadcast reservations.

Sources and references

Inputs

  • IPv4 octet 1
  • IPv4 octet 2
  • IPv4 octet 3
  • IPv4 octet 4
  • CIDR prefix length

Related calculators

Start with your task