Back to blog

IPv4CIDRSubnet CalculatorDeveloper Tools

IPv4 Subnet Calculator: CIDR and Host Ranges

Calculate IPv4 subnets from an address and CIDR prefix. Learn network and broadcast addresses, usable host ranges, masks, and the special /31 and /32 rules.

IPv4 subnet calculation uses a CIDR prefix to split a 32-bit address into network and host bits. For a quick answer, enter an IP address and prefix in the IPv4 subnet calculator. It calculates the network address, subnet mask, broadcast address, usable host range, wildcard mask, and address counts locally in your browser.

What the IPv4 Subnet Calculator Returns

Enter a host address such as 192.168.1.10 and a CIDR prefix of 24. The result is:

Field Result Meaning
CIDR notation 192.168.1.10/24 The original IP and prefix
Subnet mask 255.255.255.0 The first 24 bits are network bits
Network address 192.168.1.0 The start of the subnet
Broadcast address 192.168.1.255 The last address in a traditional broadcast subnet
Usable host range 192.168.1.1 – 192.168.1.254 Addresses normally assignable to hosts
Total addresses 256 Includes network and broadcast addresses
Usable hosts 254 Excludes the first and last address in a normal subnet
Wildcard mask 0.0.0.255 The bitwise inverse of the subnet mask

This output is useful when checking server interfaces, routes, ACL ranges, or whether two addresses belong to the same subnet. The calculator supports every prefix from /0 through /32 and updates the results as you type.

How CIDR Prefixes Map to Subnet Masks

A CIDR (Classless Inter-Domain Routing) prefix is the number of consecutive network bits. /24 means that the first 24 bits are 1, which is 255.255.255.0 in dotted-decimal notation. Eight host bits remain, so the subnet contains 2⁸ = 256 addresses.

Here are several useful reference points:

CIDR Subnet mask Total addresses Usable hosts in a normal subnet
/8 255.0.0.0 16,777,216 16,777,214 (RFC 4632)
/16 255.255.0.0 65,536 65,534 (RFC 4632)
/24 255.255.255.0 256 254
/28 255.255.255.240 16 14
/30 255.255.255.252 4 2

Each time the prefix grows by one, one host bit disappears and the address count is halved. RFC 4632 documents CIDR addressing and aggregation. To inspect how individual binary octets produce their decimal values, use the online number base converter alongside the calculator.

Calculate an IPv4 Subnet Step by Step

Use the calculator's built-in example, 10.20.30.45/20:

  1. Open the online IPv4 subnet calculator
  2. Enter 10.20.30.45 in the IPv4 address field
  3. Enter 20 as the CIDR prefix length
  4. Read the live result, or choose “Load example” to fill both fields automatically

The expected result is:

  • Subnet mask: 255.255.240.0
  • Network address: 10.20.16.0
  • Broadcast address: 10.20.31.255
  • Usable host range: 10.20.16.1 – 10.20.31.254
  • Total addresses: 4096
  • Usable hosts: 4094

Why does the third octet change from 30 to 16? After the first two octets, /20 uses the first four bits of the third octet for the network. That creates blocks of 16, and 30 falls inside the 16–31 block.

Why /31 and /32 Need Special Handling

“Total addresses minus two” is a useful shortcut for ordinary broadcast subnets, but it does not describe /31 and /32 correctly.

A /31 contains exactly two addresses. Under the point-to-point usage described in RFC 3021, both addresses can serve as link endpoints, so the calculator shows both as usable. For example, the range for 192.0.2.10/31 is 192.0.2.10 – 192.0.2.11.

/32: One IPv4 Address

A /32 has no host bits and identifies one address. For 192.0.2.10/32, the network address, broadcast address, and host range all resolve to 192.0.2.10; total and usable address counts are both 1.

Practical Ways to Use Subnet Results

Check Whether Two IP Addresses Share a Subnet

Calculate both IP addresses with the same prefix. If their network addresses match, they are in the same subnet. If the network addresses differ, communication normally requires routing.

Validate a DHCP Pool

Calculate the usable host range, then verify that both endpoints of the DHCP pool fall within it. In an ordinary subnet, do not assign the network or broadcast address to a client.

Review an ACL or Firewall Range

ACLs often use CIDR notation or wildcard masks. Generate both representations and compare them with the device configuration line by line. The text replacement tool can help normalize repeated fields in a configuration snippet, but review the result before applying it to a device.

FAQ

Why Is the Network Address Different from 192.168.1.10 for /24?

The input is a host address inside the subnet. Applying the /24 mask clears its host bits, producing the network address 192.168.1.0.

Does a Larger Prefix Mean a Larger Subnet?

No. A larger prefix reserves more bits for the network and leaves fewer for hosts. A /28 has 16 total addresses, while a /24 has 256.

Does the Tool Upload My IP Address?

No. The page performs the calculation in the current browser, and this tool does not upload the IP address you enter.

Can It Calculate IPv6 Subnets?

No. This page validates four-part IPv4 addresses and accepts CIDR prefixes from 0 to 32; it does not implement IPv6 subnet calculation.

Summary

For a reliable IPv4 subnet calculation, verify the IP address and CIDR prefix, then check the network address, broadcast address, and usable range. Treat /31 and /32 according to their special rules. Before applying any result to production networking, compare it with the actual address plan and device requirements.

On this page