IPv4 subnet calculator (CIDR)

Enter an IPv4 address and a prefix length such as /24 to get every subnet detail you need when planning a network or configuring devices.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter ipv4 address and prefix length (cidr).
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Mask = 2^32 minus 2^(32 minus prefix). Network = address AND mask; broadcast = network OR inverted mask. Total = 2^(32 minus prefix); usable = total minus 2, except /31 = 2 (RFC 3021) and /32 = 1.

Example

Inputs: IPv4 address = 10.20.30.40, Prefix length (CIDR) = 13 /. Result: Network address: 10.16.0.0; Usable hosts: 524,286; Total addresses: 524,288.

10.20.30.40
10.16.0.0

Limits and caveats

  • IPv4 only; use the IPv6 expander for IPv6 addresses.
  • /31 counts 2 usable hosts per RFC 3021; some older devices do not support it.

Questions about this tool

Why are usable hosts 2 fewer than total addresses?

The first address names the network and the last is the broadcast, so neither goes to a device. /31 and /32 are the exceptions.

What is a wildcard mask?

It is the inverted subnet mask, used by Cisco access lists and OSPF to match address ranges.

How many hosts fit in a /24?

A /24 has 256 addresses, of which 254 are usable.