Tutorial · CIDR Calculator · 4 min read

CIDR and Subnet Calculation Explained

Work out the network, broadcast, subnet mask and usable host range for any IPv4 CIDR block, with the formula behind /24, /22 and the point-to-point /31.

CIDR notation such as 10.0.0.0/22 packs a network and its size into one string. The prefix length says how many bits are the network; the rest are hosts. From that you can derive every fact about the block, which is what you need when carving up a VPC or checking whether two ranges overlap.

What you'll learn

  • Read a prefix length and turn it into a subnet mask
  • Compute total and usable addresses with 2^(32 − prefix)
  • Find the first and last usable host of a block

Step by step

  1. Enter the CIDR block

    Open the CIDR / Subnet Calculator and type an address with a prefix, for example 192.168.1.130/25. Results update as you type.

  2. Read the block facts

    Network address, broadcast, subnet and wildcard masks, total addresses and the usable range are shown together.

    10.0.0.0/22
    
    Network:    10.0.0.0
    Broadcast:  10.0.3.255
    Mask:       255.255.252.0
    Total:      1,024
    Usable:     10.0.0.1 – 10.0.3.254  (1,022 hosts)
  3. Apply the formula

    Usable hosts = 2^(32 − prefix) − 2, the two being network and broadcast. /24 gives 254, /22 gives 1,022, /16 gives 65,534.

  4. Mind the special cases

    A /31 has two usable addresses for point-to-point links (RFC 3021) and a /32 is a single host.

Open the tool with this example Runs in your browser. Nothing you paste is uploaded.

Common problems

That is not a valid IPv4 address

Each of the four octets must be 0–255 and the prefix 0–32. 999.1.1.1/40 fails on both counts.

Do two subnets overlap?

Calculate both ranges and compare the first and last addresses. If either range contains the other's network address, they overlap.

FAQ

Does it support IPv6?

Not yet. It handles IPv4 blocks, which is where most VPC and office sizing questions live.